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

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

Issue 2080923002: Remove calls to MessageLoop::current() in mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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 | « no previous file | no next file » | 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 } 270 }
271 271
272 // We outlive |thread_|, so it's safe to use Unretained() here. 272 // We outlive |thread_|, so it's safe to use Unretained() here.
273 thread_.task_runner()->PostTask( 273 thread_.task_runner()->PostTask(
274 FROM_HERE, 274 FROM_HERE,
275 base::Bind(&WatcherThreadManager::ProcessRequestsOnBackendThread, 275 base::Bind(&WatcherThreadManager::ProcessRequestsOnBackendThread,
276 base::Unretained(this))); 276 base::Unretained(this)));
277 } 277 }
278 278
279 void WatcherThreadManager::ProcessRequestsOnBackendThread() { 279 void WatcherThreadManager::ProcessRequestsOnBackendThread() {
280 DCHECK_EQ(thread_.message_loop(), base::MessageLoop::current()); 280 DCHECK(thread_.task_runner()->BelongsToCurrentThread());
281 281
282 Requests requests; 282 Requests requests;
283 { 283 {
284 base::AutoLock auto_lock(lock_); 284 base::AutoLock auto_lock(lock_);
285 requests_.swap(requests); 285 requests_.swap(requests);
286 } 286 }
287 for (size_t i = 0; i < requests.size(); ++i) { 287 for (size_t i = 0; i < requests.size(); ++i) {
288 if (requests[i].type == REQUEST_START) { 288 if (requests[i].type == REQUEST_START) {
289 backend_.StartWatching(requests[i].start_data); 289 backend_.StartWatching(requests[i].start_data);
290 } else { 290 } else {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 this, handle, handle_signals, deadline, callback)); 471 this, handle, handle_signals, deadline, callback));
472 } 472 }
473 } 473 }
474 474
475 void HandleWatcher::Stop() { 475 void HandleWatcher::Stop() {
476 state_.reset(); 476 state_.reset();
477 } 477 }
478 478
479 } // namespace common 479 } // namespace common
480 } // namespace mojo 480 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698