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/public/bindings/js/support.h" | 5 #include "mojo/public/bindings/js/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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 const char Support::kModuleName[] = "mojo/public/bindings/js/support"; | 57 const char Support::kModuleName[] = "mojo/public/bindings/js/support"; |
58 | 58 |
59 v8::Local<v8::ObjectTemplate> Support::GetTemplate(v8::Isolate* isolate) { | 59 v8::Local<v8::ObjectTemplate> Support::GetTemplate(v8::Isolate* isolate) { |
60 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); | 60 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); |
61 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate( | 61 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate( |
62 &g_wrapper_info); | 62 &g_wrapper_info); |
63 | 63 |
64 if (templ.IsEmpty()) { | 64 if (templ.IsEmpty()) { |
65 WaitingCallback::EnsureRegistered(isolate); | 65 WaitingCallback::EnsureRegistered(isolate); |
66 | 66 |
67 templ = v8::ObjectTemplate::New(); | 67 templ = v8::ObjectTemplate::New(isolate); |
68 | 68 |
69 templ->Set(gin::StringToSymbol(isolate, "asyncWait"), | 69 templ->Set(gin::StringToSymbol(isolate, "asyncWait"), |
70 v8::FunctionTemplate::New(AsyncWait)); | 70 v8::FunctionTemplate::New(isolate, AsyncWait)); |
71 templ->Set(gin::StringToSymbol(isolate, "cancelWait"), | 71 templ->Set(gin::StringToSymbol(isolate, "cancelWait"), |
72 gin::CreateFunctionTemplate(isolate, base::Bind(CancelWait))); | 72 gin::CreateFunctionTemplate(isolate, base::Bind(CancelWait))); |
73 | 73 |
74 data->SetObjectTemplate(&g_wrapper_info, templ); | 74 data->SetObjectTemplate(&g_wrapper_info, templ); |
75 } | 75 } |
76 | 76 |
77 return templ; | 77 return templ; |
78 } | 78 } |
79 | 79 |
80 } // namespace js | 80 } // namespace js |
81 } // namespace mojo | 81 } // namespace mojo |
OLD | NEW |