| Index: mojo/edk/system/core.h
|
| diff --git a/third_party/mojo/src/mojo/edk/system/core.h b/mojo/edk/system/core.h
|
| similarity index 67%
|
| copy from third_party/mojo/src/mojo/edk/system/core.h
|
| copy to mojo/edk/system/core.h
|
| index de4dc6de5166cee9bc1887ed70802c0af1f7ac40..3f710fa707db5dd873673c03c20bc0fcb24223e2 100644
|
| --- a/third_party/mojo/src/mojo/edk/system/core.h
|
| +++ b/mojo/edk/system/core.h
|
| @@ -2,34 +2,30 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_CORE_H_
|
| -#define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_CORE_H_
|
| +#ifndef MOJO_EDK_SYSTEM_CORE_H_
|
| +#define MOJO_EDK_SYSTEM_CORE_H_
|
|
|
| #include <stdint.h>
|
|
|
| #include "base/callback.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/synchronization/lock.h"
|
| +#include "mojo/edk/system/handle_table.h"
|
| +#include "mojo/edk/system/mapping_table.h"
|
| +#include "mojo/edk/system/system_impl_export.h"
|
| #include "mojo/public/c/system/buffer.h"
|
| #include "mojo/public/c/system/data_pipe.h"
|
| #include "mojo/public/c/system/message_pipe.h"
|
| #include "mojo/public/c/system/types.h"
|
| #include "mojo/public/cpp/system/macros.h"
|
| -#include "third_party/mojo/src/mojo/edk/system/handle_table.h"
|
| -#include "third_party/mojo/src/mojo/edk/system/mapping_table.h"
|
| -#include "third_party/mojo/src/mojo/edk/system/memory.h"
|
| -#include "third_party/mojo/src/mojo/edk/system/mutex.h"
|
| -#include "third_party/mojo/src/mojo/edk/system/system_impl_export.h"
|
|
|
| namespace mojo {
|
|
|
| -namespace embedder {
|
| -class PlatformSupport;
|
| -}
|
| -
|
| -namespace system {
|
| +namespace edk {
|
|
|
| class Dispatcher;
|
| +class PlatformSupport;
|
| struct HandleSignalsState;
|
|
|
| // |Core| is an object that implements the Mojo system calls. All public methods
|
| @@ -41,7 +37,7 @@ class MOJO_SYSTEM_IMPL_EXPORT Core {
|
| // These methods are only to be used by via the embedder API (and internally):
|
|
|
| // |*platform_support| must outlive this object.
|
| - explicit Core(embedder::PlatformSupport* platform_support);
|
| + explicit Core(PlatformSupport* platform_support);
|
| virtual ~Core();
|
|
|
| // Adds |dispatcher| to the handle table, returning the handle for it. Returns
|
| @@ -69,7 +65,7 @@ class MOJO_SYSTEM_IMPL_EXPORT Core {
|
| MojoHandleSignals signals,
|
| const base::Callback<void(MojoResult)>& callback);
|
|
|
| - embedder::PlatformSupport* platform_support() const {
|
| + PlatformSupport* platform_support() const {
|
| return platform_support_;
|
| }
|
|
|
| @@ -88,56 +84,56 @@ class MOJO_SYSTEM_IMPL_EXPORT Core {
|
| MojoResult Wait(MojoHandle handle,
|
| MojoHandleSignals signals,
|
| MojoDeadline deadline,
|
| - UserPointer<MojoHandleSignalsState> signals_state);
|
| - MojoResult WaitMany(UserPointer<const MojoHandle> handles,
|
| - UserPointer<const MojoHandleSignals> signals,
|
| + MojoHandleSignalsState* signals_state);
|
| + MojoResult WaitMany(const MojoHandle* handles,
|
| + const MojoHandleSignals* signals,
|
| uint32_t num_handles,
|
| MojoDeadline deadline,
|
| - UserPointer<uint32_t> result_index,
|
| - UserPointer<MojoHandleSignalsState> signals_states);
|
| + uint32_t* result_index,
|
| + MojoHandleSignalsState* signals_states);
|
|
|
| // These methods correspond to the API functions defined in
|
| // "mojo/public/c/system/message_pipe.h":
|
| MojoResult CreateMessagePipe(
|
| - UserPointer<const MojoCreateMessagePipeOptions> options,
|
| - UserPointer<MojoHandle> message_pipe_handle0,
|
| - UserPointer<MojoHandle> message_pipe_handle1);
|
| + const MojoCreateMessagePipeOptions* options,
|
| + MojoHandle* message_pipe_handle0,
|
| + MojoHandle* message_pipe_handle1);
|
| MojoResult WriteMessage(MojoHandle message_pipe_handle,
|
| - UserPointer<const void> bytes,
|
| + const void* bytes,
|
| uint32_t num_bytes,
|
| - UserPointer<const MojoHandle> handles,
|
| + const MojoHandle* handles,
|
| uint32_t num_handles,
|
| MojoWriteMessageFlags flags);
|
| MojoResult ReadMessage(MojoHandle message_pipe_handle,
|
| - UserPointer<void> bytes,
|
| - UserPointer<uint32_t> num_bytes,
|
| - UserPointer<MojoHandle> handles,
|
| - UserPointer<uint32_t> num_handles,
|
| + void* bytes,
|
| + uint32_t* num_bytes,
|
| + MojoHandle* handles,
|
| + uint32_t* num_handles,
|
| MojoReadMessageFlags flags);
|
|
|
| // These methods correspond to the API functions defined in
|
| // "mojo/public/c/system/data_pipe.h":
|
| MojoResult CreateDataPipe(
|
| - UserPointer<const MojoCreateDataPipeOptions> options,
|
| - UserPointer<MojoHandle> data_pipe_producer_handle,
|
| - UserPointer<MojoHandle> data_pipe_consumer_handle);
|
| + const MojoCreateDataPipeOptions* options,
|
| + MojoHandle* data_pipe_producer_handle,
|
| + MojoHandle* data_pipe_consumer_handle);
|
| MojoResult WriteData(MojoHandle data_pipe_producer_handle,
|
| - UserPointer<const void> elements,
|
| - UserPointer<uint32_t> num_bytes,
|
| + const void* elements,
|
| + uint32_t* num_bytes,
|
| MojoWriteDataFlags flags);
|
| MojoResult BeginWriteData(MojoHandle data_pipe_producer_handle,
|
| - UserPointer<void*> buffer,
|
| - UserPointer<uint32_t> buffer_num_bytes,
|
| + void** buffer,
|
| + uint32_t* buffer_num_bytes,
|
| MojoWriteDataFlags flags);
|
| MojoResult EndWriteData(MojoHandle data_pipe_producer_handle,
|
| uint32_t num_bytes_written);
|
| MojoResult ReadData(MojoHandle data_pipe_consumer_handle,
|
| - UserPointer<void> elements,
|
| - UserPointer<uint32_t> num_bytes,
|
| + void* elements,
|
| + uint32_t* num_bytes,
|
| MojoReadDataFlags flags);
|
| MojoResult BeginReadData(MojoHandle data_pipe_consumer_handle,
|
| - UserPointer<const void*> buffer,
|
| - UserPointer<uint32_t> buffer_num_bytes,
|
| + const void** buffer,
|
| + uint32_t* buffer_num_bytes,
|
| MojoReadDataFlags flags);
|
| MojoResult EndReadData(MojoHandle data_pipe_consumer_handle,
|
| uint32_t num_bytes_read);
|
| @@ -145,19 +141,19 @@ class MOJO_SYSTEM_IMPL_EXPORT Core {
|
| // These methods correspond to the API functions defined in
|
| // "mojo/public/c/system/buffer.h":
|
| MojoResult CreateSharedBuffer(
|
| - UserPointer<const MojoCreateSharedBufferOptions> options,
|
| + const MojoCreateSharedBufferOptions* options,
|
| uint64_t num_bytes,
|
| - UserPointer<MojoHandle> shared_buffer_handle);
|
| + MojoHandle* shared_buffer_handle);
|
| MojoResult DuplicateBufferHandle(
|
| MojoHandle buffer_handle,
|
| - UserPointer<const MojoDuplicateBufferHandleOptions> options,
|
| - UserPointer<MojoHandle> new_buffer_handle);
|
| + const MojoDuplicateBufferHandleOptions* options,
|
| + MojoHandle* new_buffer_handle);
|
| MojoResult MapBuffer(MojoHandle buffer_handle,
|
| uint64_t offset,
|
| uint64_t num_bytes,
|
| - UserPointer<void*> buffer,
|
| + void** buffer,
|
| MojoMapBufferFlags flags);
|
| - MojoResult UnmapBuffer(UserPointer<void> buffer);
|
| + MojoResult UnmapBuffer(void* buffer);
|
|
|
| private:
|
| friend bool internal::ShutdownCheckNoLeaks(Core*);
|
| @@ -173,20 +169,20 @@ class MOJO_SYSTEM_IMPL_EXPORT Core {
|
| uint32_t* result_index,
|
| HandleSignalsState* signals_states);
|
|
|
| - embedder::PlatformSupport* const platform_support_;
|
| + PlatformSupport* const platform_support_;
|
|
|
| - // TODO(vtl): |handle_table_mutex_| should be a reader-writer lock (if only we
|
| + // TODO(vtl): |handle_table_lock_| should be a reader-writer lock (if only we
|
| // had them).
|
| - Mutex handle_table_mutex_;
|
| - HandleTable handle_table_ MOJO_GUARDED_BY(handle_table_mutex_);
|
| + base::Lock handle_table_lock_; // Protects |handle_table_|.
|
| + HandleTable handle_table_;
|
|
|
| - Mutex mapping_table_mutex_;
|
| - MappingTable mapping_table_ MOJO_GUARDED_BY(mapping_table_mutex_);
|
| + base::Lock mapping_table_lock_; // Protects |mapping_table_|.
|
| + MappingTable mapping_table_;
|
|
|
| MOJO_DISALLOW_COPY_AND_ASSIGN(Core);
|
| };
|
|
|
| -} // namespace system
|
| +} // namespace edk
|
| } // namespace mojo
|
|
|
| -#endif // THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_CORE_H_
|
| +#endif // MOJO_EDK_SYSTEM_CORE_H_
|
|
|