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

Unified Diff: mojo/edk/embedder/system_impl_private_entrypoints.cc

Issue 1350023003: Add a Mojo EDK for Chrome that uses one OS pipe per message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanup Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: mojo/edk/embedder/system_impl_private_entrypoints.cc
diff --git a/third_party/mojo/src/mojo/edk/embedder/system_impl_private_entrypoints.cc b/mojo/edk/embedder/system_impl_private_entrypoints.cc
similarity index 65%
copy from third_party/mojo/src/mojo/edk/embedder/system_impl_private_entrypoints.cc
copy to mojo/edk/embedder/system_impl_private_entrypoints.cc
index b1393ef99d9e1390fcac6938ebe7308443042ea4..0642fee1840dfc3ade2b12e9b5fe76ab14fbd88e 100644
--- a/third_party/mojo/src/mojo/edk/embedder/system_impl_private_entrypoints.cc
+++ b/mojo/edk/embedder/system_impl_private_entrypoints.cc
@@ -2,19 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "mojo/edk/embedder/embedder_internal.h"
+#include "mojo/edk/system/core.h"
+#include "mojo/edk/system/dispatcher.h"
#include "mojo/public/c/system/buffer.h"
#include "mojo/public/c/system/data_pipe.h"
#include "mojo/public/c/system/functions.h"
#include "mojo/public/c/system/message_pipe.h"
#include "mojo/public/platform/native/system_impl_private.h"
-#include "third_party/mojo/src/mojo/edk/embedder/embedder_internal.h"
-#include "third_party/mojo/src/mojo/edk/system/core.h"
-#include "third_party/mojo/src/mojo/edk/system/dispatcher.h"
-using mojo::embedder::internal::g_core;
-using mojo::system::Core;
-using mojo::system::Dispatcher;
-using mojo::system::MakeUserPointer;
+using mojo::edk::internal::g_core;
+using mojo::edk::Core;
+using mojo::edk::Dispatcher;
+
+// TODO(use_chrome_edk): commented out since for now we use the entrypoints in
+// third_party and that checks the command line to redirect here.
+/*
// Definitions of the system functions, but with an explicit parameter for the
// core object rather than using the default singleton. Also includes functions
@@ -64,18 +67,18 @@ MojoResult MojoSystemImplTransferHandle(MojoSystemImpl from_system,
return MOJO_RESULT_RESOURCE_EXHAUSTED;
}
- MakeUserPointer(result_handle).Put(created_handle);
+ *result_handle = created_handle;
return MOJO_RESULT_OK;
}
MojoTimeTicks MojoSystemImplGetTimeTicksNow(MojoSystemImpl system) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
return core->GetTimeTicksNow();
}
MojoResult MojoSystemImplClose(MojoSystemImpl system, MojoHandle handle) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
return core->Close(handle);
}
@@ -85,9 +88,9 @@ MojoResult MojoSystemImplWait(MojoSystemImpl system,
MojoHandleSignals signals,
MojoDeadline deadline,
MojoHandleSignalsState* signals_state) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
- return core->Wait(handle, signals, deadline, MakeUserPointer(signals_state));
+ return core->Wait(handle, signals, deadline, signals_state);
}
MojoResult MojoSystemImplWaitMany(MojoSystemImpl system,
@@ -97,11 +100,10 @@ MojoResult MojoSystemImplWaitMany(MojoSystemImpl system,
MojoDeadline deadline,
uint32_t* result_index,
MojoHandleSignalsState* signals_states) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
- return core->WaitMany(MakeUserPointer(handles), MakeUserPointer(signals),
- num_handles, deadline, MakeUserPointer(result_index),
- MakeUserPointer(signals_states));
+ return core->WaitMany(handles, signals, num_handles, deadline, result_index,
+ signals_states);
}
MojoResult MojoSystemImplCreateMessagePipe(
@@ -109,11 +111,10 @@ MojoResult MojoSystemImplCreateMessagePipe(
const MojoCreateMessagePipeOptions* options,
MojoHandle* message_pipe_handle0,
MojoHandle* message_pipe_handle1) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
- return core->CreateMessagePipe(MakeUserPointer(options),
- MakeUserPointer(message_pipe_handle0),
- MakeUserPointer(message_pipe_handle1));
+ return core->CreateMessagePipe(options, message_pipe_handle0,
+ message_pipe_handle1);
}
MojoResult MojoSystemImplWriteMessage(MojoSystemImpl system,
@@ -123,11 +124,10 @@ MojoResult MojoSystemImplWriteMessage(MojoSystemImpl system,
const MojoHandle* handles,
uint32_t num_handles,
MojoWriteMessageFlags flags) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
- return core->WriteMessage(message_pipe_handle, MakeUserPointer(bytes),
- num_bytes, MakeUserPointer(handles), num_handles,
- flags);
+ return core->WriteMessage(message_pipe_handle, bytes, num_bytes, num_bytes,
+ handles, num_handles, flags);
}
MojoResult MojoSystemImplReadMessage(MojoSystemImpl system,
@@ -137,11 +137,10 @@ MojoResult MojoSystemImplReadMessage(MojoSystemImpl system,
MojoHandle* handles,
uint32_t* num_handles,
MojoReadMessageFlags flags) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
- return core->ReadMessage(message_pipe_handle, MakeUserPointer(bytes),
- MakeUserPointer(num_bytes), MakeUserPointer(handles),
- MakeUserPointer(num_handles), flags);
+ return core->ReadMessage(message_pipe_handle, bytes, num_bytes, handles,
+ num_handles, flags);
}
MojoResult MojoSystemImplCreateDataPipe(
@@ -149,11 +148,10 @@ MojoResult MojoSystemImplCreateDataPipe(
const MojoCreateDataPipeOptions* options,
MojoHandle* data_pipe_producer_handle,
MojoHandle* data_pipe_consumer_handle) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
- return core->CreateDataPipe(MakeUserPointer(options),
- MakeUserPointer(data_pipe_producer_handle),
- MakeUserPointer(data_pipe_consumer_handle));
+ return core->CreateDataPipe(options, data_pipe_producer_handle,
+ data_pipe_consumer_handle);
}
MojoResult MojoSystemImplWriteData(MojoSystemImpl system,
@@ -161,10 +159,10 @@ MojoResult MojoSystemImplWriteData(MojoSystemImpl system,
const void* elements,
uint32_t* num_elements,
MojoWriteDataFlags flags) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
- return core->WriteData(data_pipe_producer_handle, MakeUserPointer(elements),
- MakeUserPointer(num_elements), flags);
+ return core->WriteData(data_pipe_producer_handle, elements, num_elements,
+ flags);
}
MojoResult MojoSystemImplBeginWriteData(MojoSystemImpl system,
@@ -172,17 +170,16 @@ MojoResult MojoSystemImplBeginWriteData(MojoSystemImpl system,
void** buffer,
uint32_t* buffer_num_elements,
MojoWriteDataFlags flags) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
- return core->BeginWriteData(data_pipe_producer_handle,
- MakeUserPointer(buffer),
- MakeUserPointer(buffer_num_elements), flags);
+ return core->BeginWriteData(data_pipe_producer_handle, buffer,
+ buffer_num_elements, flags);
}
MojoResult MojoSystemImplEndWriteData(MojoSystemImpl system,
MojoHandle data_pipe_producer_handle,
uint32_t num_elements_written) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
return core->EndWriteData(data_pipe_producer_handle, num_elements_written);
}
@@ -192,10 +189,10 @@ MojoResult MojoSystemImplReadData(MojoSystemImpl system,
void* elements,
uint32_t* num_elements,
MojoReadDataFlags flags) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
- return core->ReadData(data_pipe_consumer_handle, MakeUserPointer(elements),
- MakeUserPointer(num_elements), flags);
+ return core->ReadData(data_pipe_consumer_handle, elements, num_elements,
+ flags);
}
MojoResult MojoSystemImplBeginReadData(MojoSystemImpl system,
@@ -203,16 +200,16 @@ MojoResult MojoSystemImplBeginReadData(MojoSystemImpl system,
const void** buffer,
uint32_t* buffer_num_elements,
MojoReadDataFlags flags) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
- return core->BeginReadData(data_pipe_consumer_handle, MakeUserPointer(buffer),
- MakeUserPointer(buffer_num_elements), flags);
+ return core->BeginReadData(data_pipe_consumer_handle, buffer,
+ buffer_num_elements, flags);
}
MojoResult MojoSystemImplEndReadData(MojoSystemImpl system,
MojoHandle data_pipe_consumer_handle,
uint32_t num_elements_read) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
return core->EndReadData(data_pipe_consumer_handle, num_elements_read);
}
@@ -222,10 +219,9 @@ MojoResult MojoSystemImplCreateSharedBuffer(
const MojoCreateSharedBufferOptions* options,
uint64_t num_bytes,
MojoHandle* shared_buffer_handle) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
- return core->CreateSharedBuffer(MakeUserPointer(options), num_bytes,
- MakeUserPointer(shared_buffer_handle));
+ return core->CreateSharedBuffer(options, num_bytes, shared_buffer_handle);
}
MojoResult MojoSystemImplDuplicateBufferHandle(
@@ -233,10 +229,9 @@ MojoResult MojoSystemImplDuplicateBufferHandle(
MojoHandle buffer_handle,
const MojoDuplicateBufferHandleOptions* options,
MojoHandle* new_buffer_handle) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
- return core->DuplicateBufferHandle(buffer_handle, MakeUserPointer(options),
- MakeUserPointer(new_buffer_handle));
+ return core->DuplicateBufferHandle(buffer_handle, options, new_buffer_handle);
}
MojoResult MojoSystemImplMapBuffer(MojoSystemImpl system,
@@ -245,16 +240,16 @@ MojoResult MojoSystemImplMapBuffer(MojoSystemImpl system,
uint64_t num_bytes,
void** buffer,
MojoMapBufferFlags flags) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
- return core->MapBuffer(buffer_handle, offset, num_bytes,
- MakeUserPointer(buffer), flags);
+ return core->MapBuffer(buffer_handle, offset, num_bytes, buffer, flags);
}
MojoResult MojoSystemImplUnmapBuffer(MojoSystemImpl system, void* buffer) {
- mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
+ mojo::edk::Core* core = static_cast<mojo::edk::Core*>(system);
DCHECK(core);
- return core->UnmapBuffer(MakeUserPointer(buffer));
+ return core->UnmapBuffer(buffer);
}
} // extern "C"
+*/

Powered by Google App Engine
This is Rietveld 408576698