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

Unified Diff: extensions/renderer/script_context.cc

Issue 2339683006: [Blink] Modify SuspendableScriptExecutor to take a v8::Function (Closed)
Patch Set: Win compile fix Created 4 years, 2 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
« no previous file with comments | « extensions/renderer/script_context.h ('k') | third_party/WebKit/Source/web/SuspendableScriptExecutor.h » ('j') | 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 f611ddebf7112e9d6fb6b63aa5d993fb77fc4c07..01e0b297f751faf4df171bd2c918421b12b8962d 100644
--- a/extensions/renderer/script_context.cc
+++ b/extensions/renderer/script_context.cc
@@ -202,6 +202,22 @@ v8::Local<v8::Value> ScriptContext::CallFunction(
function, global, argc, argv)));
}
+void ScriptContext::SafeCallFunction(const v8::Local<v8::Function>& function,
+ int argc,
+ v8::Local<v8::Value> argv[]) {
+ v8::HandleScope handle_scope(isolate());
+ v8::Context::Scope scope(v8_context());
+ v8::MicrotasksScope microtasks(isolate(),
+ v8::MicrotasksScope::kDoNotRunMicrotasks);
+ v8::Local<v8::Object> global = v8_context()->Global();
+ if (web_frame_) {
+ web_frame_->requestExecuteV8Function(function, global, argc, argv, nullptr);
+ } else {
+ // TODO(devlin): This probably isn't safe.
+ function->Call(global, argc, argv);
+ }
+}
+
v8::Local<v8::Value> ScriptContext::CallFunction(
const v8::Local<v8::Function>& function) const {
DCHECK(thread_checker_.CalledOnValidThread());
« no previous file with comments | « extensions/renderer/script_context.h ('k') | third_party/WebKit/Source/web/SuspendableScriptExecutor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698