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

Side by Side Diff: gin/runner.cc

Issue 68323004: Port Mojo's sample_service.cc to JavaScript (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/public/bindings/js/codec.js » ('j') | mojo/public/bindings/js/codec.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gin/runner.h" 5 #include "gin/runner.h"
6 6
7 #include "gin/converter.h" 7 #include "gin/converter.h"
8 #include "gin/try_catch.h" 8 #include "gin/try_catch.h"
9 9
10 using v8::Context; 10 using v8::Context;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } 50 }
51 51
52 Runner::~Runner() { 52 Runner::~Runner() {
53 } 53 }
54 54
55 void Runner::Run(const std::string& script) { 55 void Runner::Run(const std::string& script) {
56 Run(Script::New(StringToV8(isolate(), script))); 56 Run(Script::New(StringToV8(isolate(), script)));
57 } 57 }
58 58
59 void Runner::Run(v8::Handle<Script> script) { 59 void Runner::Run(v8::Handle<Script> script) {
60 TryCatch try_catch;
60 delegate_->WillRunScript(this, script); 61 delegate_->WillRunScript(this, script);
61 { 62 script->Run();
62 TryCatch try_catch;
63 script->Run();
64 if (try_catch.HasCaught())
65 delegate_->UnhandledException(this, try_catch);
66 }
67 delegate_->DidRunScript(this, script); 63 delegate_->DidRunScript(this, script);
64 if (try_catch.HasCaught())
65 delegate_->UnhandledException(this, try_catch);
68 } 66 }
69 67
70 Runner::Scope::Scope(Runner* runner) 68 Runner::Scope::Scope(Runner* runner)
71 : handle_scope_(runner->isolate()), 69 : handle_scope_(runner->isolate()),
72 scope_(runner->context()) { 70 scope_(runner->context()) {
73 } 71 }
74 72
75 Runner::Scope::~Scope() { 73 Runner::Scope::~Scope() {
76 } 74 }
77 75
78 } // namespace gin 76 } // namespace gin
OLDNEW
« no previous file with comments | « no previous file | mojo/public/bindings/js/codec.js » ('j') | mojo/public/bindings/js/codec.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698