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

Side by Side Diff: gin/runner.cc

Issue 59153005: Begin implementing V8 bindings for Mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix skipped comment 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
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 8
9 using v8::Context; 9 using v8::Context;
10 using v8::Function; 10 using v8::Function;
(...skipping 26 matching lines...) Expand all
37 void Runner::Run(Handle<Script> script) { 37 void Runner::Run(Handle<Script> script) {
38 script->Run(); 38 script->Run();
39 Handle<Function> main = GetMain(); 39 Handle<Function> main = GetMain();
40 if (main.IsEmpty()) 40 if (main.IsEmpty())
41 return; 41 return;
42 Handle<Value> argv[] = { delegate_->CreateRootObject(this) }; 42 Handle<Value> argv[] = { delegate_->CreateRootObject(this) };
43 main->Call(global(), 1, argv); 43 main->Call(global(), 1, argv);
44 } 44 }
45 45
46 v8::Handle<v8::Function> Runner::GetMain() { 46 v8::Handle<v8::Function> Runner::GetMain() {
47 Handle<Value> property = global()->Get(StringToV8(isolate_, "main")); 47 Handle<Value> property = global()->Get(StringToSymbol(isolate_, "main"));
48 if (property.IsEmpty()) 48 if (property.IsEmpty())
49 return v8::Handle<v8::Function>(); 49 return v8::Handle<v8::Function>();
50 Handle<Function> main; 50 Handle<Function> main;
51 if (!ConvertFromV8(property, &main)) 51 if (!ConvertFromV8(property, &main))
52 return v8::Handle<v8::Function>(); 52 return v8::Handle<v8::Function>();
53 return main; 53 return main;
54 } 54 }
55 55
56 Runner::Scope::Scope(Runner* runner) 56 Runner::Scope::Scope(Runner* runner)
57 : handle_scope_(runner->isolate_), 57 : handle_scope_(runner->isolate_),
58 scope_(Local<Context>::New(runner->isolate_, runner->context_)) { 58 scope_(Local<Context>::New(runner->isolate_, runner->context_)) {
59 } 59 }
60 60
61 Runner::Scope::~Scope() { 61 Runner::Scope::~Scope() {
62 } 62 }
63 63
64 } // namespace gin 64 } // namespace gin
OLDNEW
« gin/arguments.cc ('K') | « gin/per_isolate_data.cc ('k') | gin/test/gtest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698