OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/apps/js/bindings/support.h" | 5 #include "mojo/apps/js/bindings/support.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "gin/arguments.h" | 8 #include "gin/arguments.h" |
9 #include "gin/converter.h" | 9 #include "gin/converter.h" |
10 #include "gin/function_template.h" | 10 #include "gin/function_template.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 BindingsSupport::Get()->CancelWait(waiting_callback->wait_id()); | 41 BindingsSupport::Get()->CancelWait(waiting_callback->wait_id()); |
42 waiting_callback->set_wait_id(NULL); | 42 waiting_callback->set_wait_id(NULL); |
43 } | 43 } |
44 | 44 |
45 gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin }; | 45 gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin }; |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 const char Support::kModuleName[] = "mojo/apps/js/bindings/support"; | 49 const char Support::kModuleName[] = "mojo/apps/js/bindings/support"; |
50 | 50 |
51 v8::Local<v8::ObjectTemplate> Support::GetTemplate(v8::Isolate* isolate) { | 51 v8::Local<v8::Value> Support::GetModule(v8::Isolate* isolate) { |
52 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); | 52 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); |
53 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate( | 53 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate( |
54 &g_wrapper_info); | 54 &g_wrapper_info); |
55 | 55 |
56 if (templ.IsEmpty()) { | 56 if (templ.IsEmpty()) { |
57 templ = gin::ObjectTemplateBuilder(isolate) | 57 templ = gin::ObjectTemplateBuilder(isolate) |
58 .SetMethod("asyncWait", AsyncWait) | 58 .SetMethod("asyncWait", AsyncWait) |
59 .SetMethod("cancelWait", CancelWait) | 59 .SetMethod("cancelWait", CancelWait) |
60 .Build(); | 60 .Build(); |
61 | 61 |
62 data->SetObjectTemplate(&g_wrapper_info, templ); | 62 data->SetObjectTemplate(&g_wrapper_info, templ); |
63 } | 63 } |
64 | 64 |
65 return templ; | 65 return templ->NewInstance(); |
66 } | 66 } |
67 | 67 |
68 } // namespace js | 68 } // namespace js |
69 } // namespace mojo | 69 } // namespace mojo |
OLD | NEW |