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

Side by Side Diff: mojo/edk/embedder/entrypoints.cc

Issue 830593003: Update mojo sdk to rev 9fbbc4f0fef1187312316c0ed992342474e139f1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cherry-pick mojo 9d3b8dd17f12d20035a14737fdc38dd926890ff8 Created 5 years, 11 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
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/embedder/embedder_internal.h" 5 #include "mojo/edk/embedder/embedder_internal.h"
6 #include "mojo/edk/system/core.h" 6 #include "mojo/edk/system/core.h"
7 #include "mojo/public/c/system/buffer.h" 7 #include "mojo/public/c/system/buffer.h"
8 #include "mojo/public/c/system/data_pipe.h" 8 #include "mojo/public/c/system/data_pipe.h"
9 #include "mojo/public/c/system/functions.h" 9 #include "mojo/public/c/system/functions.h"
10 #include "mojo/public/c/system/message_pipe.h" 10 #include "mojo/public/c/system/message_pipe.h"
11 11
12 using mojo::embedder::internal::g_core; 12 using mojo::embedder::internal::g_core;
13 using mojo::system::MakeUserPointer; 13 using mojo::system::MakeUserPointer;
14 14
15 // Definitions of the system functions. 15 // Definitions of the system functions.
16 extern "C" { 16 extern "C" {
17 MojoTimeTicks MojoGetTimeTicksNow() { 17 MojoTimeTicks MojoGetTimeTicksNow() {
18 return g_core->GetTimeTicksNow(); 18 return g_core->GetTimeTicksNow();
19 } 19 }
20 20
21 MojoResult MojoClose(MojoHandle handle) { 21 MojoResult MojoClose(MojoHandle handle) {
22 return g_core->Close(handle); 22 return g_core->Close(handle);
23 } 23 }
24 24
25 MojoResult MojoWait(MojoHandle handle, 25 MojoResult MojoWait(MojoHandle handle,
26 MojoHandleSignals signals,
27 MojoDeadline deadline) {
28 return g_core->Wait(handle, signals, deadline,
29 mojo::system::NullUserPointer());
30 }
31
32 MojoResult MojoWaitMany(const MojoHandle* handles,
33 const MojoHandleSignals* signals,
34 uint32_t num_handles,
35 MojoDeadline deadline) {
36 uint32_t result_index = static_cast<uint32_t>(-1);
37 MojoResult result = g_core->WaitMany(
38 MakeUserPointer(handles), MakeUserPointer(signals), num_handles, deadline,
39 MakeUserPointer(&result_index), mojo::system::NullUserPointer());
40 return (result == MOJO_RESULT_OK) ? static_cast<MojoResult>(result_index)
41 : result;
42 }
43
44 MojoResult MojoNewWait(MojoHandle handle,
45 MojoHandleSignals signals, 26 MojoHandleSignals signals,
46 MojoDeadline deadline, 27 MojoDeadline deadline,
47 MojoHandleSignalsState* signals_state) { 28 MojoHandleSignalsState* signals_state) {
48 return g_core->Wait(handle, signals, deadline, 29 return g_core->Wait(handle, signals, deadline,
49 MakeUserPointer(signals_state)); 30 MakeUserPointer(signals_state));
50 } 31 }
51 32
52 MojoResult MojoNewWaitMany(const MojoHandle* handles, 33 MojoResult MojoWaitMany(const MojoHandle* handles,
53 const MojoHandleSignals* signals, 34 const MojoHandleSignals* signals,
54 uint32_t num_handles, 35 uint32_t num_handles,
55 MojoDeadline deadline, 36 MojoDeadline deadline,
56 uint32_t* result_index, 37 uint32_t* result_index,
57 MojoHandleSignalsState* signals_states) { 38 MojoHandleSignalsState* signals_states) {
58 return g_core->WaitMany(MakeUserPointer(handles), MakeUserPointer(signals), 39 return g_core->WaitMany(MakeUserPointer(handles), MakeUserPointer(signals),
59 num_handles, deadline, MakeUserPointer(result_index), 40 num_handles, deadline, MakeUserPointer(result_index),
60 MakeUserPointer(signals_states)); 41 MakeUserPointer(signals_states));
61 } 42 }
62 43
63 MojoResult MojoCreateMessagePipe(const MojoCreateMessagePipeOptions* options, 44 MojoResult MojoCreateMessagePipe(const MojoCreateMessagePipeOptions* options,
64 MojoHandle* message_pipe_handle0, 45 MojoHandle* message_pipe_handle0,
65 MojoHandle* message_pipe_handle1) { 46 MojoHandle* message_pipe_handle1) {
66 return g_core->CreateMessagePipe(MakeUserPointer(options), 47 return g_core->CreateMessagePipe(MakeUserPointer(options),
67 MakeUserPointer(message_pipe_handle0), 48 MakeUserPointer(message_pipe_handle0),
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 MojoMapBufferFlags flags) { 146 MojoMapBufferFlags flags) {
166 return g_core->MapBuffer(buffer_handle, offset, num_bytes, 147 return g_core->MapBuffer(buffer_handle, offset, num_bytes,
167 MakeUserPointer(buffer), flags); 148 MakeUserPointer(buffer), flags);
168 } 149 }
169 150
170 MojoResult MojoUnmapBuffer(void* buffer) { 151 MojoResult MojoUnmapBuffer(void* buffer) {
171 return g_core->UnmapBuffer(MakeUserPointer(buffer)); 152 return g_core->UnmapBuffer(MakeUserPointer(buffer));
172 } 153 }
173 154
174 } // extern "C" 155 } // extern "C"
OLDNEW
« no previous file with comments | « mojo/edk/embedder/embedder_unittest.cc ('k') | mojo/edk/embedder/platform_channel_pair_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698