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

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

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

Powered by Google App Engine
This is Rietveld 408576698