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/mojo.h" | |
6 | |
7 #include "gin/converter.h" | |
8 #include "gin/per_isolate_data.h" | |
9 #include "gin/wrapper_info.h" | |
10 #include "mojo/public/bindings/js/core.h" | |
11 | |
12 namespace mojo { | |
13 namespace js { | |
14 | |
15 namespace { | |
16 | |
17 gin::WrapperInfo g_mojo_wrapper_info = {}; | |
18 | |
19 } | |
20 | |
21 v8::Local<v8::ObjectTemplate> GetMojoTemplate(v8::Isolate* isolate) { | |
22 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); | |
23 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate( | |
24 &g_mojo_wrapper_info); | |
25 if (templ.IsEmpty()) { | |
26 templ = v8::ObjectTemplate::New(); | |
27 templ->Set(gin::StringToSymbol(isolate, "core"), GetCoreTemplate(isolate)); | |
28 data->SetObjectTemplate(&g_mojo_wrapper_info, templ); | |
29 } | |
30 return templ; | |
31 } | |
32 | |
33 } // namespace js | |
34 } // namespace mojo | |
OLD | NEW |