Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp

Issue 1447563002: Implement frame attribution (FrameBlamer) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: It builds => ship it. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698