OLD | NEW |
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/bindings/js/core.h" | 5 #include "mojo/bindings/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 13 matching lines...) Expand all Loading... |
24 namespace { | 24 namespace { |
25 | 25 |
26 MojoResult CloseHandle(gin::Handle<gin::HandleWrapper> handle) { | 26 MojoResult CloseHandle(gin::Handle<gin::HandleWrapper> handle) { |
27 if (!handle->get().is_valid()) | 27 if (!handle->get().is_valid()) |
28 return MOJO_RESULT_INVALID_ARGUMENT; | 28 return MOJO_RESULT_INVALID_ARGUMENT; |
29 handle->Close(); | 29 handle->Close(); |
30 return MOJO_RESULT_OK; | 30 return MOJO_RESULT_OK; |
31 } | 31 } |
32 | 32 |
33 MojoResult WaitHandle(mojo::Handle handle, | 33 MojoResult WaitHandle(mojo::Handle handle, |
34 MojoWaitFlags flags, | 34 MojoHandleSignals signals, |
35 MojoDeadline deadline) { | 35 MojoDeadline deadline) { |
36 return MojoWait(handle.value(), flags, deadline); | 36 return MojoWait(handle.value(), signals, deadline); |
37 } | 37 } |
38 | 38 |
39 MojoResult WaitMany( | 39 MojoResult WaitMany( |
40 const std::vector<mojo::Handle>& handles, | 40 const std::vector<mojo::Handle>& handles, |
41 const std::vector<MojoWaitFlags>& flags, | 41 const std::vector<MojoHandleSignals>& signals, |
42 MojoDeadline deadline) { | 42 MojoDeadline deadline) { |
43 return mojo::WaitMany(handles, flags, deadline); | 43 return mojo::WaitMany(handles, signals, deadline); |
44 } | 44 } |
45 | 45 |
46 gin::Dictionary CreateMessagePipe(const gin::Arguments& args) { | 46 gin::Dictionary CreateMessagePipe(const gin::Arguments& args) { |
47 MojoHandle handle0 = MOJO_HANDLE_INVALID; | 47 MojoHandle handle0 = MOJO_HANDLE_INVALID; |
48 MojoHandle handle1 = MOJO_HANDLE_INVALID; | 48 MojoHandle handle1 = MOJO_HANDLE_INVALID; |
49 // TODO(vtl): Add support for the options struct. | 49 // TODO(vtl): Add support for the options struct. |
50 MojoResult result = MojoCreateMessagePipe(NULL, &handle0, &handle1); | 50 MojoResult result = MojoCreateMessagePipe(NULL, &handle0, &handle1); |
51 CHECK(result == MOJO_RESULT_OK); | 51 CHECK(result == MOJO_RESULT_OK); |
52 | 52 |
53 gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(args.isolate()); | 53 gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(args.isolate()); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 .Build(); | 270 .Build(); |
271 | 271 |
272 data->SetObjectTemplate(&g_wrapper_info, templ); | 272 data->SetObjectTemplate(&g_wrapper_info, templ); |
273 } | 273 } |
274 | 274 |
275 return templ->NewInstance(); | 275 return templ->NewInstance(); |
276 } | 276 } |
277 | 277 |
278 } // namespace js | 278 } // namespace js |
279 } // namespace mojo | 279 } // namespace mojo |
OLD | NEW |