OLD | NEW |
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/cpp/bindings/lib/message_queue.h" | 8 #include "mojo/public/cpp/bindings/lib/message_queue.h" |
9 #include "mojo/public/cpp/bindings/message.h" | 9 #include "mojo/public/cpp/bindings/message.h" |
10 #include "mojo/public/cpp/environment/default_async_waiter.h" | 10 #include "mojo/public/cpp/environment/default_async_waiter.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // Returns true if an error was encountered while reading from the pipe or | 52 // Returns true if an error was encountered while reading from the pipe or |
53 // waiting to read from the pipe. | 53 // waiting to read from the pipe. |
54 bool encountered_error() const { return error_; } | 54 bool encountered_error() const { return error_; } |
55 | 55 |
56 // Closes the pipe, triggering the error state. Connector is put into a | 56 // Closes the pipe, triggering the error state. Connector is put into a |
57 // quiescent state. | 57 // quiescent state. |
58 void CloseMessagePipe(); | 58 void CloseMessagePipe(); |
59 | 59 |
60 // Releases the pipe, not triggering the error state. Connector is put into | 60 // Releases the pipe, not triggering the error state. Connector is put into |
61 // a quiescent state. | 61 // a quiescent state. |
62 ScopedMessagePipeHandle ReleaseMessagePipe(); | 62 ScopedMessagePipeHandle PassMessagePipe(); |
63 | 63 |
64 // MessageReceiver implementation: | 64 // MessageReceiver implementation: |
65 virtual bool Accept(Message* message) MOJO_OVERRIDE; | 65 virtual bool Accept(Message* message) MOJO_OVERRIDE; |
66 | 66 |
67 private: | 67 private: |
68 static void CallOnHandleReady(void* closure, MojoResult result); | 68 static void CallOnHandleReady(void* closure, MojoResult result); |
69 void OnHandleReady(MojoResult result); | 69 void OnHandleReady(MojoResult result); |
70 | 70 |
71 void WaitToReadMore(); | 71 void WaitToReadMore(); |
72 void ReadMore(); | 72 void ReadMore(); |
73 | 73 |
74 ErrorHandler* error_handler_; | 74 ErrorHandler* error_handler_; |
75 MojoAsyncWaiter* waiter_; | 75 MojoAsyncWaiter* waiter_; |
76 | 76 |
77 ScopedMessagePipeHandle message_pipe_; | 77 ScopedMessagePipeHandle message_pipe_; |
78 MessageReceiver* incoming_receiver_; | 78 MessageReceiver* incoming_receiver_; |
79 | 79 |
80 MojoAsyncWaitID async_wait_id_; | 80 MojoAsyncWaitID async_wait_id_; |
81 bool error_; | 81 bool error_; |
82 bool drop_writes_; | 82 bool drop_writes_; |
83 bool enforce_errors_from_incoming_receiver_; | 83 bool enforce_errors_from_incoming_receiver_; |
84 | 84 |
85 MOJO_DISALLOW_COPY_AND_ASSIGN(Connector); | 85 MOJO_DISALLOW_COPY_AND_ASSIGN(Connector); |
86 }; | 86 }; |
87 | 87 |
88 } // namespace internal | 88 } // namespace internal |
89 } // namespace mojo | 89 } // namespace mojo |
90 | 90 |
91 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_ | 91 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_ |
OLD | NEW |