OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "mojo/public/bindings/js/global.h" | |
6 | |
7 #include "gin/modules/module_registry.h" | |
8 #include "gin/per_isolate_data.h" | |
9 #include "gin/wrapper_info.h" | |
10 | |
11 namespace mojo { | |
12 namespace js { | |
13 | |
14 namespace { | |
15 | |
16 gin::WrapperInfo g_wrapper_info = {}; | |
17 | |
18 } | |
19 | |
20 v8::Local<v8::ObjectTemplate> GetGlobalTemplate(v8::Isolate* isolate) { | |
21 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); | |
22 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate( | |
23 &g_wrapper_info); | |
24 if (templ.IsEmpty()) { | |
25 templ = v8::ObjectTemplate::New(); | |
26 gin::ModuleRegistry::RegisterGlobals(isolate, templ); | |
27 data->SetObjectTemplate(&g_wrapper_info, templ); | |
28 } | |
29 return templ; | |
30 } | |
31 | |
32 } // namespace js | |
33 } // namespace mojo | |
OLD | NEW |