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

Side by Side Diff: mojo/system/entrypoints.cc

Issue 454603002: Mojo: Plumb new Wait/WaitMany API out to Core. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 4 months 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/system/core_unittest.cc ('k') | mojo/system/memory.cc » ('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/system/entrypoints.h" 5 #include "mojo/system/entrypoints.h"
6 6
7 #include "base/logging.h"
7 #include "mojo/public/c/system/buffer.h" 8 #include "mojo/public/c/system/buffer.h"
8 #include "mojo/public/c/system/data_pipe.h" 9 #include "mojo/public/c/system/data_pipe.h"
9 #include "mojo/public/c/system/functions.h" 10 #include "mojo/public/c/system/functions.h"
10 #include "mojo/public/c/system/message_pipe.h" 11 #include "mojo/public/c/system/message_pipe.h"
11 #include "mojo/system/core.h" 12 #include "mojo/system/core.h"
12 13
13 static mojo::system::Core* g_core = NULL; 14 static mojo::system::Core* g_core = NULL;
14 15
15 using mojo::system::MakeUserPointer; 16 using mojo::system::MakeUserPointer;
16 17
(...skipping 19 matching lines...) Expand all
36 return g_core->GetTimeTicksNow(); 37 return g_core->GetTimeTicksNow();
37 } 38 }
38 39
39 MojoResult MojoClose(MojoHandle handle) { 40 MojoResult MojoClose(MojoHandle handle) {
40 return g_core->Close(handle); 41 return g_core->Close(handle);
41 } 42 }
42 43
43 MojoResult MojoWait(MojoHandle handle, 44 MojoResult MojoWait(MojoHandle handle,
44 MojoHandleSignals signals, 45 MojoHandleSignals signals,
45 MojoDeadline deadline) { 46 MojoDeadline deadline) {
46 return g_core->Wait(handle, signals, deadline); 47 return g_core->Wait(
48 handle, signals, deadline, mojo::system::NullUserPointer());
47 } 49 }
48 50
49 MojoResult MojoWaitMany(const MojoHandle* handles, 51 MojoResult MojoWaitMany(const MojoHandle* handles,
50 const MojoHandleSignals* signals, 52 const MojoHandleSignals* signals,
51 uint32_t num_handles, 53 uint32_t num_handles,
52 MojoDeadline deadline) { 54 MojoDeadline deadline) {
53 return g_core->WaitMany(MakeUserPointer(handles), 55 uint32_t result_index = static_cast<uint32_t>(-1);
54 MakeUserPointer(signals), 56 MojoResult result = g_core->WaitMany(MakeUserPointer(handles),
55 num_handles, 57 MakeUserPointer(signals),
56 deadline); 58 num_handles,
59 deadline,
60 MakeUserPointer(&result_index),
61 mojo::system::NullUserPointer());
62 return (result == MOJO_RESULT_OK) ? static_cast<MojoResult>(result_index)
63 : result;
57 } 64 }
58 65
59 MojoResult MojoCreateMessagePipe(const MojoCreateMessagePipeOptions* options, 66 MojoResult MojoCreateMessagePipe(const MojoCreateMessagePipeOptions* options,
60 MojoHandle* message_pipe_handle0, 67 MojoHandle* message_pipe_handle0,
61 MojoHandle* message_pipe_handle1) { 68 MojoHandle* message_pipe_handle1) {
62 return g_core->CreateMessagePipe(MakeUserPointer(options), 69 return g_core->CreateMessagePipe(MakeUserPointer(options),
63 MakeUserPointer(message_pipe_handle0), 70 MakeUserPointer(message_pipe_handle0),
64 MakeUserPointer(message_pipe_handle1)); 71 MakeUserPointer(message_pipe_handle1));
65 } 72 }
66 73
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 MojoMapBufferFlags flags) { 182 MojoMapBufferFlags flags) {
176 return g_core->MapBuffer( 183 return g_core->MapBuffer(
177 buffer_handle, offset, num_bytes, MakeUserPointer(buffer), flags); 184 buffer_handle, offset, num_bytes, MakeUserPointer(buffer), flags);
178 } 185 }
179 186
180 MojoResult MojoUnmapBuffer(void* buffer) { 187 MojoResult MojoUnmapBuffer(void* buffer) {
181 return g_core->UnmapBuffer(MakeUserPointer(buffer)); 188 return g_core->UnmapBuffer(MakeUserPointer(buffer));
182 } 189 }
183 190
184 } // extern "C" 191 } // extern "C"
OLDNEW
« no previous file with comments | « mojo/system/core_unittest.cc ('k') | mojo/system/memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698