summaryrefslogtreecommitdiffstats
path: root/mojo/edk
diff options
context:
space:
mode:
authoramistry <amistry@chromium.org>2016-03-02 21:56:04 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-03 05:58:12 +0000
commit92c31af975a12fa13e1743e326c8915a07aae078 (patch)
treec04f2d9efe49fc4ab6c01668b0ea55d3dbd1bc87 /mojo/edk
parent7ee64947b2b915e2014b88238ab8f810ded79a11 (diff)
downloadchromium_src-92c31af975a12fa13e1743e326c8915a07aae078.zip
chromium_src-92c31af975a12fa13e1743e326c8915a07aae078.tar.gz
chromium_src-92c31af975a12fa13e1743e326c8915a07aae078.tar.bz2
[mojo-edk] Avoid a recursive lock acquisition in data pipe.
BUG=None Review URL: https://codereview.chromium.org/1763643002 Cr-Commit-Position: refs/heads/master@{#378968}
Diffstat (limited to 'mojo/edk')
-rw-r--r--mojo/edk/system/data_pipe_consumer_dispatcher.cc6
-rw-r--r--mojo/edk/system/data_pipe_producer_dispatcher.cc5
2 files changed, 7 insertions, 4 deletions
diff --git a/mojo/edk/system/data_pipe_consumer_dispatcher.cc b/mojo/edk/system/data_pipe_consumer_dispatcher.cc
index 269f8b2..2dfddbc 100644
--- a/mojo/edk/system/data_pipe_consumer_dispatcher.cc
+++ b/mojo/edk/system/data_pipe_consumer_dispatcher.cc
@@ -484,6 +484,10 @@ void DataPipeConsumerDispatcher::NotifyRead(uint32_t num_bytes) {
}
void DataPipeConsumerDispatcher::OnPortStatusChanged() {
+ // This has to be outside |lock_| because the watch callback can call data
+ // pipe functions which then try to acquire |lock_|.
+ RequestContext request_context;
+
base::AutoLock lock(lock_);
// We stop observing the control port as soon it's transferred, but this can
@@ -498,8 +502,6 @@ void DataPipeConsumerDispatcher::OnPortStatusChanged() {
}
void DataPipeConsumerDispatcher::UpdateSignalsStateNoLock() {
- RequestContext request_context;
-
lock_.AssertAcquired();
bool was_peer_closed = peer_closed_;
diff --git a/mojo/edk/system/data_pipe_producer_dispatcher.cc b/mojo/edk/system/data_pipe_producer_dispatcher.cc
index 634fb68..0aa8f7e 100644
--- a/mojo/edk/system/data_pipe_producer_dispatcher.cc
+++ b/mojo/edk/system/data_pipe_producer_dispatcher.cc
@@ -462,6 +462,9 @@ void DataPipeProducerDispatcher::NotifyWrite(uint32_t num_bytes) {
}
void DataPipeProducerDispatcher::OnPortStatusChanged() {
+ // This has to be outside |lock_| because the watch callback can call data
+ // pipe functions which then try to acquire |lock_|.
+ RequestContext request_context;
base::AutoLock lock(lock_);
// We stop observing the control port as soon it's transferred, but this can
@@ -476,8 +479,6 @@ void DataPipeProducerDispatcher::OnPortStatusChanged() {
}
void DataPipeProducerDispatcher::UpdateSignalsStateNoLock() {
- RequestContext request_context;
-
lock_.AssertAcquired();
bool was_peer_closed = peer_closed_;