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

Side by Side Diff: mojo/apps/js/bindings/core.cc

Issue 120043008: Add a simple one shot and repeating timer API for Mojo.js. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win build Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « mojo/apps/js/bindings/core.h ('k') | mojo/apps/js/bindings/gl/module.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 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/core.h" 5 #include "mojo/apps/js/bindings/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"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 dictionary.Set("handles", handles); 81 dictionary.Set("handles", handles);
82 return dictionary; 82 return dictionary;
83 } 83 }
84 84
85 gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin }; 85 gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin };
86 86
87 } // namespace 87 } // namespace
88 88
89 const char Core::kModuleName[] = "mojo/apps/js/bindings/core"; 89 const char Core::kModuleName[] = "mojo/apps/js/bindings/core";
90 90
91 v8::Local<v8::ObjectTemplate> Core::GetTemplate(v8::Isolate* isolate) { 91 v8::Local<v8::Value> Core::GetModule(v8::Isolate* isolate) {
92 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); 92 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
93 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate( 93 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate(
94 &g_wrapper_info); 94 &g_wrapper_info);
95 95
96 if (templ.IsEmpty()) { 96 if (templ.IsEmpty()) {
97 templ = gin::ObjectTemplateBuilder(isolate) 97 templ = gin::ObjectTemplateBuilder(isolate)
98 .SetMethod("close", mojo::CloseRaw) 98 .SetMethod("close", mojo::CloseRaw)
99 .SetMethod("wait", mojo::Wait) 99 .SetMethod("wait", mojo::Wait)
100 .SetMethod("waitMany", mojo::WaitMany<std::vector<mojo::Handle>, 100 .SetMethod("waitMany", mojo::WaitMany<std::vector<mojo::Handle>,
101 std::vector<MojoWaitFlags> >) 101 std::vector<MojoWaitFlags> >)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 .SetValue("WRITE_MESSAGE_FLAG_NONE", MOJO_WRITE_MESSAGE_FLAG_NONE) 134 .SetValue("WRITE_MESSAGE_FLAG_NONE", MOJO_WRITE_MESSAGE_FLAG_NONE)
135 135
136 .SetValue("READ_MESSAGE_FLAG_NONE", MOJO_READ_MESSAGE_FLAG_NONE) 136 .SetValue("READ_MESSAGE_FLAG_NONE", MOJO_READ_MESSAGE_FLAG_NONE)
137 .SetValue("READ_MESSAGE_FLAG_MAY_DISCARD", 137 .SetValue("READ_MESSAGE_FLAG_MAY_DISCARD",
138 MOJO_READ_MESSAGE_FLAG_MAY_DISCARD) 138 MOJO_READ_MESSAGE_FLAG_MAY_DISCARD)
139 .Build(); 139 .Build();
140 140
141 data->SetObjectTemplate(&g_wrapper_info, templ); 141 data->SetObjectTemplate(&g_wrapper_info, templ);
142 } 142 }
143 143
144 return templ; 144 return templ->NewInstance();
145 } 145 }
146 146
147 } // namespace js 147 } // namespace js
148 } // namespace mojo 148 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/apps/js/bindings/core.h ('k') | mojo/apps/js/bindings/gl/module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698