OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/mojo_main_runner.h" | 5 #include "content/renderer/mojo_main_runner.h" |
6 | 6 |
7 #include "content/public/renderer/render_frame.h" | 7 #include "content/public/renderer/render_frame.h" |
8 #include "gin/modules/module_registry.h" | 8 #include "gin/modules/module_registry.h" |
9 #include "gin/per_context_data.h" | 9 #include "gin/per_context_data.h" |
10 #include "gin/public/context_holder.h" | 10 #include "gin/public/context_holder.h" |
11 #include "third_party/WebKit/public/web/WebFrame.h" | 11 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
12 #include "third_party/WebKit/public/web/WebScriptSource.h" | 12 #include "third_party/WebKit/public/web/WebScriptSource.h" |
13 | 13 |
14 using v8::Context; | 14 using v8::Context; |
15 using v8::HandleScope; | 15 using v8::HandleScope; |
16 using v8::Isolate; | 16 using v8::Isolate; |
17 using v8::Object; | 17 using v8::Object; |
18 using v8::ObjectTemplate; | 18 using v8::ObjectTemplate; |
19 using v8::Script; | 19 using v8::Script; |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 MojoMainRunner::MojoMainRunner(blink::WebFrame* frame, | 23 MojoMainRunner::MojoMainRunner(blink::WebLocalFrame* frame, |
24 gin::ContextHolder* context_holder) | 24 gin::ContextHolder* context_holder) |
25 : frame_(frame), | 25 : frame_(frame), context_holder_(context_holder) { |
26 context_holder_(context_holder) { | |
27 DCHECK(frame_); | 26 DCHECK(frame_); |
28 v8::Isolate::Scope isolate_scope(context_holder->isolate()); | 27 v8::Isolate::Scope isolate_scope(context_holder->isolate()); |
29 HandleScope handle_scope(context_holder->isolate()); | 28 HandleScope handle_scope(context_holder->isolate()); |
30 // Note: this installs the runner globally. If we need to support more than | 29 // Note: this installs the runner globally. If we need to support more than |
31 // one runner at a time we'll have to revisit this. | 30 // one runner at a time we'll have to revisit this. |
32 gin::PerContextData::From(context_holder->context())->set_runner(this); | 31 gin::PerContextData::From(context_holder->context())->set_runner(this); |
33 } | 32 } |
34 | 33 |
35 MojoMainRunner::~MojoMainRunner() { | 34 MojoMainRunner::~MojoMainRunner() { |
36 } | 35 } |
(...skipping 10 matching lines...) Expand all Loading... |
47 v8::Local<v8::Value> argv[]) { | 46 v8::Local<v8::Value> argv[]) { |
48 return frame_->CallFunctionEvenIfScriptDisabled(function, receiver, argc, | 47 return frame_->CallFunctionEvenIfScriptDisabled(function, receiver, argc, |
49 argv); | 48 argv); |
50 } | 49 } |
51 | 50 |
52 gin::ContextHolder* MojoMainRunner::GetContextHolder() { | 51 gin::ContextHolder* MojoMainRunner::GetContextHolder() { |
53 return context_holder_; | 52 return context_holder_; |
54 } | 53 } |
55 | 54 |
56 } // namespace content | 55 } // namespace content |
OLD | NEW |