Reviewers: Mads Ager, Description: Let the callers of V8::ContextDisposedNoticication() know how many pending context disposals there are.
Please review this at http://codereview.chromium.org/669266 SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ Affected files: M include/v8.h M src/api.cc M src/heap.h M src/heap.cc Index: include/v8.h =================================================================== --- include/v8.h (revision 4048) +++ include/v8.h (working copy) @@ -2507,9 +2507,11 @@ /** * Optional notification that a context has been disposed. V8 uses - * these notifications to guide the garbage collection heuristic. + * these notifications to guide the GC heuristic. Returns the number + * of context disposals - including this one - since the last time + * V8 had a chance to clean up. */ - static void ContextDisposedNotification(); + static int ContextDisposedNotification(); private: V8(); Index: src/api.cc =================================================================== --- src/api.cc (revision 4048) +++ src/api.cc (working copy) @@ -2872,9 +2872,9 @@ } -void v8::V8::ContextDisposedNotification() { - if (!i::V8::IsRunning()) return; - i::Heap::NotifyContextDisposed(); +int v8::V8::ContextDisposedNotification() { + if (!i::V8::IsRunning()) return 0; + return i::Heap::NotifyContextDisposed(); } Index: src/heap.cc =================================================================== --- src/heap.cc (revision 4048) +++ src/heap.cc (working copy) @@ -372,11 +372,6 @@ } -void Heap::NotifyContextDisposed() { - contexts_disposed_++; -} - - bool Heap::CollectGarbage(int requested_size, AllocationSpace space) { // The VM is in the GC state until exiting this function. VMState state(GC); Index: src/heap.h =================================================================== --- src/heap.h (revision 4048) +++ src/heap.h (working copy) @@ -643,7 +643,7 @@ static void CollectAllGarbage(bool force_compaction); // Notify the heap that a context has been disposed. - static void NotifyContextDisposed(); + static int NotifyContextDisposed() { return ++contexts_disposed_; } // Utility to invoke the scavenger. This is needed in test code to // ensure correct callback for weak global handles. -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
