| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |