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

Unified Diff: third_party/mojo/src/mojo/edk/system/channel.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
« no previous file with comments | « third_party/mojo/src/mojo/edk/system/BUILD.gn ('k') | third_party/mojo/src/mojo/edk/system/channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/mojo/src/mojo/edk/system/channel.h
diff --git a/third_party/mojo/src/mojo/edk/system/channel.h b/third_party/mojo/src/mojo/edk/system/channel.h
index 9b7c3ae2badbfe0dd2fe3513096da8c37162007f..015fa7374093261e0cad9b45776a91176245a339 100644
--- a/third_party/mojo/src/mojo/edk/system/channel.h
+++ b/third_party/mojo/src/mojo/edk/system/channel.h
@@ -10,13 +10,13 @@
#include "base/containers/hash_tables.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
#include "mojo/edk/embedder/scoped_platform_handle.h"
#include "mojo/edk/system/channel_endpoint.h"
#include "mojo/edk/system/channel_endpoint_id.h"
#include "mojo/edk/system/incoming_endpoint.h"
#include "mojo/edk/system/message_in_transit.h"
-#include "mojo/edk/system/mutex.h"
#include "mojo/edk/system/raw_channel.h"
#include "mojo/edk/system/system_impl_export.h"
#include "mojo/public/c/system/types.h"
@@ -59,7 +59,7 @@
// This must be called on the creation thread before any other methods are
// called, and before references to this object are given to any other
// threads. |raw_channel| should be uninitialized.
- void Init(scoped_ptr<RawChannel> raw_channel) MOJO_NOT_THREAD_SAFE;
+ void Init(scoped_ptr<RawChannel> raw_channel);
// Sets the channel manager associated with this channel. This should be set
// at most once and only called before |WillShutdownSoon()| (and
@@ -220,51 +220,47 @@
ChannelEndpointId AttachAndRunEndpoint(
scoped_refptr<ChannelEndpoint> endpoint);
- // Helper to send channel control messages. Returns true on success. Callable
- // from any thread.
+ // Helper to send channel control messages. Returns true on success. Should be
+ // called *without* |lock_| held. Callable from any thread.
bool SendControlMessage(MessageInTransit::Subtype subtype,
ChannelEndpointId source_id,
- ChannelEndpointId destination_id)
- MOJO_LOCKS_EXCLUDED(mutex_);
+ ChannelEndpointId destination_id);
base::ThreadChecker creation_thread_checker_;
embedder::PlatformSupport* const platform_support_;
// Note: |ChannelEndpointClient|s (in particular, |MessagePipe|s) MUST NOT be
- // used under |mutex_|. E.g., |mutex_| can only be acquired after
+ // used under |lock_|. E.g., |lock_| can only be acquired after
// |MessagePipe::lock_|, never before. Thus to call into a
// |ChannelEndpointClient|, a reference should be acquired from
- // |local_id_to_endpoint_map_| under |mutex_| and then 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
- mutable Mutex mutex_;
-
- scoped_ptr<RawChannel> raw_channel_ MOJO_GUARDED_BY(mutex_);
- bool is_running_ MOJO_GUARDED_BY(mutex_);
+ // |local_id_to_endpoint_map_| under |lock_| and then the lock released.
+ base::Lock lock_; // Protects the members below.
+
+ scoped_ptr<RawChannel> raw_channel_;
+ bool is_running_;
// Set when |WillShutdownSoon()| is called.
- bool is_shutting_down_ MOJO_GUARDED_BY(mutex_);
+ bool is_shutting_down_;
// Has a reference to us.
- ChannelManager* channel_manager_ MOJO_GUARDED_BY(mutex_);
+ ChannelManager* channel_manager_;
using IdToEndpointMap =
base::hash_map<ChannelEndpointId, scoped_refptr<ChannelEndpoint>>;
// Map from local IDs to endpoints. If the endpoint is null, this means that
// we're just waiting for the remove ack before removing the entry.
- IdToEndpointMap local_id_to_endpoint_map_ MOJO_GUARDED_BY(mutex_);
+ IdToEndpointMap local_id_to_endpoint_map_;
// Note: The IDs generated by this should be checked for existence before use.
- LocalChannelEndpointIdGenerator local_id_generator_ MOJO_GUARDED_BY(mutex_);
+ LocalChannelEndpointIdGenerator local_id_generator_;
using IdToIncomingEndpointMap =
base::hash_map<ChannelEndpointId, scoped_refptr<IncomingEndpoint>>;
// Map from local IDs to incoming endpoints (i.e., those received inside other
// messages, but not yet claimed via |DeserializeEndpoint()|).
- IdToIncomingEndpointMap incoming_endpoints_ MOJO_GUARDED_BY(mutex_);
+ IdToIncomingEndpointMap incoming_endpoints_;
// TODO(vtl): We need to keep track of remote IDs (so that we don't collide
// if/when we wrap).
- RemoteChannelEndpointIdGenerator remote_id_generator_ MOJO_GUARDED_BY(mutex_);
+ RemoteChannelEndpointIdGenerator remote_id_generator_;
MOJO_DISALLOW_COPY_AND_ASSIGN(Channel);
};
« no previous file with comments | « third_party/mojo/src/mojo/edk/system/BUILD.gn ('k') | third_party/mojo/src/mojo/edk/system/channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698