Pass an Isolate to v8::VisitHandlesWithClassIds
authorharaken@chromium.org <haraken@chromium.org>
Fri, 17 Oct 2014 00:46:18 +0000 (00:46 +0000)
committerharaken@chromium.org <haraken@chromium.org>
Fri, 17 Oct 2014 00:46:18 +0000 (00:46 +0000)
The Isolate version of v8::VisitHandlesWithClassIds is needed
for https://codereview.chromium.org/651713002/

R=dcarney@chromium.org

Review URL: https://codereview.chromium.org/664473002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24671 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

include/v8.h
src/api.cc
test/cctest/test-api.cc

index f2f47a6..a191c07 100644 (file)
@@ -5296,6 +5296,13 @@ class V8_EXPORT V8 {
   static void VisitHandlesWithClassIds(PersistentHandleVisitor* visitor);
 
   /**
+   * Iterates through all the persistent handles in isolate's heap that have
+   * class_ids.
+   */
+  static void VisitHandlesWithClassIds(
+      Isolate* isolate, PersistentHandleVisitor* visitor);
+
+  /**
    * Iterates through all the persistent handles in the current isolate's heap
    * that have class_ids and are candidates to be marked as partially dependent
    * handles. This will visit handles to young objects created since the last
index 0febe84..4929fda 100644 (file)
@@ -5115,6 +5115,16 @@ class VisitorAdapter : public i::ObjectVisitor {
 };
 
 
+void v8::V8::VisitHandlesWithClassIds(v8::Isolate* exported_isolate,
+    PersistentHandleVisitor* visitor) {
+  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(exported_isolate);
+  i::DisallowHeapAllocation no_allocation;
+
+  VisitorAdapter visitor_adapter(visitor);
+  isolate->global_handles()->IterateAllRootsWithClassIds(&visitor_adapter);
+}
+
+
 void v8::V8::VisitHandlesWithClassIds(PersistentHandleVisitor* visitor) {
   i::Isolate* isolate = i::Isolate::Current();
   i::DisallowHeapAllocation no_allocation;
index 1c67e1f..283bcb8 100644 (file)
@@ -20325,7 +20325,7 @@ TEST(PersistentHandleVisitor) {
   CHECK_EQ(42, object.WrapperClassId());
 
   Visitor42 visitor(&object);
-  v8::V8::VisitHandlesWithClassIds(&visitor);
+  v8::V8::VisitHandlesWithClassIds(isolate, &visitor);
   CHECK_EQ(1, visitor.counter_);
 
   object.Reset();