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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // Sets the error handler to receive notifications when an error is | 46 // Sets the error handler to receive notifications when an error is |
47 // encountered while reading from the pipe or waiting to read from the pipe. | 47 // encountered while reading from the pipe or waiting to read from the pipe. |
48 void set_error_handler(ErrorHandler* error_handler) { | 48 void set_error_handler(ErrorHandler* error_handler) { |
49 error_handler_ = error_handler; | 49 error_handler_ = error_handler; |
50 } | 50 } |
51 | 51 |
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. | 56 // Closes the pipe, triggering the error state. Connector is put into a |
| 57 // quiescent state. |
57 void CloseMessagePipe(); | 58 void CloseMessagePipe(); |
58 | 59 |
| 60 // Releases the pipe, not triggering the error state. Connector is put into |
| 61 // a quiescent state. |
| 62 ScopedMessagePipeHandle ReleaseMessagePipe(); |
| 63 |
59 // MessageReceiver implementation: | 64 // MessageReceiver implementation: |
60 virtual bool Accept(Message* message) MOJO_OVERRIDE; | 65 virtual bool Accept(Message* message) MOJO_OVERRIDE; |
61 virtual bool AcceptWithResponder(Message* message, MessageReceiver* responder) | 66 virtual bool AcceptWithResponder(Message* message, MessageReceiver* responder) |
62 MOJO_OVERRIDE; | 67 MOJO_OVERRIDE; |
63 | 68 |
64 private: | 69 private: |
65 static void CallOnHandleReady(void* closure, MojoResult result); | 70 static void CallOnHandleReady(void* closure, MojoResult result); |
66 void OnHandleReady(MojoResult result); | 71 void OnHandleReady(MojoResult result); |
67 | 72 |
68 void WaitToReadMore(); | 73 void WaitToReadMore(); |
(...skipping 10 matching lines...) Expand all Loading... |
79 bool drop_writes_; | 84 bool drop_writes_; |
80 bool enforce_errors_from_incoming_receiver_; | 85 bool enforce_errors_from_incoming_receiver_; |
81 | 86 |
82 MOJO_DISALLOW_COPY_AND_ASSIGN(Connector); | 87 MOJO_DISALLOW_COPY_AND_ASSIGN(Connector); |
83 }; | 88 }; |
84 | 89 |
85 } // namespace internal | 90 } // namespace internal |
86 } // namespace mojo | 91 } // namespace mojo |
87 | 92 |
88 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_ | 93 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_ |
OLD | NEW |