Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Unified Diff: src/isolate.h

Issue 2676513008: [wasm] Managed<T> ensures T's lifetime does not leak past Isolate's (Closed)
Patch Set: better api fixes Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/isolate.cc » ('j') | src/isolate.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.h
diff --git a/src/isolate.h b/src/isolate.h
index 6d35c51830795c204d86d6b0d358666869a1a711..2e1b23380cfa1ab27d6cd7849a36885a9d8cf93b 100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -1200,6 +1200,32 @@ class Isolate {
void set_allow_atomics_wait(bool set) { allow_atomics_wait_ = set; }
bool allow_atomics_wait() { return allow_atomics_wait_; }
+ // List of native heap values allocated by the runtime as part of its
+ // implementation
+ // that must be freed at isolate deinit.
+ class ManagedLifeline final {
titzer 2017/02/08 23:32:47 Please just make this a struct, forward declare it
titzer 2017/02/08 23:32:48 ManagedObjectList?
Mircea Trofin 2017/02/08 23:52:35 Maybe - although the fact it's a list is an implem
Mircea Trofin 2017/02/08 23:52:36 The user of this needs to call the value() API (se
+ public:
+ typedef void (*Deleter)(void*);
+ ~ManagedLifeline();
+ void* value() const { return value_; }
+
+ private:
+ friend class Isolate;
+
+ ManagedLifeline()
+ : prev_(nullptr), next_(nullptr), deleter_(nullptr), value_(nullptr) {}
titzer 2017/02/08 23:32:47 I think you can use the inline initializer for the
Mircea Trofin 2017/02/08 23:52:36 Acknowledged.
+ void Clear();
+ void CallDeleter();
+
+ ManagedLifeline* prev_;
+ ManagedLifeline* next_;
+ Deleter deleter_;
+ void* value_;
+ };
+
+ ManagedLifeline* AddManagedObject(void* value,
+ ManagedLifeline::Deleter deleter);
+
protected:
explicit Isolate(bool enable_serializer);
bool IsArrayOrObjectPrototype(Object* object);
@@ -1481,6 +1507,8 @@ class Isolate {
bool allow_atomics_wait_;
+ ManagedLifeline managed_lifelines_root_;
+
friend class ExecutionAccess;
friend class HandleScopeImplementer;
friend class HeapTester;
« no previous file with comments | « no previous file | src/isolate.cc » ('j') | src/isolate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698