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

Unified Diff: mojo/edk/system/raw_channel_posix.cc

Issue 1403033003: Last set of fixes to make the src/mojo/edk pass the page cycler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes now that OnError can be called multiple times Created 5 years, 2 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: mojo/edk/system/raw_channel_posix.cc
diff --git a/mojo/edk/system/raw_channel_posix.cc b/mojo/edk/system/raw_channel_posix.cc
index 8ea25ca437ed836a2531813fc76b5d4c69170443..4e97a119b13c3ce7e8b5f6d573a347076d02442a 100644
--- a/mojo/edk/system/raw_channel_posix.cc
+++ b/mojo/edk/system/raw_channel_posix.cc
@@ -369,7 +369,8 @@ void RawChannelPosix::OnFileCanReadWithoutBlocking(int fd) {
size_t bytes_read = 0;
IOResult io_result = Read(&bytes_read);
if (io_result != IO_PENDING) {
- OnReadCompleted(io_result, bytes_read);
+ base::AutoLock locker(read_lock());
+ OnReadCompletedNoLock(io_result, bytes_read);
// TODO(vtl): If we weren't destroyed, we'd like to do
//
// DCHECK(!read_watcher_ || pending_read_);
@@ -404,8 +405,9 @@ void RawChannelPosix::OnFileCanWriteWithoutBlocking(int fd) {
}
if (io_result != IO_PENDING) {
- OnWriteCompleted(io_result, platform_handles_written, bytes_written);
- return; // |this| may have been destroyed in |OnWriteCompleted()|.
+ base::AutoLock locker(write_lock());
+ OnWriteCompletedNoLock(io_result, platform_handles_written, bytes_written);
+ return;
}
}
@@ -463,14 +465,11 @@ void RawChannelPosix::WaitToWrite() {
if (!message_loop_for_io()->WatchFileDescriptor(
fd_.get().fd, false, base::MessageLoopForIO::WATCH_WRITE,
write_watcher_.get(), this)) {
- {
- base::AutoLock locker(write_lock());
-
- DCHECK(pending_write_);
- pending_write_ = false;
- }
- OnWriteCompleted(IO_FAILED_UNKNOWN, 0, 0);
- return; // |this| may have been destroyed in |OnWriteCompleted()|.
+ base::AutoLock locker(write_lock());
+ DCHECK(pending_write_);
+ pending_write_ = false;
+ OnWriteCompletedNoLock(IO_FAILED_UNKNOWN, 0, 0);
+ return;
}
}

Powered by Google App Engine
This is Rietveld 408576698