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

Side by Side Diff: mojo/edk/js/core.cc

Issue 703273002: Update mojo sdk to rev 04a510fb37db10642e156957f9b2c11c2f6442ac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix content/child -> mojo/common linking Created 6 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
« no previous file with comments | « mojo/edk/js/core.h ('k') | mojo/edk/js/drain_data.h » ('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 "mojo/bindings/js/core.h" 5 #include "mojo/edk/js/core.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "gin/arguments.h" 9 #include "gin/arguments.h"
10 #include "gin/array_buffer.h" 10 #include "gin/array_buffer.h"
11 #include "gin/converter.h" 11 #include "gin/converter.h"
12 #include "gin/dictionary.h" 12 #include "gin/dictionary.h"
13 #include "gin/function_template.h" 13 #include "gin/function_template.h"
14 #include "gin/handle.h" 14 #include "gin/handle.h"
15 #include "gin/object_template_builder.h" 15 #include "gin/object_template_builder.h"
16 #include "gin/per_isolate_data.h" 16 #include "gin/per_isolate_data.h"
17 #include "gin/public/wrapper_info.h" 17 #include "gin/public/wrapper_info.h"
18 #include "gin/wrappable.h" 18 #include "gin/wrappable.h"
19 #include "mojo/bindings/js/drain_data.h" 19 #include "mojo/edk/js/drain_data.h"
20 #include "mojo/bindings/js/handle.h" 20 #include "mojo/edk/js/handle.h"
21 21
22 namespace mojo { 22 namespace mojo {
23 namespace js { 23 namespace js {
24 24
25 namespace { 25 namespace {
26 26
27 MojoResult CloseHandle(gin::Handle<HandleWrapper> handle) { 27 MojoResult CloseHandle(gin::Handle<HandleWrapper> handle) {
28 if (!handle->get().is_valid()) 28 if (!handle->get().is_valid())
29 return MOJO_RESULT_INVALID_ARGUMENT; 29 return MOJO_RESULT_INVALID_ARGUMENT;
30 handle->Close(); 30 handle->Close();
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 v8::Handle<v8::Value> DoDrainData(gin::Arguments* args, 233 v8::Handle<v8::Value> DoDrainData(gin::Arguments* args,
234 gin::Handle<HandleWrapper> handle) { 234 gin::Handle<HandleWrapper> handle) {
235 return (new DrainData(args->isolate(), handle->release()))->GetPromise(); 235 return (new DrainData(args->isolate(), handle->release()))->GetPromise();
236 } 236 }
237 237
238 gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin }; 238 gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin };
239 239
240 } // namespace 240 } // namespace
241 241
242 const char Core::kModuleName[] = "mojo/public/js/bindings/core"; 242 const char Core::kModuleName[] = "mojo/public/js/core";
243 243
244 v8::Local<v8::Value> Core::GetModule(v8::Isolate* isolate) { 244 v8::Local<v8::Value> Core::GetModule(v8::Isolate* isolate) {
245 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); 245 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
246 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate( 246 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate(
247 &g_wrapper_info); 247 &g_wrapper_info);
248 248
249 if (templ.IsEmpty()) { 249 if (templ.IsEmpty()) {
250 templ = gin::ObjectTemplateBuilder(isolate) 250 templ = gin::ObjectTemplateBuilder(isolate)
251 // TODO(mpcomplete): Should these just be methods on the JS Handle 251 // TODO(mpcomplete): Should these just be methods on the JS Handle
252 // object? 252 // object?
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 .Build(); 312 .Build();
313 313
314 data->SetObjectTemplate(&g_wrapper_info, templ); 314 data->SetObjectTemplate(&g_wrapper_info, templ);
315 } 315 }
316 316
317 return templ->NewInstance(); 317 return templ->NewInstance();
318 } 318 }
319 319
320 } // namespace js 320 } // namespace js
321 } // namespace mojo 321 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/js/core.h ('k') | mojo/edk/js/drain_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698