Fix clank compilation errors in the relocation_packer.
[chromium-blink-merge.git] / base / message_loop / message_loop_proxy_impl.cc
blobb7abca377e668270d2f1db89f54c3731de577602
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
3 // found in the LICENSE file.
5 #include "base/message_loop/message_loop_proxy_impl.h"
7 #include "base/location.h"
8 #include "base/logging.h"
9 #include "base/message_loop/incoming_task_queue.h"
10 #include "base/message_loop/message_loop.h"
12 namespace base {
13 namespace internal {
15 MessageLoopProxyImpl::MessageLoopProxyImpl(
16 scoped_refptr<IncomingTaskQueue> incoming_queue)
17 : incoming_queue_(incoming_queue),
18 valid_thread_id_(PlatformThread::CurrentId()) {
21 bool MessageLoopProxyImpl::PostDelayedTask(
22 const tracked_objects::Location& from_here,
23 const base::Closure& task,
24 base::TimeDelta delay) {
25 DCHECK(!task.is_null()) << from_here.ToString();
26 return incoming_queue_->AddToIncomingQueue(from_here, task, delay, true);
29 bool MessageLoopProxyImpl::PostNonNestableDelayedTask(
30 const tracked_objects::Location& from_here,
31 const base::Closure& task,
32 base::TimeDelta delay) {
33 DCHECK(!task.is_null()) << from_here.ToString();
34 return incoming_queue_->AddToIncomingQueue(from_here, task, delay, false);
37 bool MessageLoopProxyImpl::RunsTasksOnCurrentThread() const {
38 return valid_thread_id_ == PlatformThread::CurrentId();
41 MessageLoopProxyImpl::~MessageLoopProxyImpl() {
44 } // namespace internal
46 scoped_refptr<MessageLoopProxy>
47 MessageLoopProxy::current() {
48 MessageLoop* cur_loop = MessageLoop::current();
49 if (!cur_loop)
50 return NULL;
51 return cur_loop->message_loop_proxy();
54 } // namespace base