Commit 95964bd9 authored by kasperl@chromium.org's avatar kasperl@chromium.org

Let the callers of V8::ContextDisposedNoticication() know

how many pending context disposals there are.
Review URL: http://codereview.chromium.org/669266

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4049 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9fd33e74
......@@ -2507,9 +2507,11 @@ class V8EXPORT V8 {
/**
* 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();
......
......@@ -2872,9 +2872,9 @@ void v8::V8::LowMemoryNotification() {
}
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();
}
......
......@@ -372,11 +372,6 @@ void Heap::CollectAllGarbage(bool force_compaction) {
}
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);
......
......@@ -643,7 +643,7 @@ class Heap : public AllStatic {
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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment