summaryrefslogtreecommitdiff
path: root/Runtime/Misc/BatchDeleteObjects.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-08-14 22:50:43 +0800
committerchai <chaifix@163.com>2019-08-14 22:50:43 +0800
commit15740faf9fe9fe4be08965098bbf2947e096aeeb (patch)
treea730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Misc/BatchDeleteObjects.h
+Unity Runtime codeHEADmaster
Diffstat (limited to 'Runtime/Misc/BatchDeleteObjects.h')
-rw-r--r--Runtime/Misc/BatchDeleteObjects.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/Runtime/Misc/BatchDeleteObjects.h b/Runtime/Misc/BatchDeleteObjects.h
new file mode 100644
index 0000000..096e9a1
--- /dev/null
+++ b/Runtime/Misc/BatchDeleteObjects.h
@@ -0,0 +1,31 @@
+#pragma once
+
+class Object;
+
+struct BatchDelete
+{
+ size_t reservedObjectCount;
+ size_t objectCount;
+ Object** objects;
+};
+
+// Creates a batch delete object. When the object array has been filled (All Object* must be set. The function does not set them to null)
+// You can call CommitBatchDelete which will make the deletion thread delete the objects.
+BatchDelete CreateBatchDelete (size_t size);
+
+// Makes the batch delete
+void CommitBatchDelete (BatchDelete& batchDelete);
+
+
+/// Deletes an array of objects identified by instanceID. Deallocation is done on another thread.
+/// Callbacks like ScriptableObject.OnDestroy etc must be called before invoking this function.
+void BatchDeleteObjectInternal (const SInt32* unloadObjects, int size);
+
+
+// Used by the batch deletion to figure out if a specific class must be deallocated on the main thread. Eg. Textures need to be deallocate on the main thread
+// Object::MainThreadCleanup will be called if this per class check returns true.
+bool DoesClassRequireMainThreadDeallocation (int classID);
+
+
+void InitializeBatchDelete ();
+void CleanupBatchDelete (); \ No newline at end of file