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

Side by Side Diff: mojo/edk/js/core.cc

Issue 728043002: Revert of Update mojo sdk to rev afb4440fd5a10cba980878c326180b7ad7960480 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « mojo/edk/js/core.h ('k') | mojo/edk/js/drain_data.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/edk/js/core.h" 5 #include "mojo/edk/js/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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } // namespace 240 } // namespace
241 241
242 const char Core::kModuleName[] = "mojo/public/js/core"; 242 const char Core::kModuleName[] = "mojo/public/js/core";
243 243
244 v8::Local<v8::Value> Core::GetModule(v8::Isolate* isolate) { 244 v8::Local<v8::Value> Core::GetModule(v8::Isolate* isolate) {
245 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); 245 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
246 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate( 246 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate(
247 &g_wrapper_info); 247 &g_wrapper_info);
248 248
249 if (templ.IsEmpty()) { 249 if (templ.IsEmpty()) {
250 templ = 250 templ = gin::ObjectTemplateBuilder(isolate)
251 gin::ObjectTemplateBuilder(isolate) 251 // TODO(mpcomplete): Should these just be methods on the JS Handle
252 // TODO(mpcomplete): Should these just be methods on the JS Handle 252 // object?
253 // object? 253 .SetMethod("close", CloseHandle)
254 .SetMethod("close", CloseHandle) 254 .SetMethod("wait", WaitHandle)
255 .SetMethod("wait", WaitHandle) 255 .SetMethod("waitMany", WaitMany)
256 .SetMethod("waitMany", WaitMany) 256 .SetMethod("createMessagePipe", CreateMessagePipe)
257 .SetMethod("createMessagePipe", CreateMessagePipe) 257 .SetMethod("writeMessage", WriteMessage)
258 .SetMethod("writeMessage", WriteMessage) 258 .SetMethod("readMessage", ReadMessage)
259 .SetMethod("readMessage", ReadMessage) 259 .SetMethod("createDataPipe", CreateDataPipe)
260 .SetMethod("createDataPipe", CreateDataPipe) 260 .SetMethod("writeData", WriteData)
261 .SetMethod("writeData", WriteData) 261 .SetMethod("readData", ReadData)
262 .SetMethod("readData", ReadData) 262 .SetMethod("drainData", DoDrainData)
263 .SetMethod("drainData", DoDrainData)
264 263
265 .SetValue("RESULT_OK", MOJO_RESULT_OK) 264 .SetValue("RESULT_OK", MOJO_RESULT_OK)
266 .SetValue("RESULT_CANCELLED", MOJO_RESULT_CANCELLED) 265 .SetValue("RESULT_CANCELLED", MOJO_RESULT_CANCELLED)
267 .SetValue("RESULT_UNKNOWN", MOJO_RESULT_UNKNOWN) 266 .SetValue("RESULT_UNKNOWN", MOJO_RESULT_UNKNOWN)
268 .SetValue("RESULT_INVALID_ARGUMENT", MOJO_RESULT_INVALID_ARGUMENT) 267 .SetValue("RESULT_INVALID_ARGUMENT", MOJO_RESULT_INVALID_ARGUMENT)
269 .SetValue("RESULT_DEADLINE_EXCEEDED", MOJO_RESULT_DEADLINE_EXCEEDED) 268 .SetValue("RESULT_DEADLINE_EXCEEDED", MOJO_RESULT_DEADLINE_EXCEEDED)
270 .SetValue("RESULT_NOT_FOUND", MOJO_RESULT_NOT_FOUND) 269 .SetValue("RESULT_NOT_FOUND", MOJO_RESULT_NOT_FOUND)
271 .SetValue("RESULT_ALREADY_EXISTS", MOJO_RESULT_ALREADY_EXISTS) 270 .SetValue("RESULT_ALREADY_EXISTS", MOJO_RESULT_ALREADY_EXISTS)
272 .SetValue("RESULT_PERMISSION_DENIED", MOJO_RESULT_PERMISSION_DENIED) 271 .SetValue("RESULT_PERMISSION_DENIED", MOJO_RESULT_PERMISSION_DENIED)
273 .SetValue("RESULT_RESOURCE_EXHAUSTED", 272 .SetValue("RESULT_RESOURCE_EXHAUSTED", MOJO_RESULT_RESOURCE_EXHAUSTED)
274 MOJO_RESULT_RESOURCE_EXHAUSTED) 273 .SetValue("RESULT_FAILED_PRECONDITION", MOJO_RESULT_FAILED_PRECONDITION)
275 .SetValue("RESULT_FAILED_PRECONDITION", 274 .SetValue("RESULT_ABORTED", MOJO_RESULT_ABORTED)
276 MOJO_RESULT_FAILED_PRECONDITION) 275 .SetValue("RESULT_OUT_OF_RANGE", MOJO_RESULT_OUT_OF_RANGE)
277 .SetValue("RESULT_ABORTED", MOJO_RESULT_ABORTED) 276 .SetValue("RESULT_UNIMPLEMENTED", MOJO_RESULT_UNIMPLEMENTED)
278 .SetValue("RESULT_OUT_OF_RANGE", MOJO_RESULT_OUT_OF_RANGE) 277 .SetValue("RESULT_INTERNAL", MOJO_RESULT_INTERNAL)
279 .SetValue("RESULT_UNIMPLEMENTED", MOJO_RESULT_UNIMPLEMENTED) 278 .SetValue("RESULT_UNAVAILABLE", MOJO_RESULT_UNAVAILABLE)
280 .SetValue("RESULT_INTERNAL", MOJO_RESULT_INTERNAL) 279 .SetValue("RESULT_DATA_LOSS", MOJO_RESULT_DATA_LOSS)
281 .SetValue("RESULT_UNAVAILABLE", MOJO_RESULT_UNAVAILABLE) 280 .SetValue("RESULT_BUSY", MOJO_RESULT_BUSY)
282 .SetValue("RESULT_DATA_LOSS", MOJO_RESULT_DATA_LOSS) 281 .SetValue("RESULT_SHOULD_WAIT", MOJO_RESULT_SHOULD_WAIT)
283 .SetValue("RESULT_BUSY", MOJO_RESULT_BUSY)
284 .SetValue("RESULT_SHOULD_WAIT", MOJO_RESULT_SHOULD_WAIT)
285 282
286 .SetValue("DEADLINE_INDEFINITE", MOJO_DEADLINE_INDEFINITE) 283 .SetValue("DEADLINE_INDEFINITE", MOJO_DEADLINE_INDEFINITE)
287 284
288 .SetValue("HANDLE_SIGNAL_NONE", MOJO_HANDLE_SIGNAL_NONE) 285 .SetValue("HANDLE_SIGNAL_NONE", MOJO_HANDLE_SIGNAL_NONE)
289 .SetValue("HANDLE_SIGNAL_READABLE", MOJO_HANDLE_SIGNAL_READABLE) 286 .SetValue("HANDLE_SIGNAL_READABLE", MOJO_HANDLE_SIGNAL_READABLE)
290 .SetValue("HANDLE_SIGNAL_WRITABLE", MOJO_HANDLE_SIGNAL_WRITABLE) 287 .SetValue("HANDLE_SIGNAL_WRITABLE", MOJO_HANDLE_SIGNAL_WRITABLE)
291 288
292 .SetValue("CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE", 289 .SetValue("CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE",
293 MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE) 290 MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE)
294 291
295 .SetValue("WRITE_MESSAGE_FLAG_NONE", MOJO_WRITE_MESSAGE_FLAG_NONE) 292 .SetValue("WRITE_MESSAGE_FLAG_NONE", MOJO_WRITE_MESSAGE_FLAG_NONE)
296 293
297 .SetValue("READ_MESSAGE_FLAG_NONE", MOJO_READ_MESSAGE_FLAG_NONE) 294 .SetValue("READ_MESSAGE_FLAG_NONE", MOJO_READ_MESSAGE_FLAG_NONE)
298 .SetValue("READ_MESSAGE_FLAG_MAY_DISCARD", 295 .SetValue("READ_MESSAGE_FLAG_MAY_DISCARD",
299 MOJO_READ_MESSAGE_FLAG_MAY_DISCARD) 296 MOJO_READ_MESSAGE_FLAG_MAY_DISCARD)
300 297
301 .SetValue("CREATE_DATA_PIPE_OPTIONS_FLAG_NONE", 298 .SetValue("CREATE_DATA_PIPE_OPTIONS_FLAG_NONE",
302 MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE) 299 MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE)
303 .SetValue("CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD", 300 .SetValue("CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD",
304 MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD) 301 MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD)
305 302
306 .SetValue("WRITE_DATA_FLAG_NONE", MOJO_WRITE_DATA_FLAG_NONE) 303 .SetValue("WRITE_DATA_FLAG_NONE", MOJO_WRITE_DATA_FLAG_NONE)
307 .SetValue("WRITE_DATA_FLAG_ALL_OR_NONE", 304 .SetValue("WRITE_DATA_FLAG_ALL_OR_NONE",
308 MOJO_WRITE_DATA_FLAG_ALL_OR_NONE) 305 MOJO_WRITE_DATA_FLAG_ALL_OR_NONE)
309 306
310 .SetValue("READ_DATA_FLAG_NONE", MOJO_READ_DATA_FLAG_NONE) 307 .SetValue("READ_DATA_FLAG_NONE", MOJO_READ_DATA_FLAG_NONE)
311 .SetValue("READ_DATA_FLAG_ALL_OR_NONE", 308 .SetValue("READ_DATA_FLAG_ALL_OR_NONE",
312 MOJO_READ_DATA_FLAG_ALL_OR_NONE) 309 MOJO_READ_DATA_FLAG_ALL_OR_NONE)
313 .SetValue("READ_DATA_FLAG_DISCARD", MOJO_READ_DATA_FLAG_DISCARD) 310 .SetValue("READ_DATA_FLAG_DISCARD", MOJO_READ_DATA_FLAG_DISCARD)
314 .SetValue("READ_DATA_FLAG_QUERY", MOJO_READ_DATA_FLAG_QUERY) 311 .SetValue("READ_DATA_FLAG_QUERY", MOJO_READ_DATA_FLAG_QUERY)
315 .SetValue("READ_DATA_FLAG_PEEK", MOJO_READ_DATA_FLAG_PEEK) 312 .Build();
316 .Build();
317 313
318 data->SetObjectTemplate(&g_wrapper_info, templ); 314 data->SetObjectTemplate(&g_wrapper_info, templ);
319 } 315 }
320 316
321 return templ->NewInstance(); 317 return templ->NewInstance();
322 } 318 }
323 319
324 } // namespace js 320 } // namespace js
325 } // namespace mojo 321 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/js/core.h ('k') | mojo/edk/js/drain_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698