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

Unified Diff: gin/shell_runner.cc

Issue 1161053002: Revert of gin: Use V8 Maybe APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@maybe-gin-converter
Patch Set: 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
« no previous file with comments | « gin/shell/gin_main.cc ('k') | gin/test/file.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/shell_runner.cc
diff --git a/gin/shell_runner.cc b/gin/shell_runner.cc
index 0e534e4af027ca1cacb0e950ee0d6167dae5253e..eccee9f69ca355f47255e1f25d2c3973f496a0af 100644
--- a/gin/shell_runner.cc
+++ b/gin/shell_runner.cc
@@ -65,13 +65,11 @@
void ShellRunner::Run(const std::string& source,
const std::string& resource_name) {
+ TryCatch try_catch;
v8::Isolate* isolate = GetContextHolder()->isolate();
- TryCatch try_catch(isolate);
- v8::ScriptOrigin origin(StringToV8(isolate, resource_name));
- auto maybe_script = Script::Compile(GetContextHolder()->context(),
- StringToV8(isolate, source), &origin);
- v8::Local<Script> script;
- if (!maybe_script.ToLocal(&script)) {
+ v8::Local<Script> script = Script::Compile(
+ StringToV8(isolate, source), StringToV8(isolate, resource_name));
+ if (try_catch.HasCaught()) {
delegate_->UnhandledException(this, try_catch);
return;
}
@@ -83,15 +81,13 @@
v8::Local<v8::Value> receiver,
int argc,
v8::Local<v8::Value> argv[]) {
- TryCatch try_catch(GetContextHolder()->isolate());
+ TryCatch try_catch;
delegate_->WillRunScript(this);
- auto maybe_result =
- function->Call(GetContextHolder()->context(), receiver, argc, argv);
+ v8::Local<v8::Value> result = function->Call(receiver, argc, argv);
delegate_->DidRunScript(this);
- v8::Local<v8::Value> result;
- if (!maybe_result.ToLocal(&result))
+ if (try_catch.HasCaught())
delegate_->UnhandledException(this, try_catch);
return result;
@@ -102,14 +98,13 @@
}
void ShellRunner::Run(v8::Local<Script> script) {
- TryCatch try_catch(GetContextHolder()->isolate());
+ TryCatch try_catch;
delegate_->WillRunScript(this);
- auto maybe = script->Run(GetContextHolder()->context());
+ script->Run();
delegate_->DidRunScript(this);
- v8::Local<v8::Value> result;
- if (!maybe.ToLocal(&result)) {
+ if (try_catch.HasCaught()) {
delegate_->UnhandledException(this, try_catch);
}
}
« no previous file with comments | « gin/shell/gin_main.cc ('k') | gin/test/file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698