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_BINDINGS_LIB_CONNECTOR_H_ | 5 #ifndef MOJO_PUBLIC_BINDINGS_LIB_CONNECTOR_H_ |
6 #define MOJO_PUBLIC_BINDINGS_LIB_CONNECTOR_H_ | 6 #define MOJO_PUBLIC_BINDINGS_LIB_CONNECTOR_H_ |
7 | 7 |
8 #include "mojo/public/bindings/lib/bindings_support.h" | 8 #include "mojo/public/bindings/lib/bindings_support.h" |
9 #include "mojo/public/bindings/lib/message.h" | 9 #include "mojo/public/bindings/lib/message.h" |
10 #include "mojo/public/bindings/lib/message_queue.h" | 10 #include "mojo/public/bindings/lib/message_queue.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // the message pipe. | 35 // the message pipe. |
36 bool EncounteredError() const { return error_; } | 36 bool EncounteredError() const { return error_; } |
37 | 37 |
38 // MessageReceiver implementation: | 38 // MessageReceiver implementation: |
39 virtual bool Accept(Message* message) MOJO_OVERRIDE; | 39 virtual bool Accept(Message* message) MOJO_OVERRIDE; |
40 | 40 |
41 private: | 41 private: |
42 class Callback : public BindingsSupport::AsyncWaitCallback { | 42 class Callback : public BindingsSupport::AsyncWaitCallback { |
43 public: | 43 public: |
44 Callback(); | 44 Callback(); |
| 45 virtual ~Callback(); |
45 | 46 |
46 void Cancel(); | |
47 void SetOwnerToNotify(Connector* owner); | 47 void SetOwnerToNotify(Connector* owner); |
48 bool IsPending() const; | 48 void SetAsyncWaitID(BindingsSupport::AsyncWaitID async_wait_id); |
49 | 49 |
50 virtual void OnHandleReady(MojoResult result) MOJO_OVERRIDE; | 50 virtual void OnHandleReady(MojoResult result) MOJO_OVERRIDE; |
51 | 51 |
52 private: | 52 private: |
53 Connector* owner_; | 53 Connector* owner_; |
| 54 BindingsSupport::AsyncWaitID async_wait_id_; |
54 }; | 55 }; |
55 friend class Callback; | 56 friend class Callback; |
56 | 57 |
57 void OnHandleReady(Callback* callback, MojoResult result); | 58 void OnHandleReady(Callback* callback, MojoResult result); |
58 void WaitToReadMore(); | 59 void WaitToReadMore(); |
59 void WaitToWriteMore(); | 60 void WaitToWriteMore(); |
60 void ReadMore(); | 61 void ReadMore(); |
61 void WriteMore(); | 62 void WriteMore(); |
62 void WriteOne(Message* message, bool* wait_to_write); | 63 void WriteOne(Message* message, bool* wait_to_write); |
63 | 64 |
64 Handle message_pipe_; | 65 Handle message_pipe_; |
65 MessageReceiver* incoming_receiver_; | 66 MessageReceiver* incoming_receiver_; |
66 MessageQueue write_queue_; | 67 MessageQueue write_queue_; |
67 | 68 |
68 Callback read_callback_; | 69 Callback read_callback_; |
69 Callback write_callback_; | 70 Callback write_callback_; |
70 | 71 |
71 bool error_; | 72 bool error_; |
| 73 |
| 74 MOJO_DISALLOW_COPY_AND_ASSIGN(Connector); |
72 }; | 75 }; |
73 | 76 |
74 } // namespace mojo | 77 } // namespace mojo |
75 | 78 |
76 #endif // MOJO_PUBLIC_BINDINGS_LIB_CONNECTOR_H_ | 79 #endif // MOJO_PUBLIC_BINDINGS_LIB_CONNECTOR_H_ |
OLD | NEW |