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

Unified Diff: third_party/mojo/src/mojo/edk/system/channel_endpoint.h

Issue 1309103002: Revert of Update mojo sdk to rev c02a28868825edfa57ab77947b8cb15e741c5598 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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: third_party/mojo/src/mojo/edk/system/channel_endpoint.h
diff --git a/third_party/mojo/src/mojo/edk/system/channel_endpoint.h b/third_party/mojo/src/mojo/edk/system/channel_endpoint.h
index c70e66ed368a0dc663c5527e684d821d47875720..807b1a8b3c96605cbabaac60a6ffad1638a5245c 100644
--- a/third_party/mojo/src/mojo/edk/system/channel_endpoint.h
+++ b/third_party/mojo/src/mojo/edk/system/channel_endpoint.h
@@ -7,9 +7,9 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/synchronization/lock.h"
#include "mojo/edk/system/channel_endpoint_id.h"
#include "mojo/edk/system/message_in_transit_queue.h"
-#include "mojo/edk/system/mutex.h"
#include "mojo/edk/system/system_impl_export.h"
#include "mojo/public/cpp/system/macros.h"
@@ -85,7 +85,7 @@
// shouldn't receive any more messages for that message pipe endpoint
// (local ID), but it must wait for the endpoint to detach. (It can't
// do so without a race, since it can't call into the message pipe
-// under |mutex_|.) [TODO(vtl): When I add remotely-allocated IDs,
+// under |lock_|.) [TODO(vtl): When I add remotely-allocated IDs,
// we'll have to remove the |EndpointInfo| from
// |local_id_to_endpoint_info_map_| -- i.e., remove the local ID,
// since it's no longer valid and may be reused by the remote side --
@@ -162,18 +162,19 @@
friend class base::RefCountedThreadSafe<ChannelEndpoint>;
~ChannelEndpoint();
- bool WriteMessageNoLock(scoped_ptr<MessageInTransit> message)
- MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
+ // Must be called with |lock_| held.
+ bool WriteMessageNoLock(scoped_ptr<MessageInTransit> message);
// Helper for |OnReadMessage()|, handling messages for the client.
void OnReadMessageForClient(scoped_ptr<MessageInTransit> message);
// Resets |channel_| to null (and sets |channel_state_| to
// |ChannelState::DETACHED|). This may only be called if |channel_| is
- // non-null.
- void ResetChannelNoLock() MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
-
- Mutex mutex_;
+ // non-null. Must be called with |lock_| held.
+ void ResetChannelNoLock();
+
+ // Protects the members below.
+ base::Lock lock_;
// |client_| must be valid whenever it is non-null. Before |*client_| gives up
// its reference to this object, it must call |DetachFromClient()|.
@@ -181,17 +182,14 @@
// |Channel| needs to keep the |MessagePipe| alive for the "proxy-proxy" case.
// Possibly we'll be able to eliminate that case when we have full
// multiprocess support.
- // WARNING: |ChannelEndpointClient| methods must not be called under |mutex_|.
- // Thus to make such a call, a reference must first be taken under |mutex_|
- // and the lock released.
- // TODO(vtl): Annotate the above rule using |MOJO_ACQUIRED_{BEFORE,AFTER}()|,
- // once clang actually checks such annotations.
- // https://github.com/domokit/mojo/issues/313
+ // WARNING: |ChannelEndpointClient| methods must not be called under |lock_|.
+ // Thus to make such a call, a reference must first be taken under |lock_| and
+ // the lock released.
// WARNING: Beware of interactions with |ReplaceClient()|. By the time the
// call is made, the client may have changed. This must be detected and dealt
// with.
- scoped_refptr<ChannelEndpointClient> client_ MOJO_GUARDED_BY(mutex_);
- unsigned client_port_ MOJO_GUARDED_BY(mutex_);
+ scoped_refptr<ChannelEndpointClient> client_;
+ unsigned client_port_;
// State with respect to interaction with the |Channel|.
enum class ChannelState {
@@ -203,17 +201,17 @@
// |DetachFromChannel()| has been called (|channel_| is null).
DETACHED
};
- ChannelState channel_state_ MOJO_GUARDED_BY(mutex_);
+ ChannelState channel_state_;
// |channel_| must be valid whenever it is non-null. Before |*channel_| gives
// up its reference to this object, it must call |DetachFromChannel()|.
// |local_id_| and |remote_id_| are valid if and only |channel_| is non-null.
- Channel* channel_ MOJO_GUARDED_BY(mutex_);
- ChannelEndpointId local_id_ MOJO_GUARDED_BY(mutex_);
- ChannelEndpointId remote_id_ MOJO_GUARDED_BY(mutex_);
+ Channel* channel_;
+ ChannelEndpointId local_id_;
+ ChannelEndpointId remote_id_;
// This queue is used before we're running on a channel and ready to send
// messages to the channel.
- MessageInTransitQueue channel_message_queue_ MOJO_GUARDED_BY(mutex_);
+ MessageInTransitQueue channel_message_queue_;
MOJO_DISALLOW_COPY_AND_ASSIGN(ChannelEndpoint);
};
« no previous file with comments | « third_party/mojo/src/mojo/edk/system/channel.cc ('k') | third_party/mojo/src/mojo/edk/system/channel_endpoint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698