OLD | NEW |
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 Loading... |
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 |
OLD | NEW |