diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-14 20:21:40 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-14 20:21:40 +0000 |
commit | cf28cd1ed8bc378ba1260a94897ab8c9aecbc894 (patch) | |
tree | e288c75db8a5ff448240913eee0839ef630dd1f9 /mojo/system | |
parent | d2202e2a3ea471caeab836e7f215bfdc20f23f2f (diff) | |
download | chromium_src-cf28cd1ed8bc378ba1260a94897ab8c9aecbc894.zip chromium_src-cf28cd1ed8bc378ba1260a94897ab8c9aecbc894.tar.gz chromium_src-cf28cd1ed8bc378ba1260a94897ab8c9aecbc894.tar.bz2 |
Make mojo_system static and mojo_system_impl a component, never use both
BUG=
R=viettrungluu@chromium.org
Review URL: https://codereview.chromium.org/231353002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263717 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/system')
-rw-r--r-- | mojo/system/core.cc (renamed from mojo/system/core_impl.cc) | 141 | ||||
-rw-r--r-- | mojo/system/core.h | 151 | ||||
-rw-r--r-- | mojo/system/core_impl.h | 153 | ||||
-rw-r--r-- | mojo/system/core_test_base.cc | 4 | ||||
-rw-r--r-- | mojo/system/core_test_base.h | 6 | ||||
-rw-r--r-- | mojo/system/core_unittest.cc (renamed from mojo/system/core_impl_unittest.cc) | 28 | ||||
-rw-r--r-- | mojo/system/data_pipe.h | 2 | ||||
-rw-r--r-- | mojo/system/dispatcher.h | 6 | ||||
-rw-r--r-- | mojo/system/entrypoints.cc | 150 | ||||
-rw-r--r-- | mojo/system/entrypoints.h | 24 | ||||
-rw-r--r-- | mojo/system/handle_table.cc | 2 | ||||
-rw-r--r-- | mojo/system/handle_table.h | 22 | ||||
-rw-r--r-- | mojo/system/mapping_table.cc | 2 | ||||
-rw-r--r-- | mojo/system/mapping_table.h | 13 | ||||
-rw-r--r-- | mojo/system/message_pipe.cc | 6 | ||||
-rw-r--r-- | mojo/system/message_pipe.h | 5 | ||||
-rw-r--r-- | mojo/system/simple_dispatcher.h | 4 | ||||
-rw-r--r-- | mojo/system/waiter_list.h | 4 |
18 files changed, 446 insertions, 277 deletions
diff --git a/mojo/system/core_impl.cc b/mojo/system/core.cc index 12c1be5..dd8fb57 100644 --- a/mojo/system/core_impl.cc +++ b/mojo/system/core.cc @@ -2,12 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "mojo/system/core_impl.h" +#include "mojo/system/core.h" #include <vector> #include "base/logging.h" #include "base/time/time.h" +#include "mojo/public/c/system/core.h" #include "mojo/system/constants.h" #include "mojo/system/data_pipe.h" #include "mojo/system/data_pipe_consumer_dispatcher.h" @@ -26,11 +27,11 @@ namespace system { // Implementation notes // -// Mojo primitives are implemented by the singleton |CoreImpl| object. Most +// Mojo primitives are implemented by the singleton |Core| object. Most // calls are for a "primary" handle (the first argument). -// |CoreImpl::GetDispatcher()| is used to look up a |Dispatcher| object for a +// |Core::GetDispatcher()| is used to look up a |Dispatcher| object for a // given handle. That object implements most primitives for that object. The -// wait primitives are not attached to objects and are implemented by |CoreImpl| +// wait primitives are not attached to objects and are implemented by |Core| // itself. // // Some objects have multiple handles associated to them, e.g., message pipes @@ -73,39 +74,37 @@ namespace system { // - Locks at the "INF" level may not have any locks taken while they are // held. -CoreImpl::HandleTableEntry::HandleTableEntry() +Core::HandleTableEntry::HandleTableEntry() : busy(false) { } -CoreImpl::HandleTableEntry::HandleTableEntry( +Core::HandleTableEntry::HandleTableEntry( const scoped_refptr<Dispatcher>& dispatcher) : dispatcher(dispatcher), busy(false) { } -CoreImpl::HandleTableEntry::~HandleTableEntry() { +Core::HandleTableEntry::~HandleTableEntry() { DCHECK(!busy); } -CoreImpl::CoreImpl() { +Core::Core() { } -CoreImpl::~CoreImpl() { - // This should usually not be reached (the singleton lives forever), except in - // tests. +Core::~Core() { } -MojoHandle CoreImpl::AddDispatcher( +MojoHandle Core::AddDispatcher( const scoped_refptr<Dispatcher>& dispatcher) { base::AutoLock locker(handle_table_lock_); return handle_table_.AddDispatcher(dispatcher); } -MojoTimeTicks CoreImpl::GetTimeTicksNow() { +MojoTimeTicks Core::GetTimeTicksNow() { return base::TimeTicks::Now().ToInternalValue(); } -MojoResult CoreImpl::Close(MojoHandle handle) { +MojoResult Core::Close(MojoHandle handle) { if (handle == MOJO_HANDLE_INVALID) return MOJO_RESULT_INVALID_ARGUMENT; @@ -125,16 +124,16 @@ MojoResult CoreImpl::Close(MojoHandle handle) { return dispatcher->Close(); } -MojoResult CoreImpl::Wait(MojoHandle handle, - MojoWaitFlags flags, - MojoDeadline deadline) { +MojoResult Core::Wait(MojoHandle handle, + MojoWaitFlags flags, + MojoDeadline deadline) { return WaitManyInternal(&handle, &flags, 1, deadline); } -MojoResult CoreImpl::WaitMany(const MojoHandle* handles, - const MojoWaitFlags* flags, - uint32_t num_handles, - MojoDeadline deadline) { +MojoResult Core::WaitMany(const MojoHandle* handles, + const MojoWaitFlags* flags, + uint32_t num_handles, + MojoDeadline deadline) { if (!VerifyUserPointer<MojoHandle>(handles, num_handles)) return MOJO_RESULT_INVALID_ARGUMENT; if (!VerifyUserPointer<MojoWaitFlags>(flags, num_handles)) @@ -146,8 +145,8 @@ MojoResult CoreImpl::WaitMany(const MojoHandle* handles, return WaitManyInternal(handles, flags, num_handles, deadline); } -MojoResult CoreImpl::CreateMessagePipe(MojoHandle* message_pipe_handle0, - MojoHandle* message_pipe_handle1) { +MojoResult Core::CreateMessagePipe(MojoHandle* message_pipe_handle0, + MojoHandle* message_pipe_handle1) { if (!VerifyUserPointer<MojoHandle>(message_pipe_handle0, 1)) return MOJO_RESULT_INVALID_ARGUMENT; if (!VerifyUserPointer<MojoHandle>(message_pipe_handle1, 1)) @@ -185,12 +184,12 @@ MojoResult CoreImpl::CreateMessagePipe(MojoHandle* message_pipe_handle0, // isn't done, in the in-process case, calls on the old handle may complete // after the the message has been received and a new handle created (and // possibly even after calls have been made on the new handle). -MojoResult CoreImpl::WriteMessage(MojoHandle message_pipe_handle, - const void* bytes, - uint32_t num_bytes, - const MojoHandle* handles, - uint32_t num_handles, - MojoWriteMessageFlags flags) { +MojoResult Core::WriteMessage(MojoHandle message_pipe_handle, + const void* bytes, + uint32_t num_bytes, + const MojoHandle* handles, + uint32_t num_handles, + MojoWriteMessageFlags flags) { scoped_refptr<Dispatcher> dispatcher(GetDispatcher(message_pipe_handle)); if (!dispatcher.get()) return MOJO_RESULT_INVALID_ARGUMENT; @@ -249,12 +248,12 @@ MojoResult CoreImpl::WriteMessage(MojoHandle message_pipe_handle, return rv; } -MojoResult CoreImpl::ReadMessage(MojoHandle message_pipe_handle, - void* bytes, - uint32_t* num_bytes, - MojoHandle* handles, - uint32_t* num_handles, - MojoReadMessageFlags flags) { +MojoResult Core::ReadMessage(MojoHandle message_pipe_handle, + void* bytes, + uint32_t* num_bytes, + MojoHandle* handles, + uint32_t* num_handles, + MojoReadMessageFlags flags) { scoped_refptr<Dispatcher> dispatcher(GetDispatcher(message_pipe_handle)); if (!dispatcher.get()) return MOJO_RESULT_INVALID_ARGUMENT; @@ -298,9 +297,9 @@ MojoResult CoreImpl::ReadMessage(MojoHandle message_pipe_handle, return rv; } -MojoResult CoreImpl::CreateDataPipe(const MojoCreateDataPipeOptions* options, - MojoHandle* data_pipe_producer_handle, - MojoHandle* data_pipe_consumer_handle) { +MojoResult Core::CreateDataPipe(const MojoCreateDataPipeOptions* options, + MojoHandle* data_pipe_producer_handle, + MojoHandle* data_pipe_consumer_handle) { if (options) { // The |struct_size| field must be valid to read. if (!VerifyUserPointer<uint32_t>(&options->struct_size, 1)) @@ -348,10 +347,10 @@ MojoResult CoreImpl::CreateDataPipe(const MojoCreateDataPipeOptions* options, return MOJO_RESULT_OK; } -MojoResult CoreImpl::WriteData(MojoHandle data_pipe_producer_handle, - const void* elements, - uint32_t* num_bytes, - MojoWriteDataFlags flags) { +MojoResult Core::WriteData(MojoHandle data_pipe_producer_handle, + const void* elements, + uint32_t* num_bytes, + MojoWriteDataFlags flags) { scoped_refptr<Dispatcher> dispatcher( GetDispatcher(data_pipe_producer_handle)); if (!dispatcher.get()) @@ -360,10 +359,10 @@ MojoResult CoreImpl::WriteData(MojoHandle data_pipe_producer_handle, return dispatcher->WriteData(elements, num_bytes, flags); } -MojoResult CoreImpl::BeginWriteData(MojoHandle data_pipe_producer_handle, - void** buffer, - uint32_t* buffer_num_bytes, - MojoWriteDataFlags flags) { +MojoResult Core::BeginWriteData(MojoHandle data_pipe_producer_handle, + void** buffer, + uint32_t* buffer_num_bytes, + MojoWriteDataFlags flags) { scoped_refptr<Dispatcher> dispatcher( GetDispatcher(data_pipe_producer_handle)); if (!dispatcher.get()) @@ -372,8 +371,8 @@ MojoResult CoreImpl::BeginWriteData(MojoHandle data_pipe_producer_handle, return dispatcher->BeginWriteData(buffer, buffer_num_bytes, flags); } -MojoResult CoreImpl::EndWriteData(MojoHandle data_pipe_producer_handle, - uint32_t num_bytes_written) { +MojoResult Core::EndWriteData(MojoHandle data_pipe_producer_handle, + uint32_t num_bytes_written) { scoped_refptr<Dispatcher> dispatcher( GetDispatcher(data_pipe_producer_handle)); if (!dispatcher.get()) @@ -382,10 +381,10 @@ MojoResult CoreImpl::EndWriteData(MojoHandle data_pipe_producer_handle, return dispatcher->EndWriteData(num_bytes_written); } -MojoResult CoreImpl::ReadData(MojoHandle data_pipe_consumer_handle, - void* elements, - uint32_t* num_bytes, - MojoReadDataFlags flags) { +MojoResult Core::ReadData(MojoHandle data_pipe_consumer_handle, + void* elements, + uint32_t* num_bytes, + MojoReadDataFlags flags) { scoped_refptr<Dispatcher> dispatcher( GetDispatcher(data_pipe_consumer_handle)); if (!dispatcher.get()) @@ -394,10 +393,10 @@ MojoResult CoreImpl::ReadData(MojoHandle data_pipe_consumer_handle, return dispatcher->ReadData(elements, num_bytes, flags); } -MojoResult CoreImpl::BeginReadData(MojoHandle data_pipe_consumer_handle, - const void** buffer, - uint32_t* buffer_num_bytes, - MojoReadDataFlags flags) { +MojoResult Core::BeginReadData(MojoHandle data_pipe_consumer_handle, + const void** buffer, + uint32_t* buffer_num_bytes, + MojoReadDataFlags flags) { scoped_refptr<Dispatcher> dispatcher( GetDispatcher(data_pipe_consumer_handle)); if (!dispatcher.get()) @@ -406,8 +405,8 @@ MojoResult CoreImpl::BeginReadData(MojoHandle data_pipe_consumer_handle, return dispatcher->BeginReadData(buffer, buffer_num_bytes, flags); } -MojoResult CoreImpl::EndReadData(MojoHandle data_pipe_consumer_handle, - uint32_t num_bytes_read) { +MojoResult Core::EndReadData(MojoHandle data_pipe_consumer_handle, + uint32_t num_bytes_read) { scoped_refptr<Dispatcher> dispatcher( GetDispatcher(data_pipe_consumer_handle)); if (!dispatcher.get()) @@ -416,7 +415,7 @@ MojoResult CoreImpl::EndReadData(MojoHandle data_pipe_consumer_handle, return dispatcher->EndReadData(num_bytes_read); } -MojoResult CoreImpl::CreateSharedBuffer( +MojoResult Core::CreateSharedBuffer( const MojoCreateSharedBufferOptions* options, uint64_t num_bytes, MojoHandle* shared_buffer_handle) { @@ -456,7 +455,7 @@ MojoResult CoreImpl::CreateSharedBuffer( return MOJO_RESULT_OK; } -MojoResult CoreImpl::DuplicateBufferHandle( +MojoResult Core::DuplicateBufferHandle( MojoHandle buffer_handle, const MojoDuplicateBufferHandleOptions* options, MojoHandle* new_buffer_handle) { @@ -485,11 +484,11 @@ MojoResult CoreImpl::DuplicateBufferHandle( return MOJO_RESULT_OK; } -MojoResult CoreImpl::MapBuffer(MojoHandle buffer_handle, - uint64_t offset, - uint64_t num_bytes, - void** buffer, - MojoMapBufferFlags flags) { +MojoResult Core::MapBuffer(MojoHandle buffer_handle, + uint64_t offset, + uint64_t num_bytes, + void** buffer, + MojoMapBufferFlags flags) { scoped_refptr<Dispatcher> dispatcher(GetDispatcher(buffer_handle)); if (!dispatcher.get()) return MOJO_RESULT_INVALID_ARGUMENT; @@ -515,12 +514,12 @@ MojoResult CoreImpl::MapBuffer(MojoHandle buffer_handle, return MOJO_RESULT_OK; } -MojoResult CoreImpl::UnmapBuffer(void* buffer) { +MojoResult Core::UnmapBuffer(void* buffer) { base::AutoLock locker(mapping_table_lock_); return mapping_table_.RemoveMapping(buffer); } -scoped_refptr<Dispatcher> CoreImpl::GetDispatcher(MojoHandle handle) { +scoped_refptr<Dispatcher> Core::GetDispatcher(MojoHandle handle) { if (handle == MOJO_HANDLE_INVALID) return NULL; @@ -532,10 +531,10 @@ scoped_refptr<Dispatcher> CoreImpl::GetDispatcher(MojoHandle handle) { // different flags may be specified. // TODO(vtl): This incurs a performance cost in |RemoveWaiter()|. Analyze this // more carefully and address it if necessary. -MojoResult CoreImpl::WaitManyInternal(const MojoHandle* handles, - const MojoWaitFlags* flags, - uint32_t num_handles, - MojoDeadline deadline) { +MojoResult Core::WaitManyInternal(const MojoHandle* handles, + const MojoWaitFlags* flags, + uint32_t num_handles, + MojoDeadline deadline) { DCHECK_GT(num_handles, 0u); std::vector<scoped_refptr<Dispatcher> > dispatchers; diff --git a/mojo/system/core.h b/mojo/system/core.h new file mode 100644 index 0000000..5d3a1cf --- /dev/null +++ b/mojo/system/core.h @@ -0,0 +1,151 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_SYSTEM_CORE_H_ +#define MOJO_SYSTEM_CORE_H_ + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "base/memory/ref_counted.h" +#include "base/synchronization/lock.h" +#include "mojo/system/handle_table.h" +#include "mojo/system/mapping_table.h" +#include "mojo/system/system_impl_export.h" + +namespace mojo { +namespace system { + +class Dispatcher; + +// |Core| is an object that implements the Mojo system calls. All public methods +// are thread-safe. +class MOJO_SYSTEM_IMPL_EXPORT Core { + public: + // These methods are only to be used by via the embedder API. + Core(); + virtual ~Core(); + MojoHandle AddDispatcher(const scoped_refptr<Dispatcher>& dispatcher); + + // System calls implementation. + MojoTimeTicks GetTimeTicksNow(); + MojoResult Close(MojoHandle handle); + MojoResult Wait(MojoHandle handle, + MojoWaitFlags flags, + MojoDeadline deadline); + MojoResult WaitMany(const MojoHandle* handles, + const MojoWaitFlags* flags, + uint32_t num_handles, + MojoDeadline deadline); + MojoResult CreateMessagePipe( + MojoHandle* message_pipe_handle0, + MojoHandle* message_pipe_handle1); + MojoResult WriteMessage(MojoHandle message_pipe_handle, + const void* bytes, + uint32_t num_bytes, + const MojoHandle* handles, + uint32_t num_handles, + MojoWriteMessageFlags flags); + MojoResult ReadMessage(MojoHandle message_pipe_handle, + void* bytes, + uint32_t* num_bytes, + MojoHandle* handles, + uint32_t* num_handles, + MojoReadMessageFlags flags); + MojoResult CreateDataPipe( + const MojoCreateDataPipeOptions* options, + MojoHandle* data_pipe_producer_handle, + MojoHandle* data_pipe_consumer_handle); + MojoResult WriteData(MojoHandle data_pipe_producer_handle, + const void* elements, + uint32_t* num_bytes, + MojoWriteDataFlags flags); + MojoResult BeginWriteData(MojoHandle data_pipe_producer_handle, + 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, + void* elements, + uint32_t* num_bytes, + MojoReadDataFlags flags); + MojoResult BeginReadData(MojoHandle data_pipe_consumer_handle, + const void** buffer, + uint32_t* buffer_num_bytes, + MojoReadDataFlags flags); + MojoResult EndReadData(MojoHandle data_pipe_consumer_handle, + uint32_t num_bytes_read); + MojoResult CreateSharedBuffer( + const MojoCreateSharedBufferOptions* options, + uint64_t num_bytes, + MojoHandle* shared_buffer_handle); + MojoResult DuplicateBufferHandle( + MojoHandle buffer_handle, + const MojoDuplicateBufferHandleOptions* options, + MojoHandle* new_buffer_handle); + MojoResult MapBuffer(MojoHandle buffer_handle, + uint64_t offset, + uint64_t num_bytes, + void** buffer, + MojoMapBufferFlags flags); + MojoResult UnmapBuffer(void* buffer); + + private: + friend bool internal::ShutdownCheckNoLeaks(Core*); + // The |busy| member is used only to deal with functions (in particular + // |WriteMessage()|) that want to hold on to a dispatcher and later remove it + // from the handle table, without holding on to the handle table lock. + // + // For example, if |WriteMessage()| is called with a handle to be sent, (under + // the handle table lock) it must first check that that handle is not busy (if + // it is busy, then it fails with |MOJO_RESULT_BUSY|) and then marks it as + // busy. To avoid deadlock, it should also try to acquire the locks for all + // the dispatchers for the handles that it is sending (and fail with + // |MOJO_RESULT_BUSY| if the attempt fails). At this point, it can release the + // handle table lock. + // + // If |Close()| is simultaneously called on that handle, it too checks if the + // handle is marked busy. If it is, it fails (with |MOJO_RESULT_BUSY|). This + // prevents |WriteMessage()| from sending a handle that has been closed (or + // learning about this too late). + struct HandleTableEntry { + HandleTableEntry(); + explicit HandleTableEntry(const scoped_refptr<Dispatcher>& dispatcher); + ~HandleTableEntry(); + + scoped_refptr<Dispatcher> dispatcher; + bool busy; + }; + typedef base::hash_map<MojoHandle, HandleTableEntry> HandleTableMap; + + // Looks up the dispatcher for the given handle. Returns null if the handle is + // invalid. + scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle); + + // Internal implementation of |Wait()| and |WaitMany()|; doesn't do basic + // validation of arguments. + MojoResult WaitManyInternal(const MojoHandle* handles, + const MojoWaitFlags* flags, + uint32_t num_handles, + MojoDeadline deadline); + + // --------------------------------------------------------------------------- + + // TODO(vtl): |handle_table_lock_| should be a reader-writer lock (if only we + // had them). + base::Lock handle_table_lock_; // Protects |handle_table_|. + HandleTable handle_table_; + + base::Lock mapping_table_lock_; // Protects |mapping_table_|. + MappingTable mapping_table_; + + // --------------------------------------------------------------------------- + + DISALLOW_COPY_AND_ASSIGN(Core); +}; + +} // namespace system +} // namespace mojo + +#endif // MOJO_SYSTEM_CORE_H_ diff --git a/mojo/system/core_impl.h b/mojo/system/core_impl.h deleted file mode 100644 index e0cbd1e..0000000 --- a/mojo/system/core_impl.h +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_SYSTEM_CORE_IMPL_H_ -#define MOJO_SYSTEM_CORE_IMPL_H_ - -#include "base/basictypes.h" -#include "base/compiler_specific.h" -#include "base/memory/ref_counted.h" -#include "base/synchronization/lock.h" -#include "mojo/public/system/core_private.h" -#include "mojo/system/handle_table.h" -#include "mojo/system/mapping_table.h" -#include "mojo/system/system_impl_export.h" - -namespace mojo { -namespace system { - -class Dispatcher; - -// |CoreImpl| is a singleton object that implements the Mojo system calls. All -// public methods are thread-safe. -class MOJO_SYSTEM_IMPL_EXPORT CoreImpl : public Core { - public: - // These methods are only to be used by via the embedder API. - CoreImpl(); - virtual ~CoreImpl(); - MojoHandle AddDispatcher(const scoped_refptr<Dispatcher>& dispatcher); - - // |CorePrivate| implementation: - virtual MojoTimeTicks GetTimeTicksNow() OVERRIDE; - virtual MojoResult Close(MojoHandle handle) OVERRIDE; - virtual MojoResult Wait(MojoHandle handle, - MojoWaitFlags flags, - MojoDeadline deadline) OVERRIDE; - virtual MojoResult WaitMany(const MojoHandle* handles, - const MojoWaitFlags* flags, - uint32_t num_handles, - MojoDeadline deadline) OVERRIDE; - virtual MojoResult CreateMessagePipe( - MojoHandle* message_pipe_handle0, - MojoHandle* message_pipe_handle1) OVERRIDE; - virtual MojoResult WriteMessage(MojoHandle message_pipe_handle, - const void* bytes, - uint32_t num_bytes, - const MojoHandle* handles, - uint32_t num_handles, - MojoWriteMessageFlags flags) OVERRIDE; - virtual MojoResult ReadMessage(MojoHandle message_pipe_handle, - void* bytes, - uint32_t* num_bytes, - MojoHandle* handles, - uint32_t* num_handles, - MojoReadMessageFlags flags) OVERRIDE; - virtual MojoResult CreateDataPipe( - const MojoCreateDataPipeOptions* options, - MojoHandle* data_pipe_producer_handle, - MojoHandle* data_pipe_consumer_handle) OVERRIDE; - virtual MojoResult WriteData(MojoHandle data_pipe_producer_handle, - const void* elements, - uint32_t* num_bytes, - MojoWriteDataFlags flags) OVERRIDE; - virtual MojoResult BeginWriteData(MojoHandle data_pipe_producer_handle, - void** buffer, - uint32_t* buffer_num_bytes, - MojoWriteDataFlags flags) OVERRIDE; - virtual MojoResult EndWriteData(MojoHandle data_pipe_producer_handle, - uint32_t num_bytes_written) OVERRIDE; - virtual MojoResult ReadData(MojoHandle data_pipe_consumer_handle, - void* elements, - uint32_t* num_bytes, - MojoReadDataFlags flags) OVERRIDE; - virtual MojoResult BeginReadData(MojoHandle data_pipe_consumer_handle, - const void** buffer, - uint32_t* buffer_num_bytes, - MojoReadDataFlags flags) OVERRIDE; - virtual MojoResult EndReadData(MojoHandle data_pipe_consumer_handle, - uint32_t num_bytes_read) OVERRIDE; - virtual MojoResult CreateSharedBuffer( - const MojoCreateSharedBufferOptions* options, - uint64_t num_bytes, - MojoHandle* shared_buffer_handle) OVERRIDE; - virtual MojoResult DuplicateBufferHandle( - MojoHandle buffer_handle, - const MojoDuplicateBufferHandleOptions* options, - MojoHandle* new_buffer_handle) OVERRIDE; - virtual MojoResult MapBuffer(MojoHandle buffer_handle, - uint64_t offset, - uint64_t num_bytes, - void** buffer, - MojoMapBufferFlags flags) OVERRIDE; - virtual MojoResult UnmapBuffer(void* buffer) OVERRIDE; - - private: - friend bool internal::ShutdownCheckNoLeaks(CoreImpl*); - - // The |busy| member is used only to deal with functions (in particular - // |WriteMessage()|) that want to hold on to a dispatcher and later remove it - // from the handle table, without holding on to the handle table lock. - // - // For example, if |WriteMessage()| is called with a handle to be sent, (under - // the handle table lock) it must first check that that handle is not busy (if - // it is busy, then it fails with |MOJO_RESULT_BUSY|) and then marks it as - // busy. To avoid deadlock, it should also try to acquire the locks for all - // the dispatchers for the handles that it is sending (and fail with - // |MOJO_RESULT_BUSY| if the attempt fails). At this point, it can release the - // handle table lock. - // - // If |Close()| is simultaneously called on that handle, it too checks if the - // handle is marked busy. If it is, it fails (with |MOJO_RESULT_BUSY|). This - // prevents |WriteMessage()| from sending a handle that has been closed (or - // learning about this too late). - struct HandleTableEntry { - HandleTableEntry(); - explicit HandleTableEntry(const scoped_refptr<Dispatcher>& dispatcher); - ~HandleTableEntry(); - - scoped_refptr<Dispatcher> dispatcher; - bool busy; - }; - typedef base::hash_map<MojoHandle, HandleTableEntry> HandleTableMap; - - // Looks up the dispatcher for the given handle. Returns null if the handle is - // invalid. - scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle); - - // Internal implementation of |Wait()| and |WaitMany()|; doesn't do basic - // validation of arguments. - MojoResult WaitManyInternal(const MojoHandle* handles, - const MojoWaitFlags* flags, - uint32_t num_handles, - MojoDeadline deadline); - - // --------------------------------------------------------------------------- - - // TODO(vtl): |handle_table_lock_| should be a reader-writer lock (if only we - // had them). - base::Lock handle_table_lock_; // Protects |handle_table_|. - HandleTable handle_table_; - - base::Lock mapping_table_lock_; // Protects |mapping_table_|. - MappingTable mapping_table_; - - // --------------------------------------------------------------------------- - - DISALLOW_COPY_AND_ASSIGN(CoreImpl); -}; - -} // namespace system -} // namespace mojo - -#endif // MOJO_SYSTEM_CORE_IMPL_H_ diff --git a/mojo/system/core_test_base.cc b/mojo/system/core_test_base.cc index 89b8fb3..29c3c5c 100644 --- a/mojo/system/core_test_base.cc +++ b/mojo/system/core_test_base.cc @@ -10,7 +10,7 @@ #include "base/logging.h" #include "base/memory/ref_counted.h" #include "mojo/system/constants.h" -#include "mojo/system/core_impl.h" +#include "mojo/system/core.h" #include "mojo/system/dispatcher.h" #include "mojo/system/memory.h" @@ -168,7 +168,7 @@ CoreTestBase::~CoreTestBase() { } void CoreTestBase::SetUp() { - core_ = new CoreImpl(); + core_ = new Core(); } void CoreTestBase::TearDown() { diff --git a/mojo/system/core_test_base.h b/mojo/system/core_test_base.h index beb985b..b725938 100644 --- a/mojo/system/core_test_base.h +++ b/mojo/system/core_test_base.h @@ -14,7 +14,7 @@ namespace mojo { namespace system { -class CoreImpl; +class Core; namespace test { @@ -34,10 +34,10 @@ class CoreTestBase : public testing::Test { // |info| must remain alive until the returned handle is closed. MojoHandle CreateMockHandle(MockHandleInfo* info); - CoreImpl* core() { return core_; } + Core* core() { return core_; } private: - CoreImpl* core_; + Core* core_; DISALLOW_COPY_AND_ASSIGN(CoreTestBase); }; diff --git a/mojo/system/core_impl_unittest.cc b/mojo/system/core_unittest.cc index 93dc860..8fab233 100644 --- a/mojo/system/core_impl_unittest.cc +++ b/mojo/system/core_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "mojo/system/core_impl.h" +#include "mojo/system/core.h" #include <limits> @@ -15,9 +15,9 @@ namespace mojo { namespace system { namespace { -typedef test::CoreTestBase CoreImplTest; +typedef test::CoreTestBase CoreTest; -TEST_F(CoreImplTest, GetTimeTicksNow) { +TEST_F(CoreTest, GetTimeTicksNow) { const MojoTimeTicks start = core()->GetTimeTicksNow(); EXPECT_NE(static_cast<MojoTimeTicks>(0), start) << "GetTimeTicksNow should return nonzero value"; @@ -28,7 +28,7 @@ TEST_F(CoreImplTest, GetTimeTicksNow) { << "Sleeping should result in increasing time ticks"; } -TEST_F(CoreImplTest, Basic) { +TEST_F(CoreTest, Basic) { MockHandleInfo info; EXPECT_EQ(0u, info.GetCtorCallCount()); @@ -120,7 +120,7 @@ TEST_F(CoreImplTest, Basic) { EXPECT_EQ(0u, info.GetRemoveWaiterCallCount()); } -TEST_F(CoreImplTest, InvalidArguments) { +TEST_F(CoreTest, InvalidArguments) { // |Close()|: { EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, core()->Close(MOJO_HANDLE_INVALID)); @@ -195,7 +195,7 @@ TEST_F(CoreImplTest, InvalidArguments) { } // |WriteMessage()|: - // Only check arguments checked by |CoreImpl|, namely |handle|, |handles|, and + // Only check arguments checked by |Core|, namely |handle|, |handles|, and // |num_handles|. { EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, @@ -210,7 +210,7 @@ TEST_F(CoreImplTest, InvalidArguments) { EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, core()->WriteMessage(h, NULL, 0, NULL, 1, MOJO_WRITE_MESSAGE_FLAG_NONE)); - // Checked by |CoreImpl|, shouldn't go through to the dispatcher. + // Checked by |Core|, shouldn't go through to the dispatcher. EXPECT_EQ(0u, info.GetWriteMessageCallCount()); // Huge handle count (implausibly big on some systems -- more than can be @@ -289,7 +289,7 @@ TEST_F(CoreImplTest, InvalidArguments) { } // |ReadMessage()|: - // Only check arguments checked by |CoreImpl|, namely |handle|, |handles|, and + // Only check arguments checked by |Core|, namely |handle|, |handles|, and // |num_handles|. { EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, @@ -303,7 +303,7 @@ TEST_F(CoreImplTest, InvalidArguments) { EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, core()->ReadMessage(h, NULL, NULL, NULL, &handle_count, MOJO_READ_MESSAGE_FLAG_NONE)); - // Checked by |CoreImpl|, shouldn't go through to the dispatcher. + // Checked by |Core|, shouldn't go through to the dispatcher. EXPECT_EQ(0u, info.GetReadMessageCallCount()); // Okay. @@ -311,7 +311,7 @@ TEST_F(CoreImplTest, InvalidArguments) { EXPECT_EQ(MOJO_RESULT_OK, core()->ReadMessage(h, NULL, NULL, NULL, &handle_count, MOJO_READ_MESSAGE_FLAG_NONE)); - // Checked by |CoreImpl|, shouldn't go through to the dispatcher. + // Checked by |Core|, shouldn't go through to the dispatcher. EXPECT_EQ(1u, info.GetReadMessageCallCount()); EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h)); @@ -322,7 +322,7 @@ TEST_F(CoreImplTest, InvalidArguments) { // - including |WaitMany()| with the same handle more than once (with // same/different flags) -TEST_F(CoreImplTest, MessagePipe) { +TEST_F(CoreTest, MessagePipe) { MojoHandle h[2]; EXPECT_EQ(MOJO_RESULT_OK, core()->CreateMessagePipe(&h[0], &h[1])); @@ -424,7 +424,7 @@ TEST_F(CoreImplTest, MessagePipe) { } // Tests passing a message pipe handle. -TEST_F(CoreImplTest, MessagePipeBasicLocalHandlePassing1) { +TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing1) { const char kHello[] = "hello"; const uint32_t kHelloSize = static_cast<uint32_t>(sizeof(kHello)); const char kWorld[] = "world!!!"; @@ -551,7 +551,7 @@ TEST_F(CoreImplTest, MessagePipeBasicLocalHandlePassing1) { EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h_received)); } -TEST_F(CoreImplTest, DataPipe) { +TEST_F(CoreTest, DataPipe) { MojoHandle ph, ch; // p is for producer and c is for consumer. EXPECT_EQ(MOJO_RESULT_OK, core()->CreateDataPipe(NULL, &ph, &ch)); @@ -673,7 +673,7 @@ TEST_F(CoreImplTest, DataPipe) { } // Tests passing data pipe producer and consumer handles. -TEST_F(CoreImplTest, MessagePipeBasicLocalHandlePassing2) { +TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing2) { const char kHello[] = "hello"; const uint32_t kHelloSize = static_cast<uint32_t>(sizeof(kHello)); const char kWorld[] = "world!!!"; diff --git a/mojo/system/data_pipe.h b/mojo/system/data_pipe.h index 8d6fcaf..9abd81e 100644 --- a/mojo/system/data_pipe.h +++ b/mojo/system/data_pipe.h @@ -19,7 +19,7 @@ class Waiter; class WaiterList; // |DataPipe| is a base class for secondary objects implementing data pipes, -// similar to |MessagePipe| (see the explanatory comment in core_impl.cc). It is +// similar to |MessagePipe| (see the explanatory comment in core.cc). It is // typically owned by the dispatcher(s) corresponding to the local endpoints. // Its subclasses implement the three cases: local producer and consumer, local // producer and remote consumer, and remote producer and local consumer. This diff --git a/mojo/system/dispatcher.h b/mojo/system/dispatcher.h index 5bb6b3e..504e33a 100644 --- a/mojo/system/dispatcher.h +++ b/mojo/system/dispatcher.h @@ -22,7 +22,7 @@ namespace mojo { namespace system { class Channel; -class CoreImpl; +class Core; class Dispatcher; class DispatcherTransport; class HandleTable; @@ -135,9 +135,9 @@ class MOJO_SYSTEM_IMPL_EXPORT Dispatcher : // has been called. class HandleTableAccess { private: - friend class CoreImpl; + friend class Core; friend class HandleTable; - // Tests also need this, to avoid needing |CoreImpl|. + // Tests also need this, to avoid needing |Core|. friend DispatcherTransport test::DispatcherTryStartTransport(Dispatcher*); // This must be called under the handle table lock and only if the handle diff --git a/mojo/system/entrypoints.cc b/mojo/system/entrypoints.cc new file mode 100644 index 0000000..096fd02 --- /dev/null +++ b/mojo/system/entrypoints.cc @@ -0,0 +1,150 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/system/core.h" + +static mojo::system::Core* g_core = NULL; + +namespace mojo { +namespace system { +namespace entrypoints { + +void SetCore(Core* core) { + g_core = core; +} + +Core* GetCore() { + return g_core; +} + +} // namespace entrypoints +} // namepace system +} // namespace mojo + +// Definitions of the system functions. +extern "C" { + +MojoTimeTicks MojoGetTimeTicksNow() { + return g_core->GetTimeTicksNow(); +} + +MojoResult MojoClose(MojoHandle handle) { + return g_core->Close(handle); +} + +MojoResult MojoWait(MojoHandle handle, + MojoWaitFlags flags, + MojoDeadline deadline) { + return g_core->Wait(handle, flags, deadline); +} + +MojoResult MojoWaitMany(const MojoHandle* handles, + const MojoWaitFlags* flags, + uint32_t num_handles, + MojoDeadline deadline) { + return g_core->WaitMany(handles, flags, num_handles, deadline); +} + +MojoResult MojoCreateMessagePipe(MojoHandle* message_pipe_handle0, + MojoHandle* message_pipe_handle1) { + return g_core->CreateMessagePipe(message_pipe_handle0, message_pipe_handle1); +} + +MojoResult MojoWriteMessage(MojoHandle message_pipe_handle, + const void* bytes, + uint32_t num_bytes, + const MojoHandle* handles, + uint32_t num_handles, + MojoWriteMessageFlags flags) { + return g_core->WriteMessage( + message_pipe_handle, bytes, num_bytes, handles, num_handles, flags); +} + +MojoResult MojoReadMessage(MojoHandle message_pipe_handle, + void* bytes, + uint32_t* num_bytes, + MojoHandle* handles, + uint32_t* num_handles, + MojoReadMessageFlags flags) { + return g_core->ReadMessage( + message_pipe_handle, bytes, num_bytes, handles, num_handles, flags); +} + +MojoResult MojoCreateDataPipe(const MojoCreateDataPipeOptions* options, + MojoHandle* data_pipe_producer_handle, + MojoHandle* data_pipe_consumer_handle) { + return g_core->CreateDataPipe( + options, data_pipe_producer_handle, data_pipe_consumer_handle); +} + +MojoResult MojoWriteData(MojoHandle data_pipe_producer_handle, + const void* elements, + uint32_t* num_elements, + MojoWriteDataFlags flags) { + return g_core->WriteData( + data_pipe_producer_handle, elements, num_elements, flags); +} + +MojoResult MojoBeginWriteData(MojoHandle data_pipe_producer_handle, + void** buffer, + uint32_t* buffer_num_elements, + MojoWriteDataFlags flags) { + return g_core->BeginWriteData( + data_pipe_producer_handle, buffer, buffer_num_elements, flags); +} + +MojoResult MojoEndWriteData(MojoHandle data_pipe_producer_handle, + uint32_t num_elements_written) { + return g_core->EndWriteData(data_pipe_producer_handle, num_elements_written); +} + +MojoResult MojoReadData(MojoHandle data_pipe_consumer_handle, + void* elements, + uint32_t* num_elements, + MojoReadDataFlags flags) { + return g_core->ReadData( + data_pipe_consumer_handle, elements, num_elements, flags); +} + +MojoResult MojoBeginReadData(MojoHandle data_pipe_consumer_handle, + const void** buffer, + uint32_t* buffer_num_elements, + MojoReadDataFlags flags) { + return g_core->BeginReadData( + data_pipe_consumer_handle, buffer, buffer_num_elements, flags); +} + +MojoResult MojoEndReadData(MojoHandle data_pipe_consumer_handle, + uint32_t num_elements_read) { + return g_core->EndReadData(data_pipe_consumer_handle, num_elements_read); +} + +MojoResult MojoCreateSharedBuffer( + const struct MojoCreateSharedBufferOptions* options, + uint64_t num_bytes, + MojoHandle* shared_buffer_handle) { + return g_core->CreateSharedBuffer(options, num_bytes, shared_buffer_handle); +} + +MojoResult MojoDuplicateBufferHandle( + MojoHandle buffer_handle, + const struct MojoDuplicateBufferHandleOptions* options, + MojoHandle* new_buffer_handle) { + return g_core->DuplicateBufferHandle( + buffer_handle, options, new_buffer_handle); +} + +MojoResult MojoMapBuffer(MojoHandle buffer_handle, + uint64_t offset, + uint64_t num_bytes, + void** buffer, + MojoMapBufferFlags flags) { + return g_core->MapBuffer(buffer_handle, offset, num_bytes, buffer, flags); +} + +MojoResult MojoUnmapBuffer(void* buffer) { + return g_core->UnmapBuffer(buffer); +} + +} // extern "C" diff --git a/mojo/system/entrypoints.h b/mojo/system/entrypoints.h new file mode 100644 index 0000000..65a0363 --- /dev/null +++ b/mojo/system/entrypoints.h @@ -0,0 +1,24 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_SYSTEM_ENTRYPOINTS_H +#define MOJO_SYSTEM_ENTRYPOINTS_H + +namespace mojo { +namespace system { + +class Core; + +namespace entrypoints { + +// Sets the instance of Core to be used by system functions. +void SetCore(Core* core); +// Gets the instance of Core to be used by system functions. +Core* GetCore(); + +} // namespace entrypoints +} // namepace system +} // namespace mojo + +#endif // MOJO_SYSTEM_ENTRYPOINTS_H diff --git a/mojo/system/handle_table.cc b/mojo/system/handle_table.cc index 798b610..b863e81 100644 --- a/mojo/system/handle_table.cc +++ b/mojo/system/handle_table.cc @@ -31,7 +31,7 @@ HandleTable::HandleTable() HandleTable::~HandleTable() { // This should usually not be reached (the only instance should be owned by - // the singleton |CoreImpl|, which lives forever), except in tests. + // the singleton |Core|, which lives forever), except in tests. } Dispatcher* HandleTable::GetDispatcher(MojoHandle handle) { diff --git a/mojo/system/handle_table.h b/mojo/system/handle_table.h index 4bcf02c..408fae2 100644 --- a/mojo/system/handle_table.h +++ b/mojo/system/handle_table.h @@ -17,23 +17,23 @@ namespace mojo { namespace system { -class CoreImpl; +class Core; class Dispatcher; class DispatcherTransport; // Test-only function (defined/used in embedder/test_embedder.cc). Declared here // so it can be friended. namespace internal { -bool ShutdownCheckNoLeaks(CoreImpl*); +bool ShutdownCheckNoLeaks(Core*); } -// This class provides the (global) handle table (owned by |CoreImpl|), which -// maps (valid) |MojoHandle|s to |Dispatcher|s. This is abstracted so that, -// e.g., caching may be added. +// This class provides the (global) handle table (owned by |Core|), which maps +// (valid) |MojoHandle|s to |Dispatcher|s. This is abstracted so that, e.g., +// caching may be added. // -// This class is NOT thread-safe; locking is left to |CoreImpl| (since it may -// need to make several changes -- "atomically" or in rapid successsion, in -// which case the extra locking/unlocking would be unnecessary overhead). +// This class is NOT thread-safe; locking is left to |Core| (since it may need +// to make several changes -- "atomically" or in rapid successsion, in which +// case the extra locking/unlocking would be unnecessary overhead). class MOJO_SYSTEM_IMPL_EXPORT HandleTable { public: @@ -44,8 +44,8 @@ class MOJO_SYSTEM_IMPL_EXPORT HandleTable { // |MOJO_HANDLE_INVALID|). Returns null if there's no dispatcher for the given // handle. // WARNING: For efficiency, this returns a dumb pointer. If you're going to - // use the result outside |CoreImpl|'s lock, you MUST take a reference (e.g., - // by storing the result inside a |scoped_refptr|). + // use the result outside |Core|'s lock, you MUST take a reference (e.g., by + // storing the result inside a |scoped_refptr|). Dispatcher* GetDispatcher(MojoHandle handle); // On success, gets the dispatcher for a given handle (which should not be @@ -98,7 +98,7 @@ class MOJO_SYSTEM_IMPL_EXPORT HandleTable { void RestoreBusyHandles(const MojoHandle* handles, uint32_t num_handles); private: - friend bool internal::ShutdownCheckNoLeaks(CoreImpl*); + friend bool internal::ShutdownCheckNoLeaks(Core*); struct Entry { Entry(); diff --git a/mojo/system/mapping_table.cc b/mojo/system/mapping_table.cc index 39b79bc..a6e5bb3 100644 --- a/mojo/system/mapping_table.cc +++ b/mojo/system/mapping_table.cc @@ -16,7 +16,7 @@ MappingTable::MappingTable() { MappingTable::~MappingTable() { // This should usually not be reached (the only instance should be owned by - // the singleton |CoreImpl|, which lives forever), except in tests. + // the singleton |Core|, which lives forever), except in tests. } MojoResult MappingTable::AddMapping( diff --git a/mojo/system/mapping_table.h b/mojo/system/mapping_table.h index bbae097..1b14890 100644 --- a/mojo/system/mapping_table.h +++ b/mojo/system/mapping_table.h @@ -18,20 +18,19 @@ namespace mojo { namespace system { -class CoreImpl; +class Core; class RawSharedBufferMapping; // Test-only function (defined/used in embedder/test_embedder.cc). Declared here // so it can be friended. namespace internal { -bool ShutdownCheckNoLeaks(CoreImpl*); +bool ShutdownCheckNoLeaks(Core*); } -// This class provides the (global) table of memory mappings (owned by -// |CoreImpl|), which maps mapping base addresses to -// |RawSharedBuffer::Mapping|s. +// This class provides the (global) table of memory mappings (owned by |Core|), +// which maps mapping base addresses to |RawSharedBuffer::Mapping|s. // -// This class is NOT thread-safe; locking is left to |CoreImpl|. +// This class is NOT thread-safe; locking is left to |Core|. class MOJO_SYSTEM_IMPL_EXPORT MappingTable { public: MappingTable(); @@ -43,7 +42,7 @@ class MOJO_SYSTEM_IMPL_EXPORT MappingTable { MojoResult RemoveMapping(void* address); private: - friend bool internal::ShutdownCheckNoLeaks(CoreImpl*); + friend bool internal::ShutdownCheckNoLeaks(Core*); typedef base::hash_map<uintptr_t, RawSharedBufferMapping*> AddressToMappingMap; diff --git a/mojo/system/message_pipe.cc b/mojo/system/message_pipe.cc index e450569..6f2e5cb 100644 --- a/mojo/system/message_pipe.cc +++ b/mojo/system/message_pipe.cc @@ -181,7 +181,7 @@ MojoResult MessagePipe::EnqueueMessage( // You're not allowed to send either handle to a message pipe over the // message pipe, so check for this. (The case of trying to write a handle to - // itself is taken care of by |CoreImpl|. That case kind of makes sense, but + // itself is taken care of by |Core|. That case kind of makes sense, but // leads to complications if, e.g., both sides try to do the same thing with // their respective handles simultaneously. The other case, of trying to // write the peer handle to a handle, doesn't make sense -- since no handle @@ -192,8 +192,8 @@ MojoResult MessagePipe::EnqueueMessage( if ((*transports)[i].GetType() == Dispatcher::kTypeMessagePipe) { MessagePipeDispatcherTransport mp_transport((*transports)[i]); if (mp_transport.GetMessagePipe() == this) { - // The other case should have been disallowed by |CoreImpl|. (Note: - // |port| is the peer port of the handle given to |WriteMessage()|.) + // The other case should have been disallowed by |Core|. (Note: |port| + // is the peer port of the handle given to |WriteMessage()|.) DCHECK_EQ(mp_transport.GetPort(), port); return MOJO_RESULT_INVALID_ARGUMENT; } diff --git a/mojo/system/message_pipe.h b/mojo/system/message_pipe.h index de42c44..85cce0a 100644 --- a/mojo/system/message_pipe.h +++ b/mojo/system/message_pipe.h @@ -24,9 +24,8 @@ class Channel; class Waiter; // |MessagePipe| is the secondary object implementing a message pipe (see the -// explanatory comment in core_impl.cc). It is typically owned by the -// dispatcher(s) corresponding to the local endpoints. This class is -// thread-safe. +// explanatory comment in core.cc). It is typically owned by the dispatcher(s) +// corresponding to the local endpoints. This class is thread-safe. class MOJO_SYSTEM_IMPL_EXPORT MessagePipe : public base::RefCountedThreadSafe<MessagePipe> { public: diff --git a/mojo/system/simple_dispatcher.h b/mojo/system/simple_dispatcher.h index d2934fa..15a64d5 100644 --- a/mojo/system/simple_dispatcher.h +++ b/mojo/system/simple_dispatcher.h @@ -17,8 +17,8 @@ namespace system { // A base class for simple dispatchers. "Simple" means that there's a one-to-one // correspondence between handles and dispatchers (see the explanatory comment -// in core_impl.cc). This class implements the standard waiter-signalling -// mechanism in that case. +// in core.cc). This class implements the standard waiter-signalling mechanism +// in that case. class MOJO_SYSTEM_IMPL_EXPORT SimpleDispatcher : public Dispatcher { protected: SimpleDispatcher(); diff --git a/mojo/system/waiter_list.h b/mojo/system/waiter_list.h index 1d35b94..f6a69ed 100644 --- a/mojo/system/waiter_list.h +++ b/mojo/system/waiter_list.h @@ -20,8 +20,8 @@ class Waiter; // handle/|Dispatcher|. There should be a |WaiterList| for each handle that can // be waited on (in any way). In the simple case, the |WaiterList| is owned by // the |Dispatcher|, whereas in more complex cases it is owned by the secondary -// object (see simple_dispatcher.* and the explanatory comment in core_impl.cc). -// This class is thread-unsafe (all concurrent access must be protected by some +// object (see simple_dispatcher.* and the explanatory comment in core.cc). This +// class is thread-unsafe (all concurrent access must be protected by some // lock). class MOJO_SYSTEM_IMPL_EXPORT WaiterList { public: |