Commit 0e60ff7d authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions Cleanup] Clean up a variable initialization

Bug: None
Change-Id: I2a849c1fa711f6c603cdb2a4b146b75a09fba04a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1841612
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarDavid Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718934}
parent e0e27d97
...@@ -299,23 +299,24 @@ void ScriptInjection::InjectJs(std::set<std::string>* executing_scripts, ...@@ -299,23 +299,24 @@ void ScriptInjection::InjectJs(std::set<std::string>* executing_scripts,
if (injection_host_->id().type() == HostID::EXTENSIONS && log_activity_) if (injection_host_->id().type() == HostID::EXTENSIONS && log_activity_)
DOMActivityLogger::AttachToWorld(world_id, injection_host_->id().id()); DOMActivityLogger::AttachToWorld(world_id, injection_host_->id().id());
blink::WebLocalFrame::ScriptExecutionType option; // For content scripts executing during page load, we run them asynchronously
if (injector_->script_type() == UserScript::CONTENT_SCRIPT) { // in order to reduce UI jank experienced by the user. (We don't do this for
switch (run_location_) { // DOCUMENT_START scripts, because there's no UI to jank until after those
case UserScript::DOCUMENT_END: // run, so we run them as soon as we can.)
case UserScript::DOCUMENT_IDLE: // Note: We could potentially also run deferred and browser-driven scripts
option = blink::WebLocalFrame::kAsynchronousBlockingOnload; // asynchronously; however, these are rare enough that there probably isn't
break; // UI jank. If this changes, we can update this.
default: bool should_execute_asynchronously =
option = blink::WebLocalFrame::kSynchronous; injector_->script_type() == UserScript::CONTENT_SCRIPT &&
break; (run_location_ == UserScript::DOCUMENT_END ||
} run_location_ == UserScript::DOCUMENT_IDLE);
} else { blink::WebLocalFrame::ScriptExecutionType execution_option =
option = blink::WebLocalFrame::kSynchronous; should_execute_asynchronously
} ? blink::WebLocalFrame::kAsynchronousBlockingOnload
: blink::WebLocalFrame::kSynchronous;
web_frame->RequestExecuteScriptInIsolatedWorld( web_frame->RequestExecuteScriptInIsolatedWorld(
world_id, &sources.front(), sources.size(), is_user_gesture, option, world_id, &sources.front(), sources.size(), is_user_gesture,
callback.release()); execution_option, callback.release());
} }
void ScriptInjection::OnJsInjectionCompleted( void ScriptInjection::OnJsInjectionCompleted(
......
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