OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 CONTENT_COMMON_MESSAGE_PORT_H_ | 5 #ifndef CONTENT_COMMON_MESSAGE_PORT_H_ |
6 #define CONTENT_COMMON_MESSAGE_PORT_H_ | 6 #define CONTENT_COMMON_MESSAGE_PORT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 // Clears any callback specified by a prior call to SetCallback. | 74 // Clears any callback specified by a prior call to SetCallback. |
75 void ClearCallback(); | 75 void ClearCallback(); |
76 | 76 |
77 private: | 77 private: |
78 class State : public base::RefCountedThreadSafe<State> { | 78 class State : public base::RefCountedThreadSafe<State> { |
79 public: | 79 public: |
80 State(); | 80 State(); |
81 State(mojo::ScopedMessagePipeHandle handle); | 81 State(mojo::ScopedMessagePipeHandle handle); |
82 | 82 |
83 void AddWatch(); | 83 void RegisterWatcher(); |
84 void CancelWatch(); | 84 void UnregisterWatcher(); |
85 static void OnHandleReady(uintptr_t context, | |
86 MojoResult result, | |
87 MojoHandleSignalsState signals_state, | |
88 MojoWatchNotificationFlags flags); | |
89 | 85 |
90 mojo::ScopedMessagePipeHandle handle_; | 86 mojo::ScopedMessagePipeHandle handle_; |
91 base::Closure callback_; | 87 base::Closure callback_; |
92 | 88 |
93 private: | 89 private: |
94 friend class base::RefCountedThreadSafe<State>; | 90 friend class base::RefCountedThreadSafe<State>; |
| 91 |
95 ~State(); | 92 ~State(); |
| 93 |
| 94 void ArmWatcher(); |
| 95 void OnHandleReady(MojoResult result); |
| 96 |
| 97 static void CallOnHandleReady(uintptr_t context, |
| 98 MojoResult result, |
| 99 MojoHandleSignalsState signals_state, |
| 100 MojoWatchNotificationFlags flags); |
96 }; | 101 }; |
97 mutable scoped_refptr<State> state_; | 102 mutable scoped_refptr<State> state_; |
98 }; | 103 }; |
99 | 104 |
100 } // namespace content | 105 } // namespace content |
101 | 106 |
102 #endif // CONTENT_COMMON_MESSAGE_PORT_H_ | 107 #endif // CONTENT_COMMON_MESSAGE_PORT_H_ |
OLD | NEW |