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

Unified Diff: mojo/public/cpp/bindings/lib/multiplex_router.cc

Issue 2666423002: Assert sequence validity on non-thread-safe RefCount manipulations (2) (Closed)
Patch Set: rebase Created 3 years, 10 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 | « gpu/command_buffer/service/mailbox_manager_sync.cc ('k') | ppapi/shared_impl/proxy_lock.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/multiplex_router.cc
diff --git a/mojo/public/cpp/bindings/lib/multiplex_router.cc b/mojo/public/cpp/bindings/lib/multiplex_router.cc
index 2da459ae8f8ca5ee8704164bbeefaad3a93a2c88..005731ee4e207e24fa5f1a26634f21f25b2ae05e 100644
--- a/mojo/public/cpp/bindings/lib/multiplex_router.cc
+++ b/mojo/public/cpp/bindings/lib/multiplex_router.cc
@@ -431,6 +431,10 @@ InterfaceId MultiplexRouter::AssociateInterface(
uint32_t id = 0;
{
MayAutoLock locker(&lock_);
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // The lock above protects |endpoint|.
+ base::ScopedAllowCrossThreadRefCountAccess
yzshen1 2017/03/06 17:53:52 Can this opt-out be configured with a type (in thi
+ allow_cross_thread_ref_count_access;
do {
if (next_interface_id_value_ >= kInterfaceIdNamespaceMask)
next_interface_id_value_ = 1;
@@ -468,6 +472,10 @@ ScopedInterfaceEndpointHandle MultiplexRouter::CreateLocalEndpointHandle(
return ScopedInterfaceEndpointHandle();
MayAutoLock locker(&lock_);
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // The lock above protects |endpoint|.
+ base::ScopedAllowCrossThreadRefCountAccess
+ allow_cross_thread_ref_count_access;
bool inserted = false;
InterfaceEndpoint* endpoint = FindOrInsertEndpoint(id, &inserted);
if (inserted) {
@@ -496,6 +504,10 @@ void MultiplexRouter::CloseEndpointHandle(
return;
MayAutoLock locker(&lock_);
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // The lock above protects |endpoint|.
+ base::ScopedAllowCrossThreadRefCountAccess
+ allow_cross_thread_ref_count_access;
DCHECK(base::ContainsKey(endpoints_, id));
InterfaceEndpoint* endpoint = endpoints_[id].get();
DCHECK(!endpoint->client());
@@ -520,6 +532,10 @@ InterfaceEndpointController* MultiplexRouter::AttachEndpointClient(
DCHECK(client);
MayAutoLock locker(&lock_);
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // The lock above protects |endpoint|.
+ base::ScopedAllowCrossThreadRefCountAccess
+ allow_cross_thread_ref_count_access;
DCHECK(base::ContainsKey(endpoints_, id));
InterfaceEndpoint* endpoint = endpoints_[id].get();
@@ -692,6 +708,10 @@ void MultiplexRouter::OnPipeConnectionError() {
scoped_refptr<MultiplexRouter> protector(this);
MayAutoLock locker(&lock_);
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // The lock above protects |endpoint|.
+ base::ScopedAllowCrossThreadRefCountAccess
+ allow_cross_thread_ref_count_access;
encountered_error_ = true;
@@ -717,6 +737,10 @@ void MultiplexRouter::ProcessTasks(
ClientCallBehavior client_call_behavior,
base::SingleThreadTaskRunner* current_task_runner) {
AssertLockAcquired();
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // The lock above protects |endpoint|.
+ base::ScopedAllowCrossThreadRefCountAccess
+ allow_cross_thread_ref_count_access;
if (posted_to_process_tasks_)
return;
« no previous file with comments | « gpu/command_buffer/service/mailbox_manager_sync.cc ('k') | ppapi/shared_impl/proxy_lock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698