| Index: mojo/edk/system/raw_channel.h
|
| diff --git a/mojo/edk/system/raw_channel.h b/mojo/edk/system/raw_channel.h
|
| index f567767119966a66f3815fc612c9ee3a631fd5f9..ab4dc30d6dbd0c6af18e84c5c885cd63564b2283 100644
|
| --- a/mojo/edk/system/raw_channel.h
|
| +++ b/mojo/edk/system/raw_channel.h
|
| @@ -41,6 +41,8 @@ namespace system {
|
| // on which |Init()| is called).
|
| class MOJO_SYSTEM_IMPL_EXPORT RawChannel {
|
| public:
|
| + // This object may be destroyed on any thread (if |Init()| was called, after
|
| + // |Shutdown()| was called).
|
| virtual ~RawChannel();
|
|
|
| // The |Delegate| is only accessed on the same thread as the message loop
|
| @@ -61,14 +63,14 @@ class MOJO_SYSTEM_IMPL_EXPORT RawChannel {
|
| ERROR_WRITE
|
| };
|
|
|
| - // Called when a message is read. This may call |Shutdown()| (on the
|
| - // |RawChannel|), but must not destroy it.
|
| + // Called when a message is read. This may call the |RawChannel|'s
|
| + // |Shutdown()| and then (if desired) destroy it.
|
| virtual void OnReadMessage(
|
| const MessageInTransit::View& message_view,
|
| embedder::ScopedPlatformHandleVectorPtr platform_handles) = 0;
|
|
|
| - // Called when there's a (fatal) error. This may call the raw channel's
|
| - // |Shutdown()|, but must not destroy it.
|
| + // Called when there's a (fatal) error. This may call the |RawChannel|'s
|
| + // |Shutdown()| and then (if desired) destroy it.
|
| //
|
| // For each raw channel, there'll be at most one |ERROR_READ_...| and at
|
| // most one |ERROR_WRITE| notification. After |OnError(ERROR_READ_...)|,
|
| @@ -197,10 +199,10 @@ class MOJO_SYSTEM_IMPL_EXPORT RawChannel {
|
| RawChannel();
|
|
|
| // |result| must not be |IO_PENDING|. Must be called on the I/O thread WITHOUT
|
| - // |write_lock_| held.
|
| + // |write_lock_| held. This object may be destroyed by this call.
|
| void OnReadCompleted(IOResult io_result, size_t bytes_read);
|
| // |result| must not be |IO_PENDING|. Must be called on the I/O thread WITHOUT
|
| - // |write_lock_| held.
|
| + // |write_lock_| held. This object may be destroyed by this call.
|
| void OnWriteCompleted(IOResult io_result,
|
| size_t platform_handles_written,
|
| size_t bytes_written);
|
| @@ -308,7 +310,7 @@ class MOJO_SYSTEM_IMPL_EXPORT RawChannel {
|
|
|
| // Only used on the I/O thread:
|
| Delegate* delegate_;
|
| - bool read_stopped_;
|
| + bool* set_on_shutdown_;
|
| scoped_ptr<ReadBuffer> read_buffer_;
|
|
|
| base::Lock write_lock_; // Protects the following members.
|
|
|