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

Side by Side Diff: content/common/message_port.h

Issue 2725133002: Mojo: Armed Watchers (Closed)
Patch Set: . Created 3 years, 9 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
OLDNEW
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698