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

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

Issue 339403003: Mojo: Make GetDefault{AsyncWaiter,Logger} static methods of Environment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_CONNECTOR_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_
7 7
8 #include "mojo/public/c/environment/async_waiter.h"
8 #include "mojo/public/cpp/bindings/lib/message_queue.h" 9 #include "mojo/public/cpp/bindings/lib/message_queue.h"
9 #include "mojo/public/cpp/bindings/message.h" 10 #include "mojo/public/cpp/bindings/message.h"
10 #include "mojo/public/cpp/environment/default_async_waiter.h" 11 #include "mojo/public/cpp/environment/environment.h"
11 #include "mojo/public/cpp/system/core.h" 12 #include "mojo/public/cpp/system/core.h"
12 13
13 namespace mojo { 14 namespace mojo {
14 class ErrorHandler; 15 class ErrorHandler;
15 16
16 namespace internal { 17 namespace internal {
17 18
18 // The Connector class is responsible for performing read/write operations on a 19 // The Connector class is responsible for performing read/write operations on a
19 // MessagePipe. It writes messages it receives through the MessageReceiver 20 // MessagePipe. It writes messages it receives through the MessageReceiver
20 // interface that it subclasses, and it forwards messages it reads through the 21 // interface that it subclasses, and it forwards messages it reads through the
21 // MessageReceiver interface assigned as its incoming receiver. 22 // MessageReceiver interface assigned as its incoming receiver.
22 // 23 //
23 // NOTE: MessagePipe I/O is non-blocking. 24 // NOTE: MessagePipe I/O is non-blocking.
24 // 25 //
25 class Connector : public MessageReceiver { 26 class Connector : public MessageReceiver {
26 public: 27 public:
27 // The Connector takes ownership of |message_pipe|. 28 // The Connector takes ownership of |message_pipe|.
28 explicit Connector(ScopedMessagePipeHandle message_pipe, 29 explicit Connector(
29 const MojoAsyncWaiter* waiter = GetDefaultAsyncWaiter()); 30 ScopedMessagePipeHandle message_pipe,
31 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter());
30 virtual ~Connector(); 32 virtual ~Connector();
31 33
32 // Sets the receiver to handle messages read from the message pipe. The 34 // Sets the receiver to handle messages read from the message pipe. The
33 // Connector will read messages from the pipe regardless of whether or not an 35 // Connector will read messages from the pipe regardless of whether or not an
34 // incoming receiver has been set. 36 // incoming receiver has been set.
35 void set_incoming_receiver(MessageReceiver* receiver) { 37 void set_incoming_receiver(MessageReceiver* receiver) {
36 incoming_receiver_ = receiver; 38 incoming_receiver_ = receiver;
37 } 39 }
38 40
39 // Errors from incoming receivers will force the connector into an error 41 // Errors from incoming receivers will force the connector into an error
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // of dispatching an incoming message. 91 // of dispatching an incoming message.
90 bool* destroyed_flag_; 92 bool* destroyed_flag_;
91 93
92 MOJO_DISALLOW_COPY_AND_ASSIGN(Connector); 94 MOJO_DISALLOW_COPY_AND_ASSIGN(Connector);
93 }; 95 };
94 96
95 } // namespace internal 97 } // namespace internal
96 } // namespace mojo 98 } // namespace mojo
97 99
98 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_ 100 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/interface_ptr.h ('k') | mojo/public/cpp/bindings/lib/interface_impl_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698