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 28 matching lines...) Expand all Loading... |
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<MojoWaitFlags>& flags, |
42 MojoDeadline deadline) { | 42 MojoDeadline deadline) { |
43 return mojo::WaitMany(handles, flags, deadline); | 43 return mojo::WaitMany(handles, flags, 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 MojoResult result = MojoCreateMessagePipe(&handle0, &handle1); | 49 // TODO(vtl): Add support for the options struct. |
| 50 MojoResult result = MojoCreateMessagePipe(NULL, &handle0, &handle1); |
50 CHECK(result == MOJO_RESULT_OK); | 51 CHECK(result == MOJO_RESULT_OK); |
51 | 52 |
52 gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(args.isolate()); | 53 gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(args.isolate()); |
53 dictionary.Set("handle0", mojo::Handle(handle0)); | 54 dictionary.Set("handle0", mojo::Handle(handle0)); |
54 dictionary.Set("handle1", mojo::Handle(handle1)); | 55 dictionary.Set("handle1", mojo::Handle(handle1)); |
55 return dictionary; | 56 return dictionary; |
56 } | 57 } |
57 | 58 |
58 MojoResult WriteMessage( | 59 MojoResult WriteMessage( |
59 mojo::Handle handle, | 60 mojo::Handle handle, |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 .Build(); | 270 .Build(); |
270 | 271 |
271 data->SetObjectTemplate(&g_wrapper_info, templ); | 272 data->SetObjectTemplate(&g_wrapper_info, templ); |
272 } | 273 } |
273 | 274 |
274 return templ->NewInstance(); | 275 return templ->NewInstance(); |
275 } | 276 } |
276 | 277 |
277 } // namespace js | 278 } // namespace js |
278 } // namespace mojo | 279 } // namespace mojo |
OLD | NEW |