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

Side by Side Diff: base/message_loop/message_loop.cc

Issue 1479473002: base: Use std::move() instead of Pass() for real movable types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: basepass: missing-include Created 5 years 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 | « base/memory/shared_memory_posix.cc ('k') | base/message_loop/message_loop_test.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 "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
11 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop/message_pump_default.h" 15 #include "base/message_loop/message_pump_default.h"
15 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
16 #include "base/metrics/statistics_recorder.h" 17 #include "base/metrics/statistics_recorder.h"
17 #include "base/run_loop.h" 18 #include "base/run_loop.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 unbound_task_runner_->BindToCurrentThread(); 411 unbound_task_runner_->BindToCurrentThread();
411 unbound_task_runner_ = nullptr; 412 unbound_task_runner_ = nullptr;
412 SetThreadTaskRunnerHandle(); 413 SetThreadTaskRunnerHandle();
413 } 414 }
414 415
415 void MessageLoop::SetTaskRunner( 416 void MessageLoop::SetTaskRunner(
416 scoped_refptr<SingleThreadTaskRunner> task_runner) { 417 scoped_refptr<SingleThreadTaskRunner> task_runner) {
417 DCHECK_EQ(this, current()); 418 DCHECK_EQ(this, current());
418 DCHECK(task_runner->BelongsToCurrentThread()); 419 DCHECK(task_runner->BelongsToCurrentThread());
419 DCHECK(!unbound_task_runner_); 420 DCHECK(!unbound_task_runner_);
420 task_runner_ = task_runner.Pass(); 421 task_runner_ = std::move(task_runner);
421 SetThreadTaskRunnerHandle(); 422 SetThreadTaskRunnerHandle();
422 } 423 }
423 424
424 void MessageLoop::SetThreadTaskRunnerHandle() { 425 void MessageLoop::SetThreadTaskRunnerHandle() {
425 DCHECK_EQ(this, current()); 426 DCHECK_EQ(this, current());
426 // Clear the previous thread task runner first, because only one can exist at 427 // Clear the previous thread task runner first, because only one can exist at
427 // a time. 428 // a time.
428 thread_task_runner_handle_.reset(); 429 thread_task_runner_handle_.reset();
429 thread_task_runner_handle_.reset(new ThreadTaskRunnerHandle(task_runner_)); 430 thread_task_runner_handle_.reset(new ThreadTaskRunnerHandle(task_runner_));
430 } 431 }
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 persistent, 748 persistent,
748 mode, 749 mode,
749 controller, 750 controller,
750 delegate); 751 delegate);
751 } 752 }
752 #endif 753 #endif
753 754
754 #endif // !defined(OS_NACL_SFI) 755 #endif // !defined(OS_NACL_SFI)
755 756
756 } // namespace base 757 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/shared_memory_posix.cc ('k') | base/message_loop/message_loop_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698