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

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

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_proxy_impl.h" 5 #include "base/message_loop/message_loop_task_runner.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/incoming_task_queue.h" 9 #include "base/message_loop/incoming_task_queue.h"
10 #include "base/message_loop/message_loop.h"
11 10
12 namespace base { 11 namespace base {
13 namespace internal { 12 namespace internal {
14 13
15 MessageLoopProxyImpl::MessageLoopProxyImpl( 14 MessageLoopTaskRunner::MessageLoopTaskRunner(
16 scoped_refptr<IncomingTaskQueue> incoming_queue) 15 scoped_refptr<IncomingTaskQueue> incoming_queue)
17 : incoming_queue_(incoming_queue), 16 : incoming_queue_(incoming_queue), valid_thread_id_(kInvalidThreadId) {}
18 valid_thread_id_(kInvalidThreadId) {
19 }
20 17
21 void MessageLoopProxyImpl::BindToCurrentThread() { 18 void MessageLoopTaskRunner::BindToCurrentThread() {
22 AutoLock lock(valid_thread_id_lock_); 19 AutoLock lock(valid_thread_id_lock_);
23 DCHECK_EQ(kInvalidThreadId, valid_thread_id_); 20 DCHECK_EQ(kInvalidThreadId, valid_thread_id_);
24 valid_thread_id_ = PlatformThread::CurrentId(); 21 valid_thread_id_ = PlatformThread::CurrentId();
25 } 22 }
26 23
27 bool MessageLoopProxyImpl::PostDelayedTask( 24 bool MessageLoopTaskRunner::PostDelayedTask(
28 const tracked_objects::Location& from_here, 25 const tracked_objects::Location& from_here,
29 const base::Closure& task, 26 const base::Closure& task,
30 base::TimeDelta delay) { 27 base::TimeDelta delay) {
31 DCHECK(!task.is_null()) << from_here.ToString(); 28 DCHECK(!task.is_null()) << from_here.ToString();
32 return incoming_queue_->AddToIncomingQueue(from_here, task, delay, true); 29 return incoming_queue_->AddToIncomingQueue(from_here, task, delay, true);
33 } 30 }
34 31
35 bool MessageLoopProxyImpl::PostNonNestableDelayedTask( 32 bool MessageLoopTaskRunner::PostNonNestableDelayedTask(
36 const tracked_objects::Location& from_here, 33 const tracked_objects::Location& from_here,
37 const base::Closure& task, 34 const base::Closure& task,
38 base::TimeDelta delay) { 35 base::TimeDelta delay) {
39 DCHECK(!task.is_null()) << from_here.ToString(); 36 DCHECK(!task.is_null()) << from_here.ToString();
40 return incoming_queue_->AddToIncomingQueue(from_here, task, delay, false); 37 return incoming_queue_->AddToIncomingQueue(from_here, task, delay, false);
41 } 38 }
42 39
43 bool MessageLoopProxyImpl::RunsTasksOnCurrentThread() const { 40 bool MessageLoopTaskRunner::RunsTasksOnCurrentThread() const {
44 AutoLock lock(valid_thread_id_lock_); 41 AutoLock lock(valid_thread_id_lock_);
45 return valid_thread_id_ == PlatformThread::CurrentId(); 42 return valid_thread_id_ == PlatformThread::CurrentId();
46 } 43 }
47 44
48 MessageLoopProxyImpl::~MessageLoopProxyImpl() { 45 MessageLoopTaskRunner::~MessageLoopTaskRunner() {}
49 }
50 46
51 } // namespace internal 47 } // namespace internal
52 48
53 scoped_refptr<MessageLoopProxy>
54 MessageLoopProxy::current() {
55 MessageLoop* cur_loop = MessageLoop::current();
56 if (!cur_loop)
57 return NULL;
58 return cur_loop->message_loop_proxy();
59 }
60
61 } // namespace base 49 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop/message_loop_task_runner.h ('k') | base/message_loop/message_loop_task_runner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698