Commit b0031efd authored by Hui Yingst's avatar Hui Yingst Committed by Chromium LUCI CQ

CodeHealthRotation: Migrate RunScriptExceptionHandler to base::OnceCallback in...

CodeHealthRotation: Migrate RunScriptExceptionHandler to base::OnceCallback in extensions/renderer/.

Bug: 1152265
Change-Id: I90a519bfb5c979f25a405800a5a1b92e12c89d3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2574070
Commit-Queue: Hui Yingst <nigi@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835078}
parent cc02adb1
......@@ -513,7 +513,7 @@ void Dispatcher::WillEvaluateServiceWorkerOnWorkerThread(
{
v8::Local<v8::Value> result = context->RunScript(
v8_helpers::ToV8StringUnsafe(isolate, "service_worker"), script,
base::Bind(&CrashOnException));
base::BindOnce(&CrashOnException));
CHECK(result->IsFunction());
main_function = result.As<v8::Function>();
}
......
......@@ -580,8 +580,8 @@ v8::Local<v8::Value> ModuleSystem::RunString(v8::Local<v8::String> code,
v8::Local<v8::String> name) {
return context_->RunScript(
name, code,
base::Bind(&ExceptionHandler::HandleUncaughtException,
base::Unretained(exception_handler_.get())),
base::BindOnce(&ExceptionHandler::HandleUncaughtException,
base::Unretained(exception_handler_.get())),
v8::ScriptCompiler::NoCacheReason::kNoCacheBecauseExtensionModule);
}
......
......@@ -599,7 +599,7 @@ std::string ScriptContext::GetStackTraceAsString() const {
v8::Local<v8::Value> ScriptContext::RunScript(
v8::Local<v8::String> name,
v8::Local<v8::String> code,
const RunScriptExceptionHandler& exception_handler,
RunScriptExceptionHandler exception_handler,
v8::ScriptCompiler::NoCacheReason no_cache_reason) {
DCHECK(thread_checker_.CalledOnValidThread());
v8::EscapableHandleScope handle_scope(isolate());
......@@ -627,13 +627,13 @@ v8::Local<v8::Value> ScriptContext::RunScript(
v8::ScriptCompiler::kNoCompileOptions,
no_cache_reason)
.ToLocal(&script)) {
exception_handler.Run(try_catch);
std::move(exception_handler).Run(try_catch);
return v8::Undefined(isolate());
}
v8::Local<v8::Value> result;
if (!script->Run(v8_context()).ToLocal(&result)) {
exception_handler.Run(try_catch);
std::move(exception_handler).Run(try_catch);
return v8::Undefined(isolate());
}
......
......@@ -46,7 +46,8 @@ class Extension;
// functionality as those bound to the main RenderThread.
class ScriptContext {
public:
using RunScriptExceptionHandler = base::Callback<void(const v8::TryCatch&)>;
using RunScriptExceptionHandler =
base::OnceCallback<void(const v8::TryCatch&)>;
ScriptContext(const v8::Local<v8::Context>& context,
blink::WebLocalFrame* frame,
......@@ -262,7 +263,7 @@ class ScriptContext {
v8::Local<v8::Value> RunScript(
v8::Local<v8::String> name,
v8::Local<v8::String> code,
const RunScriptExceptionHandler& exception_handler,
RunScriptExceptionHandler exception_handler,
v8::ScriptCompiler::NoCacheReason no_cache_reason =
v8::ScriptCompiler::NoCacheReason::kNoCacheNoReason);
......
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