| Index: mojo/edk/system/wait_set_dispatcher.h
|
| diff --git a/third_party/mojo/src/mojo/edk/system/wait_set_dispatcher.h b/mojo/edk/system/wait_set_dispatcher.h
|
| similarity index 61%
|
| copy from third_party/mojo/src/mojo/edk/system/wait_set_dispatcher.h
|
| copy to mojo/edk/system/wait_set_dispatcher.h
|
| index a53f61a1bef12cd8f58b6351dafe517cfb5ff08e..3e3279d1f44c00e8ceab8066f5fb59931762774f 100644
|
| --- a/third_party/mojo/src/mojo/edk/system/wait_set_dispatcher.h
|
| +++ b/mojo/edk/system/wait_set_dispatcher.h
|
| @@ -2,27 +2,26 @@
|
| // 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_WAIT_SET_DISPATCHER_H_
|
| -#define THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_WAIT_SET_DISPATCHER_H_
|
| +#ifndef MOJO_EDK_SYSTEM_WAIT_SET_DISPATCHER_H_
|
| +#define MOJO_EDK_SYSTEM_WAIT_SET_DISPATCHER_H_
|
|
|
| #include <deque>
|
| #include <map>
|
| #include <utility>
|
|
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/synchronization/lock.h"
|
| +#include "mojo/edk/system/awakable_list.h"
|
| +#include "mojo/edk/system/dispatcher.h"
|
| +#include "mojo/edk/system/system_impl_export.h"
|
| #include "mojo/public/cpp/system/macros.h"
|
| -#include "third_party/mojo/src/mojo/edk/system/awakable_list.h"
|
| -#include "third_party/mojo/src/mojo/edk/system/dispatcher.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 system {
|
| +namespace edk {
|
|
|
| class MOJO_SYSTEM_IMPL_EXPORT WaitSetDispatcher : public Dispatcher {
|
| public:
|
| WaitSetDispatcher();
|
| - ~WaitSetDispatcher() override;
|
|
|
| // |Dispatcher| public methods:
|
| Type GetType() const override;
|
| @@ -32,11 +31,16 @@ class MOJO_SYSTEM_IMPL_EXPORT WaitSetDispatcher : public Dispatcher {
|
| class Waiter;
|
|
|
| struct WaitState {
|
| + WaitState();
|
| + ~WaitState();
|
| +
|
| scoped_refptr<Dispatcher> dispatcher;
|
| MojoHandleSignals signals;
|
| uintptr_t context;
|
| };
|
|
|
| + ~WaitSetDispatcher() override;
|
| +
|
| // |Dispatcher| protected methods:
|
| void CloseImplNoLock() override;
|
| void CancelAllAwakablesNoLock() override;
|
| @@ -52,11 +56,10 @@ class MOJO_SYSTEM_IMPL_EXPORT WaitSetDispatcher : public Dispatcher {
|
| uintptr_t context) override;
|
| MojoResult RemoveWaitingDispatcherImplNoLock(
|
| const scoped_refptr<Dispatcher>& dispatcher) override;
|
| - MojoResult GetReadyDispatchersImplNoLock(
|
| - UserPointer<uint32_t> count,
|
| - DispatcherVector* dispatchers,
|
| - UserPointer<MojoResult> results,
|
| - UserPointer<uintptr_t> contexts) override;
|
| + MojoResult GetReadyDispatchersImplNoLock(uint32_t* count,
|
| + DispatcherVector* dispatchers,
|
| + MojoResult* results,
|
| + uintptr_t* contexts) override;
|
| HandleSignalsState GetHandleSignalsStateImplNoLock() const override;
|
| scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock()
|
| override;
|
| @@ -67,28 +70,26 @@ class MOJO_SYSTEM_IMPL_EXPORT WaitSetDispatcher : public Dispatcher {
|
|
|
| // Map of dispatchers being waited on. Key is a Dispatcher* casted to a
|
| // uintptr_t, and should be treated as an opaque value and not casted back.
|
| - std::map<uintptr_t, WaitState> waiting_dispatchers_ MOJO_GUARDED_BY(mutex());
|
| + std::map<uintptr_t, WaitState> waiting_dispatchers_;
|
|
|
| - // Separate mutex that can be locked without locking |mutex()|.
|
| - mutable Mutex awoken_mutex_ MOJO_ACQUIRED_AFTER(mutex());
|
| + // Separate lock that can be locked without locking |lock()|.
|
| + mutable base::Lock awoken_lock_;
|
| // List of dispatchers that have been woken up. Any dispatcher in this queue
|
| // will NOT currently be waited on.
|
| - std::deque<std::pair<uintptr_t, MojoResult>> awoken_queue_
|
| - MOJO_GUARDED_BY(awoken_mutex_);
|
| - // List of dispatchers that have been woken up and retrieved on the last call
|
| - // to |GetReadyDispatchers()|.
|
| - std::deque<uintptr_t> processed_dispatchers_ MOJO_GUARDED_BY(awoken_mutex_);
|
| -
|
| - // Separate mutex that can be locked without locking |mutex()|.
|
| - Mutex awakable_mutex_ MOJO_ACQUIRED_AFTER(mutex());
|
| + std::deque<std::pair<uintptr_t, MojoResult>> awoken_queue_;
|
| + // List of dispatchers that have been woken up and retrieved.
|
| + std::deque<uintptr_t> processed_dispatchers_;
|
| +
|
| + // Separate lock that can be locked without locking |lock()|.
|
| + base::Lock awakable_lock_;
|
| // List of dispatchers being waited on.
|
| - AwakableList awakable_list_ MOJO_GUARDED_BY(awakable_mutex_);
|
| + AwakableList awakable_list_;
|
|
|
| // Waiter used to wait on dispatchers.
|
| scoped_ptr<Waiter> waiter_;
|
| };
|
|
|
| -} // namespace system
|
| +} // namespace edk
|
| } // namespace mojo
|
|
|
| -#endif // THIRD_PARTY_MOJO_SRC_MOJO_EDK_SYSTEM_WAIT_SET_DISPATCHER_H_
|
| +#endif // MOJO_EDK_SYSTEM_WAIT_SET_DISPATCHER_H_
|
|
|