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

Unified Diff: mojo/system/raw_channel.h

Issue 462563003: Mojo: Plumb "connection broken" out of RawChannel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
Index: mojo/system/raw_channel.h
diff --git a/mojo/system/raw_channel.h b/mojo/system/raw_channel.h
index 7c1fd314e5c6389480b0226a31eeb89dd37a13d4..c40f43c314069f2fce3565ba0369bfba55e0f4e9 100644
--- a/mojo/system/raw_channel.h
+++ b/mojo/system/raw_channel.h
@@ -51,6 +51,9 @@ class MOJO_SYSTEM_IMPL_EXPORT RawChannel {
enum Error {
// Failed read due to raw channel shutdown (e.g., on the other side).
ERROR_READ_SHUTDOWN,
+ // Failed read due to raw channel being broken (e.g., if the other side
+ // died without shutting down).
+ ERROR_READ_BROKEN,
// Received a bad message.
ERROR_READ_BAD_MESSAGE,
// Unknown read error.
@@ -115,6 +118,8 @@ class MOJO_SYSTEM_IMPL_EXPORT RawChannel {
IO_SUCCEEDED,
// Failed due to a (probably) clean shutdown (e.g., of the other end).
IO_FAILED_SHUTDOWN,
+ // Failed due to the connection being broken (e.g., the other end dying).
+ IO_FAILED_BROKEN,
// Failed due to some other (unexpected) reason.
IO_FAILED_UNKNOWN,
IO_PENDING
@@ -283,6 +288,9 @@ class MOJO_SYSTEM_IMPL_EXPORT RawChannel {
scoped_ptr<WriteBuffer> write_buffer) = 0;
private:
+ // Converts an |IO_FAILED_...| for a read to a |Delegate::Error|.
+ static Delegate::Error ReadIOResultToError(IOResult io_result);
+
// Calls |delegate_->OnError(error)|. Must be called on the I/O thread WITHOUT
// |write_lock_| held.
void CallOnError(Delegate::Error error);

Powered by Google App Engine
This is Rietveld 408576698