Commit 1ab087d8 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[heap-profiler] Annotate global handles

With these annotations the corresponding global handles now have names
in DevTools, making it easy to identify where a context is held alive.

Bug: chromium:811842
Change-Id: I10df68d3024a07744e7f18a27f7c07700545a803
Reviewed-on: https://chromium-review.googlesource.com/962789Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543684}
parent 1bfa23fd
...@@ -89,6 +89,7 @@ ScriptContext::ScriptContext(const v8::Local<v8::Context>& v8_context, ...@@ -89,6 +89,7 @@ ScriptContext::ScriptContext(const v8::Local<v8::Context>& v8_context,
safe_builtins_(this), safe_builtins_(this),
isolate_(v8_context->GetIsolate()) { isolate_(v8_context->GetIsolate()) {
VLOG(1) << "Created context:\n" << GetDebugString(); VLOG(1) << "Created context:\n" << GetDebugString();
v8_context_.AnnotateStrongRetainer("extensions::ScriptContext::v8_context_");
if (web_frame_) if (web_frame_)
url_ = GetAccessCheckedFrameURL(web_frame_); url_ = GetAccessCheckedFrameURL(web_frame_);
} }
......
...@@ -21,6 +21,7 @@ ContextHolder::~ContextHolder() { ...@@ -21,6 +21,7 @@ ContextHolder::~ContextHolder() {
void ContextHolder::SetContext(v8::Local<v8::Context> context) { void ContextHolder::SetContext(v8::Local<v8::Context> context) {
DCHECK(context_.IsEmpty()); DCHECK(context_.IsEmpty());
context_.Reset(isolate_, context); context_.Reset(isolate_, context);
context_.AnnotateStrongRetainer("gin::ContextHolder::context_");
data_.reset(new PerContextData(this, context)); data_.reset(new PerContextData(this, context));
} }
......
...@@ -175,8 +175,11 @@ class ScriptStateProtectingContext { ...@@ -175,8 +175,11 @@ class ScriptStateProtectingContext {
public: public:
ScriptStateProtectingContext(ScriptState* script_state) ScriptStateProtectingContext(ScriptState* script_state)
: script_state_(script_state) { : script_state_(script_state) {
if (script_state_) if (script_state_) {
context_.Set(script_state_->GetIsolate(), script_state_->GetContext()); context_.Set(script_state_->GetIsolate(), script_state_->GetContext());
context_.Get().AnnotateStrongRetainer(
"blink::ScriptStateProtectingContext::context_");
}
} }
ScriptState* operator->() const { return script_state_.get(); } ScriptState* operator->() const { return script_state_.get(); }
......
...@@ -52,6 +52,7 @@ V8PerContextData::V8PerContextData(v8::Local<v8::Context> context) ...@@ -52,6 +52,7 @@ V8PerContextData::V8PerContextData(v8::Local<v8::Context> context)
context_(isolate_, context), context_(isolate_, context),
activity_logger_(nullptr) { activity_logger_(nullptr) {
context_holder_->SetContext(context); context_holder_->SetContext(context);
context_.Get().AnnotateStrongRetainer("blink::V8PerContextData::context_");
if (IsMainThread()) { if (IsMainThread()) {
InstanceCounters::IncrementCounter( InstanceCounters::IncrementCounter(
......
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