Pass an Isolate to v8::VisitHandlesWithClassIds

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
This commit is contained in:
haraken@chromium.org 2014-10-17 00:46:18 +00:00
parent 80acb53d22
commit f3bfd04bcf
3 changed files with 18 additions and 1 deletions

View File

@ -5295,6 +5295,13 @@ class V8_EXPORT V8 {
*/ */
static void VisitHandlesWithClassIds(PersistentHandleVisitor* visitor); 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 * 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 * that have class_ids and are candidates to be marked as partially dependent

View 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) { void v8::V8::VisitHandlesWithClassIds(PersistentHandleVisitor* visitor) {
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
i::DisallowHeapAllocation no_allocation; i::DisallowHeapAllocation no_allocation;

View File

@ -20325,7 +20325,7 @@ TEST(PersistentHandleVisitor) {
CHECK_EQ(42, object.WrapperClassId()); CHECK_EQ(42, object.WrapperClassId());
Visitor42 visitor(&object); Visitor42 visitor(&object);
v8::V8::VisitHandlesWithClassIds(&visitor); v8::V8::VisitHandlesWithClassIds(isolate, &visitor);
CHECK_EQ(1, visitor.counter_); CHECK_EQ(1, visitor.counter_);
object.Reset(); object.Reset();