Index: third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp |
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp b/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp |
index 7fb4f48543c9c0dbd414bc9fa0eda454aadfe0e7..48cb24bd1536d3fd51735379a0422234d2bd731b 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp |
+++ b/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp |
@@ -51,6 +51,7 @@ |
#include "core/svg/SVGElement.h" |
#include "platform/Histogram.h" |
#include "platform/TraceEvent.h" |
+#include "public/platform/WebBlameContext.h" |
#include "wtf/Partitions.h" |
#include "wtf/Vector.h" |
#include <algorithm> |
@@ -275,8 +276,14 @@ void gcPrologueForMajorGC(v8::Isolate* isolate, bool constructRetainedObjectInfo |
void V8GCController::gcPrologue(v8::Isolate* isolate, v8::GCType type, v8::GCCallbackFlags flags) |
{ |
- if (isMainThread()) |
+ if (isMainThread()) { |
ScriptForbiddenScope::enter(); |
+ // Attribute garbage collection to the entire thread instead of a specific |
+ // frame. |
+ } |
+ |
+ if (WebBlameContext* blame_context = Platform::current()->threadBlameContext()) |
+ blame_context->enter(); |
// TODO(haraken): A GC callback is not allowed to re-enter V8. This means |
// that it's unsafe to run Oilpan's GC in the GC callback because it may |
@@ -284,7 +291,6 @@ void V8GCController::gcPrologue(v8::Isolate* isolate, v8::GCType type, v8::GCCal |
// a task to schedule the Oilpan's GC. |
// (In practice, there is no finalizer that calls into V8 and thus is safe.) |
- v8::HandleScope scope(isolate); |
switch (type) { |
case v8::kGCTypeScavenge: |
if (ThreadState::current()) |
@@ -339,8 +345,12 @@ void V8GCController::gcEpilogue(v8::Isolate* isolate, v8::GCType type, v8::GCCal |
ASSERT_NOT_REACHED(); |
} |
- if (isMainThread()) |
+ if (isMainThread()) { |
ScriptForbiddenScope::exit(); |
+ } |
+ |
+ if (WebBlameContext* blame_context = Platform::current()->threadBlameContext()) |
+ blame_context->leave(); |
// v8::kGCCallbackFlagForced forces a Blink heap garbage collection |
// when a garbage collection was forced from V8. This is either used |