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

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

Issue 1647803004: Move base to DEPS (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
(Empty)
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.
4
5 #include "base/message_loop/message_loop_task_runner.h"
6
7 #include "base/location.h"
8 #include "base/logging.h"
9 #include "base/message_loop/incoming_task_queue.h"
10
11 namespace base {
12 namespace internal {
13
14 MessageLoopTaskRunner::MessageLoopTaskRunner(
15 scoped_refptr<IncomingTaskQueue> incoming_queue)
16 : incoming_queue_(incoming_queue), valid_thread_id_(kInvalidThreadId) {}
17
18 void MessageLoopTaskRunner::BindToCurrentThread() {
19 AutoLock lock(valid_thread_id_lock_);
20 DCHECK_EQ(kInvalidThreadId, valid_thread_id_);
21 valid_thread_id_ = PlatformThread::CurrentId();
22 }
23
24 bool MessageLoopTaskRunner::PostDelayedTask(
25 const tracked_objects::Location& from_here,
26 const base::Closure& task,
27 base::TimeDelta delay) {
28 DCHECK(!task.is_null()) << from_here.ToString();
29 return incoming_queue_->AddToIncomingQueue(from_here, task, delay, true);
30 }
31
32 bool MessageLoopTaskRunner::PostNonNestableDelayedTask(
33 const tracked_objects::Location& from_here,
34 const base::Closure& task,
35 base::TimeDelta delay) {
36 DCHECK(!task.is_null()) << from_here.ToString();
37 return incoming_queue_->AddToIncomingQueue(from_here, task, delay, false);
38 }
39
40 bool MessageLoopTaskRunner::RunsTasksOnCurrentThread() const {
41 AutoLock lock(valid_thread_id_lock_);
42 return valid_thread_id_ == PlatformThread::CurrentId();
43 }
44
45 MessageLoopTaskRunner::~MessageLoopTaskRunner() {}
46
47 } // namespace internal
48
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