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 0f02b27c6e262453567455690214bdf184b84392..5ef1f30b33412cf913fbf5a1b06d1303883ab68a 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp |
+++ b/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp |
@@ -50,6 +50,8 @@ |
#include "core/svg/SVGElement.h" |
#include "platform/Histogram.h" |
#include "platform/TraceEvent.h" |
+#include "public/platform/Platform.h" |
+#include "public/platform/WebBlameContext.h" |
#include "wtf/Partitions.h" |
#include "wtf/Vector.h" |
#include <algorithm> |
@@ -266,6 +268,11 @@ void V8GCController::gcPrologue(v8::Isolate* isolate, v8::GCType type, v8::GCCal |
if (isMainThread()) |
ScriptForbiddenScope::enter(); |
+ // Attribute garbage collection to the entire thread instead of a specific |
+ // frame. |
+ if (WebBlameContext* blameContext = Platform::current()->threadBlameContext()) |
+ blameContext->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 |
// run finalizers that call into V8. To avoid the risk, we should post |
@@ -330,6 +337,9 @@ void V8GCController::gcEpilogue(v8::Isolate* isolate, v8::GCType type, v8::GCCal |
if (isMainThread()) |
ScriptForbiddenScope::exit(); |
+ if (WebBlameContext* blameContext = Platform::current()->threadBlameContext()) |
+ blameContext->leave(); |
+ |
// v8::kGCCallbackFlagForced forces a Blink heap garbage collection |
// when a garbage collection was forced from V8. This is either used |
// for tests that force GCs from JavaScript to verify that objects die |