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

Side by Side Diff: jingle/glue/task_pump.cc

Issue 2082353002: Remove calls to deprecated MessageLoop methods in jingle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/single_thread_task_runner.h"
9 #include "jingle/glue/task_pump.h" 10 #include "jingle/glue/task_pump.h"
10 11
11 namespace jingle_glue { 12 namespace jingle_glue {
12 13
13 TaskPump::TaskPump() 14 TaskPump::TaskPump()
14 : posted_wake_(false), 15 : posted_wake_(false),
15 stopped_(false), 16 stopped_(false),
16 weak_factory_(this) { 17 weak_factory_(this) {
17 } 18 }
18 19
19 TaskPump::~TaskPump() { 20 TaskPump::~TaskPump() {
20 DCHECK(CalledOnValidThread()); 21 DCHECK(CalledOnValidThread());
21 } 22 }
22 23
23 void TaskPump::WakeTasks() { 24 void TaskPump::WakeTasks() {
24 DCHECK(CalledOnValidThread()); 25 DCHECK(CalledOnValidThread());
25 if (!stopped_ && !posted_wake_) { 26 if (!stopped_ && !posted_wake_) {
26 base::MessageLoop* current_message_loop = base::MessageLoop::current(); 27 base::MessageLoop* current_message_loop = base::MessageLoop::current();
27 CHECK(current_message_loop); 28 CHECK(current_message_loop);
28 // Do the requested wake up. 29 // Do the requested wake up.
29 current_message_loop->PostTask( 30 current_message_loop->task_runner()->PostTask(
30 FROM_HERE, 31 FROM_HERE,
31 base::Bind(&TaskPump::CheckAndRunTasks, weak_factory_.GetWeakPtr())); 32 base::Bind(&TaskPump::CheckAndRunTasks, weak_factory_.GetWeakPtr()));
32 posted_wake_ = true; 33 posted_wake_ = true;
33 } 34 }
34 } 35 }
35 36
36 int64_t TaskPump::CurrentTime() { 37 int64_t TaskPump::CurrentTime() {
37 DCHECK(CalledOnValidThread()); 38 DCHECK(CalledOnValidThread());
38 // Only timeout tasks rely on this function. Since we're not using 39 // Only timeout tasks rely on this function. Since we're not using
39 // libjingle tasks for timeout, it's safe to return 0 here. 40 // libjingle tasks for timeout, it's safe to return 0 here.
(...skipping 13 matching lines...) Expand all
53 // We shouldn't be using libjingle for timeout tasks, so we should 54 // We shouldn't be using libjingle for timeout tasks, so we should
54 // have no timeout tasks at all. 55 // have no timeout tasks at all.
55 56
56 // TODO(akalin): Add HasTimeoutTask() back in TaskRunner class and 57 // TODO(akalin): Add HasTimeoutTask() back in TaskRunner class and
57 // uncomment this check. 58 // uncomment this check.
58 // DCHECK(!HasTimeoutTask()) 59 // DCHECK(!HasTimeoutTask())
59 RunTasks(); 60 RunTasks();
60 } 61 }
61 62
62 } // namespace jingle_glue 63 } // namespace jingle_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698