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

Side by Side Diff: ipc/mojo/ipc_message_pipe_reader.h

Issue 554363004: ChannelMojo: Handle errors in pending message processing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef IPC_IPC_MESSAGE_PIPE_READER_H_ 5 #ifndef IPC_IPC_MESSAGE_PIPE_READER_H_
6 #define IPC_IPC_MESSAGE_PIPE_READER_H_ 6 #define IPC_IPC_MESSAGE_PIPE_READER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "ipc/ipc_export.h"
11 #include "mojo/public/c/environment/async_waiter.h" 12 #include "mojo/public/c/environment/async_waiter.h"
12 #include "mojo/public/cpp/system/core.h" 13 #include "mojo/public/cpp/system/core.h"
13 14
14 namespace IPC { 15 namespace IPC {
15 namespace internal { 16 namespace internal {
16 17
17 // A helper class to handle bytestream directly over mojo::MessagePipe 18 // A helper class to handle bytestream directly over mojo::MessagePipe
18 // in template-method pattern. MessagePipeReader manages the lifetime 19 // in template-method pattern. MessagePipeReader manages the lifetime
19 // of given MessagePipe and participates the event loop, and 20 // of given MessagePipe and participates the event loop, and
20 // read the stream and call the client when it is ready. 21 // read the stream and call the client when it is ready.
21 // 22 //
22 // Each client has to: 23 // Each client has to:
23 // 24 //
24 // * Provide a subclass implemenation of a specific use of a MessagePipe 25 // * Provide a subclass implemenation of a specific use of a MessagePipe
25 // and implement callbacks. 26 // and implement callbacks.
26 // * Create the subclass instance with a MessagePipeHandle. 27 // * Create the subclass instance with a MessagePipeHandle.
27 // The constructor automatically start listening on the pipe. 28 // The constructor automatically start listening on the pipe.
28 // 29 //
29 // MessageReader has to be used in IO thread. It isn't thread-safe. 30 // MessageReader has to be used in IO thread. It isn't thread-safe.
30 // 31 //
31 class MessagePipeReader { 32 class IPC_MOJO_EXPORT MessagePipeReader {
32 public: 33 public:
33 // Delay the object deletion using the current message loop. 34 // Delay the object deletion using the current message loop.
34 // This is intended to used by MessagePipeReader owners. 35 // This is intended to used by MessagePipeReader owners.
35 class DelayedDeleter { 36 class DelayedDeleter {
36 public: 37 public:
37 typedef base::DefaultDeleter<MessagePipeReader> DefaultType; 38 typedef base::DefaultDeleter<MessagePipeReader> DefaultType;
38 39
39 static void DeleteNow(MessagePipeReader* ptr) { delete ptr; } 40 static void DeleteNow(MessagePipeReader* ptr) { delete ptr; }
40 41
41 DelayedDeleter() {} 42 DelayedDeleter() {}
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 MojoAsyncWaitID pipe_wait_id_; 90 MojoAsyncWaitID pipe_wait_id_;
90 mojo::ScopedMessagePipeHandle pipe_; 91 mojo::ScopedMessagePipeHandle pipe_;
91 92
92 DISALLOW_COPY_AND_ASSIGN(MessagePipeReader); 93 DISALLOW_COPY_AND_ASSIGN(MessagePipeReader);
93 }; 94 };
94 95
95 } // namespace internal 96 } // namespace internal
96 } // namespace IPC 97 } // namespace IPC
97 98
98 #endif // IPC_IPC_MESSAGE_PIPE_READER_H_ 99 #endif // IPC_IPC_MESSAGE_PIPE_READER_H_
OLDNEW
« ipc/mojo/ipc_channel_mojo_unittest.cc ('K') | « ipc/mojo/ipc_channel_mojo_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698