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

Side by Side Diff: mojo/public/cpp/bindings/lib/router.h

Issue 265793015: Mojo: Replace RemotePtr with InterfacePtr and InterfaceImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: snapshot Created 6 years, 7 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 | Annotate | Revision Log
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 MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "mojo/public/cpp/bindings/lib/connector.h" 10 #include "mojo/public/cpp/bindings/lib/connector.h"
11 #include "mojo/public/cpp/bindings/lib/shared_data.h" 11 #include "mojo/public/cpp/bindings/lib/shared_data.h"
12 12
13 namespace mojo { 13 namespace mojo {
14 namespace internal { 14 namespace internal {
15 15
16 class Router : public MessageReceiver { 16 class Router : public MessageReceiver {
17 public: 17 public:
18 // The Router takes ownership of |message_pipe|. 18 // The Router takes ownership of |message_pipe|.
19 explicit Router(ScopedMessagePipeHandle message_pipe, 19 explicit Router(ScopedMessagePipeHandle message_pipe,
20 MojoAsyncWaiter* waiter = GetDefaultAsyncWaiter()); 20 MojoAsyncWaiter* waiter = GetDefaultAsyncWaiter());
21 virtual ~Router(); 21 virtual ~Router();
22 22
23 // Sets the receiver to handle messages read from the message pipe that do 23 // Sets the receiver to handle messages read from the message pipe that do
24 // not have the kMessageIsResponse flag set. 24 // not have the kMessageIsResponse flag set.
25 void set_incoming_receiver(MessageReceiver* receiver) { 25 void set_incoming_receiver(MessageReceiver* receiver) {
26 incoming_receiver_ = receiver; 26 incoming_receiver_ = receiver;
27 } 27 }
28 MessageReceiver* incoming_receiver() { return incoming_receiver_; }
28 29
29 // Sets the error handler to receive notifications when an error is 30 // Sets the error handler to receive notifications when an error is
30 // encountered while reading from the pipe or waiting to read from the pipe. 31 // encountered while reading from the pipe or waiting to read from the pipe.
31 void set_error_handler(ErrorHandler* error_handler) { 32 void set_error_handler(ErrorHandler* error_handler) {
32 connector_.set_error_handler(error_handler); 33 connector_.set_error_handler(error_handler);
33 } 34 }
34 35
35 // Returns true if an error was encountered while reading from the pipe or 36 // Returns true if an error was encountered while reading from the pipe or
36 // waiting to read from the pipe. 37 // waiting to read from the pipe.
37 bool encountered_error() const { return connector_.encountered_error(); } 38 bool encountered_error() const { return connector_.encountered_error(); }
(...skipping 26 matching lines...) Expand all
64 MessageReceiver* incoming_receiver_; 65 MessageReceiver* incoming_receiver_;
65 HandleIncomingMessageThunk thunk_; 66 HandleIncomingMessageThunk thunk_;
66 ResponderMap responders_; 67 ResponderMap responders_;
67 uint64_t next_request_id_; 68 uint64_t next_request_id_;
68 }; 69 };
69 70
70 } // namespace internal 71 } // namespace internal
71 } // namespace mojo 72 } // namespace mojo
72 73
73 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ 74 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698