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

Unified Diff: extensions/renderer/script_context.cc

Issue 1142993002: Don't send unnecessary ExtensionMsg_Loaded IPCs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: a test Created 5 years, 7 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
« extensions/renderer/dispatcher.cc ('K') | « extensions/renderer/script_context.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/script_context.cc
diff --git a/extensions/renderer/script_context.cc b/extensions/renderer/script_context.cc
index ac87f7098f8fb3f03c2f59e845877f895e74246e..32222b0ca065128032dc5142f1401c19ba208368 100644
--- a/extensions/renderer/script_context.cc
+++ b/extensions/renderer/script_context.cc
@@ -96,15 +96,7 @@ ScriptContext::ScriptContext(const v8::Local<v8::Context>& v8_context,
isolate_(v8_context->GetIsolate()),
url_(web_frame_ ? GetDataSourceURLForFrame(web_frame_) : GURL()),
runner_(new Runner(this)) {
- VLOG(1) << "Created context:\n"
- << " extension id: " << GetExtensionID() << "\n"
- << " frame: " << web_frame_ << "\n"
- << " URL: " << GetURL() << "\n"
- << " context type: " << GetContextTypeDescription() << "\n"
- << " effective extension id: "
- << (effective_extension_.get() ? effective_extension_->id() : "")
- << " effective context type: "
- << GetEffectiveContextTypeDescription();
+ VLOG(1) << "Created context:\n" << GetDebugString();
gin::PerContextData* gin_data = gin::PerContextData::From(v8_context);
CHECK(gin_data); // may fail if the v8::Context hasn't been registered yet
gin_data->set_runner(runner_.get());
@@ -233,11 +225,11 @@ void ScriptContext::DispatchOnUnloadEvent() {
module_system_->CallModuleMethod("unload_event", "dispatch");
}
-std::string ScriptContext::GetContextTypeDescription() {
+std::string ScriptContext::GetContextTypeDescription() const {
return GetContextTypeDescriptionString(context_type_);
}
-std::string ScriptContext::GetEffectiveContextTypeDescription() {
+std::string ScriptContext::GetEffectiveContextTypeDescription() const {
return GetContextTypeDescriptionString(effective_context_type_);
}
@@ -373,6 +365,21 @@ bool ScriptContext::HasAccessOrThrowError(const std::string& name) {
return true;
}
+std::string ScriptContext::GetDebugString() const {
+ return base::StringPrintf(
+ " extension id: %s\n"
+ " frame: %p\n"
+ " URL: %s\n"
+ " context_type: %s\n"
+ " effective extension id: %s\n"
+ " effective context type: %s",
+ extension_.get() ? extension_->id().c_str() : "(none)", web_frame_,
+ GetURL().spec().c_str(), GetContextTypeDescription().c_str(),
+ effective_extension_.get() ? effective_extension_->id().c_str()
+ : "(none)",
+ GetEffectiveContextTypeDescription().c_str());
+}
+
ScriptContext::Runner::Runner(ScriptContext* context) : context_(context) {
}
« extensions/renderer/dispatcher.cc ('K') | « extensions/renderer/script_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698