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

Side by Side Diff: mojo/message_pump/handle_watcher.cc

Issue 2061433002: Roll base to 9e74307b276b2f9988005c0e97e85ee222586f79. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 years, 6 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 | « crypto/openssl_util.cc ('k') | net/cert/cert_database.h » ('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 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 #include "mojo/message_pump/handle_watcher.h" 5 #include "mojo/message_pump/handle_watcher.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 RequestData() : type(REQUEST_START), stop_id(0), stop_event(NULL) {} 182 RequestData() : type(REQUEST_START), stop_id(0), stop_event(NULL) {}
183 183
184 RequestType type; 184 RequestType type;
185 WatchData start_data; 185 WatchData start_data;
186 WatcherID stop_id; 186 WatcherID stop_id;
187 base::WaitableEvent* stop_event; 187 base::WaitableEvent* stop_event;
188 }; 188 };
189 189
190 typedef std::vector<RequestData> Requests; 190 typedef std::vector<RequestData> Requests;
191 191
192 friend struct DefaultSingletonTraits<WatcherThreadManager>; 192 friend struct base::DefaultSingletonTraits<WatcherThreadManager>;
193 193
194 WatcherThreadManager(); 194 WatcherThreadManager();
195 195
196 // Schedules a request on the background thread. See |requests_| for details. 196 // Schedules a request on the background thread. See |requests_| for details.
197 void AddRequest(const RequestData& data); 197 void AddRequest(const RequestData& data);
198 198
199 // Processes requests added to |requests_|. This is invoked on the backend 199 // Processes requests added to |requests_|. This is invoked on the backend
200 // thread. 200 // thread.
201 void ProcessRequestsOnBackendThread(); 201 void ProcessRequestsOnBackendThread();
202 202
(...skipping 11 matching lines...) Expand all
214 Requests requests_; 214 Requests requests_;
215 215
216 DISALLOW_COPY_AND_ASSIGN(WatcherThreadManager); 216 DISALLOW_COPY_AND_ASSIGN(WatcherThreadManager);
217 }; 217 };
218 218
219 WatcherThreadManager::~WatcherThreadManager() { 219 WatcherThreadManager::~WatcherThreadManager() {
220 thread_.Stop(); 220 thread_.Stop();
221 } 221 }
222 222
223 WatcherThreadManager* WatcherThreadManager::GetInstance() { 223 WatcherThreadManager* WatcherThreadManager::GetInstance() {
224 return Singleton<WatcherThreadManager>::get(); 224 return base::Singleton<WatcherThreadManager>::get();
225 } 225 }
226 226
227 WatcherID WatcherThreadManager::StartWatching( 227 WatcherID WatcherThreadManager::StartWatching(
228 const Handle& handle, 228 const Handle& handle,
229 MojoHandleSignals handle_signals, 229 MojoHandleSignals handle_signals,
230 base::TimeTicks deadline, 230 base::TimeTicks deadline,
231 const base::Callback<void(MojoResult)>& callback) { 231 const base::Callback<void(MojoResult)>& callback) {
232 RequestData request_data; 232 RequestData request_data;
233 request_data.type = REQUEST_START; 233 request_data.type = REQUEST_START;
234 request_data.start_data.id = watcher_id_generator_.GetNext(); 234 request_data.start_data.id = watcher_id_generator_.GetNext();
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 this, handle, handle_signals, deadline, callback)); 465 this, handle, handle_signals, deadline, callback));
466 } 466 }
467 } 467 }
468 468
469 void HandleWatcher::Stop() { 469 void HandleWatcher::Stop() {
470 state_.reset(); 470 state_.reset();
471 } 471 }
472 472
473 } // namespace common 473 } // namespace common
474 } // namespace mojo 474 } // namespace mojo
OLDNEW
« no previous file with comments | « crypto/openssl_util.cc ('k') | net/cert/cert_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698