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

Unified Diff: mojo/system/dispatcher.cc

Issue 227133013: Mojo: Dispatcher::MessageInTransitAccess functions don't need to take the lock. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | « mojo/system/dispatcher.h ('k') | mojo/system/message_in_transit.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/dispatcher.cc
diff --git a/mojo/system/dispatcher.cc b/mojo/system/dispatcher.cc
index 233c03f0b2af78f66b14f0839347e59628db46ff..d2fb6b5a1de7fd033afa1090dfb43b3dc23a8bae 100644
--- a/mojo/system/dispatcher.cc
+++ b/mojo/system/dispatcher.cc
@@ -353,7 +353,7 @@ void Dispatcher::RemoveWaiterImplNoLock(Waiter* /*waiter*/) {
size_t Dispatcher::GetMaximumSerializedSizeImplNoLock(
const Channel* /*channel*/) const {
- lock_.AssertAcquired();
+ DCHECK(HasOneRef()); // Only one ref => no need to take the lock.
DCHECK(!is_closed_);
// By default, serializing isn't supported.
return 0;
@@ -362,7 +362,7 @@ size_t Dispatcher::GetMaximumSerializedSizeImplNoLock(
bool Dispatcher::SerializeAndCloseImplNoLock(Channel* /*channel*/,
void* /*destination*/,
size_t* /*actual_size*/) {
- lock_.AssertAcquired();
+ DCHECK(HasOneRef()); // Only one ref => no need to take the lock.
DCHECK(is_closed_);
// By default, serializing isn't supported, so just close.
CloseImplNoLock();
@@ -398,9 +398,7 @@ Dispatcher::CreateEquivalentDispatcherAndCloseNoLock() {
size_t Dispatcher::GetMaximumSerializedSize(const Channel* channel) const {
DCHECK(channel);
- DCHECK(HasOneRef());
-
- base::AutoLock locker(lock_);
+ DCHECK(HasOneRef()); // Only one ref => no need to take the lock.
DCHECK(!is_closed_);
return GetMaximumSerializedSizeImplNoLock(channel);
}
@@ -411,9 +409,7 @@ bool Dispatcher::SerializeAndClose(Channel* channel,
DCHECK(destination);
DCHECK(channel);
DCHECK(actual_size);
- DCHECK(HasOneRef());
-
- base::AutoLock locker(lock_);
+ DCHECK(HasOneRef()); // Only one ref => no need to take the lock.
DCHECK(!is_closed_);
// We have to call |GetMaximumSerializedSizeImplNoLock()| first, because we
« no previous file with comments | « mojo/system/dispatcher.h ('k') | mojo/system/message_in_transit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698