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

Side by Side Diff: content/renderer/mojo_context_state.cc

Issue 2642873002: Moves mojo.define -> gin.define. (Closed)
Patch Set: rebaseline Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_context_state.h" 5 #include "content/renderer/mojo_context_state.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 module_prefix_(GetModulePrefixForBindingsType(bindings_type, frame)) { 115 module_prefix_(GetModulePrefixForBindingsType(bindings_type, frame)) {
116 gin::PerContextData* context_data = gin::PerContextData::From(context); 116 gin::PerContextData* context_data = gin::PerContextData::From(context);
117 gin::ContextHolder* context_holder = context_data->context_holder(); 117 gin::ContextHolder* context_holder = context_data->context_holder();
118 runner_.reset(new MojoMainRunner(frame_, context_holder)); 118 runner_.reset(new MojoMainRunner(frame_, context_holder));
119 gin::Runner::Scope scoper(runner_.get()); 119 gin::Runner::Scope scoper(runner_.get());
120 gin::ModuleRegistry::From(context)->AddObserver(this); 120 gin::ModuleRegistry::From(context)->AddObserver(this);
121 content::RenderFrame::FromWebFrame(frame) 121 content::RenderFrame::FromWebFrame(frame)
122 ->EnsureMojoBuiltinsAreAvailable(context_holder->isolate(), context); 122 ->EnsureMojoBuiltinsAreAvailable(context_holder->isolate(), context);
123 v8::Local<v8::Object> install_target; 123 v8::Local<v8::Object> install_target;
124 if (bindings_type == MojoBindingsType::FOR_LAYOUT_TESTS) { 124 if (bindings_type == MojoBindingsType::FOR_LAYOUT_TESTS) {
125 // In layout tests we install the module system under 'mojo.define' 125 // In layout tests we install the module system under 'gin.define'
126 // for now to avoid globally exposing something as generic as 'define'. 126 // for now to avoid globally exposing something as generic as 'define'.
127 // 127 //
128 // TODO(rockot): Remove this if/when we can integrate gin + ES6 modules. 128 // TODO(rockot): Remove this if/when we can integrate gin + ES6 modules.
129 install_target = v8::Object::New(context->GetIsolate()); 129 install_target = v8::Object::New(context->GetIsolate());
130 gin::SetProperty(context->GetIsolate(), context->Global(), 130 gin::SetProperty(context->GetIsolate(), context->Global(),
131 gin::StringToSymbol(context->GetIsolate(), "mojo"), 131 gin::StringToSymbol(context->GetIsolate(), "gin"),
132 install_target); 132 install_target);
133 } else { 133 } else {
134 // Otherwise we're fine installing a global 'define'. 134 // Otherwise we're fine installing a global 'define'.
135 install_target = context->Global(); 135 install_target = context->Global();
136 } 136 }
137 gin::ModuleRegistry::InstallGlobals(context->GetIsolate(), install_target); 137 gin::ModuleRegistry::InstallGlobals(context->GetIsolate(), install_target);
138 // Warning |frame| may be destroyed. 138 // Warning |frame| may be destroyed.
139 // TODO(sky): add test for this. 139 // TODO(sky): add test for this.
140 } 140 }
141 141
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 const std::vector<std::string>& dependencies) { 213 const std::vector<std::string>& dependencies) {
214 FetchModules(dependencies); 214 FetchModules(dependencies);
215 215
216 gin::ContextHolder* context_holder = runner_->GetContextHolder(); 216 gin::ContextHolder* context_holder = runner_->GetContextHolder();
217 gin::ModuleRegistry* registry = gin::ModuleRegistry::From( 217 gin::ModuleRegistry* registry = gin::ModuleRegistry::From(
218 context_holder->context()); 218 context_holder->context());
219 registry->AttemptToLoadMoreModules(context_holder->isolate()); 219 registry->AttemptToLoadMoreModules(context_holder->isolate());
220 } 220 }
221 221
222 } // namespace content 222 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698