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

Side by Side Diff: mojo/public/cpp/bindings/lib/multiplex_router.h

Issue 2165153002: Mojo C++ bindings: fix Pause/Resume for MultiplexRouter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/multiplex_router.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_MULTIPLEX_ROUTER_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MULTIPLEX_ROUTER_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_MULTIPLEX_ROUTER_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_MULTIPLEX_ROUTER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <deque> 10 #include <deque>
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 return connector_.PassMessagePipe(); 95 return connector_.PassMessagePipe();
96 } 96 }
97 97
98 // Blocks the current thread until the first incoming message, or |deadline|. 98 // Blocks the current thread until the first incoming message, or |deadline|.
99 bool WaitForIncomingMessage(MojoDeadline deadline) { 99 bool WaitForIncomingMessage(MojoDeadline deadline) {
100 DCHECK(thread_checker_.CalledOnValidThread()); 100 DCHECK(thread_checker_.CalledOnValidThread());
101 return connector_.WaitForIncomingMessage(deadline); 101 return connector_.WaitForIncomingMessage(deadline);
102 } 102 }
103 103
104 // See Binding for details of pause/resume. 104 // See Binding for details of pause/resume.
105 void PauseIncomingMethodCallProcessing() { 105 void PauseIncomingMethodCallProcessing();
106 DCHECK(thread_checker_.CalledOnValidThread()); 106 void ResumeIncomingMethodCallProcessing();
107 connector_.PauseIncomingMethodCallProcessing();
108 }
109 void ResumeIncomingMethodCallProcessing() {
110 DCHECK(thread_checker_.CalledOnValidThread());
111 connector_.ResumeIncomingMethodCallProcessing();
112 }
113 107
114 // Whether there are any associated interfaces running currently. 108 // Whether there are any associated interfaces running currently.
115 bool HasAssociatedEndpoints() const; 109 bool HasAssociatedEndpoints() const;
116 110
117 // Sets this object to testing mode. 111 // Sets this object to testing mode.
118 // In testing mode, the object doesn't disconnect the underlying message pipe 112 // In testing mode, the object doesn't disconnect the underlying message pipe
119 // when it receives unexpected or invalid messages. 113 // when it receives unexpected or invalid messages.
120 void EnableTestingMode(); 114 void EnableTestingMode();
121 115
122 // Is the router bound to a message pipe handle? 116 // Is the router bound to a message pipe handle?
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 216
223 std::deque<std::unique_ptr<Task>> tasks_; 217 std::deque<std::unique_ptr<Task>> tasks_;
224 // It refers to tasks in |tasks_| and doesn't own any of them. 218 // It refers to tasks in |tasks_| and doesn't own any of them.
225 std::map<InterfaceId, std::deque<Task*>> sync_message_tasks_; 219 std::map<InterfaceId, std::deque<Task*>> sync_message_tasks_;
226 220
227 bool posted_to_process_tasks_; 221 bool posted_to_process_tasks_;
228 scoped_refptr<base::SingleThreadTaskRunner> posted_to_task_runner_; 222 scoped_refptr<base::SingleThreadTaskRunner> posted_to_task_runner_;
229 223
230 bool encountered_error_; 224 bool encountered_error_;
231 225
226 bool paused_;
227
232 bool testing_mode_; 228 bool testing_mode_;
233 229
234 DISALLOW_COPY_AND_ASSIGN(MultiplexRouter); 230 DISALLOW_COPY_AND_ASSIGN(MultiplexRouter);
235 }; 231 };
236 232
237 } // namespace internal 233 } // namespace internal
238 } // namespace mojo 234 } // namespace mojo
239 235
240 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MULTIPLEX_ROUTER_H_ 236 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MULTIPLEX_ROUTER_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/multiplex_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698