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

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

Issue 69843003: Implement Mojo message codec in JavaScript (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Aaron's comments Created 7 years, 1 month 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/public/bindings/js/core.h ('k') | mojo/public/bindings/js/core_unittests.js » ('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/public/bindings/js/core.h" 5 #include "mojo/public/bindings/js/core.h"
6 6
7 #include "gin/arguments.h" 7 #include "gin/arguments.h"
8 #include "gin/array_buffer.h" 8 #include "gin/array_buffer.h"
9 #include "gin/converter.h" 9 #include "gin/converter.h"
10 #include "gin/dictionary.h" 10 #include "gin/dictionary.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // allocate all this memory on each read. 124 // allocate all this memory on each read.
125 gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(info.GetIsolate()); 125 gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(info.GetIsolate());
126 dictionary.Set("result", result); 126 dictionary.Set("result", result);
127 dictionary.Set("bytesRead", num_bytes); 127 dictionary.Set("bytesRead", num_bytes);
128 dictionary.Set("handles", handles); 128 dictionary.Set("handles", handles);
129 args.Return(dictionary); 129 args.Return(dictionary);
130 } 130 }
131 131
132 gin::WrapperInfo g_core_wrapper_info = {}; 132 gin::WrapperInfo g_core_wrapper_info = {};
133 133
134 } 134 } // namespace
135 135
136 v8::Local<v8::ObjectTemplate> GetCoreTemplate(v8::Isolate* isolate) { 136 const char Core::kModuleName[] = "mojo/public/bindings/js/core";
137
138 v8::Local<v8::ObjectTemplate> Core::GetTemplate(v8::Isolate* isolate) {
137 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); 139 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
138 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate( 140 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate(
139 &g_core_wrapper_info); 141 &g_core_wrapper_info);
140 142
141 if (templ.IsEmpty()) { 143 if (templ.IsEmpty()) {
142 templ = v8::ObjectTemplate::New(); 144 templ = v8::ObjectTemplate::New();
143 145
144 templ->Set(gin::StringToSymbol(isolate, "close"), 146 templ->Set(gin::StringToSymbol(isolate, "close"),
145 v8::FunctionTemplate::New(Close)); 147 v8::FunctionTemplate::New(Close));
146 templ->Set(gin::StringToSymbol(isolate, "wait"), 148 templ->Set(gin::StringToSymbol(isolate, "wait"),
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 gin::ConvertToV8(isolate, MOJO_READ_MESSAGE_FLAG_MAY_DISCARD)); 210 gin::ConvertToV8(isolate, MOJO_READ_MESSAGE_FLAG_MAY_DISCARD));
209 211
210 data->SetObjectTemplate(&g_core_wrapper_info, templ); 212 data->SetObjectTemplate(&g_core_wrapper_info, templ);
211 } 213 }
212 214
213 return templ; 215 return templ;
214 } 216 }
215 217
216 } // namespace js 218 } // namespace js
217 } // namespace mojo 219 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/bindings/js/core.h ('k') | mojo/public/bindings/js/core_unittests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698