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

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: use ThreadTaskRunnerHandle 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/threading/thread_task_runner_handle.h"
9 #include "jingle/glue/task_pump.h" 9 #include "jingle/glue/task_pump.h"
10 10
11 namespace jingle_glue { 11 namespace jingle_glue {
12 12
13 TaskPump::TaskPump() 13 TaskPump::TaskPump()
14 : posted_wake_(false), 14 : posted_wake_(false),
15 stopped_(false), 15 stopped_(false),
16 weak_factory_(this) { 16 weak_factory_(this) {
17 } 17 }
18 18
19 TaskPump::~TaskPump() { 19 TaskPump::~TaskPump() {
20 DCHECK(CalledOnValidThread()); 20 DCHECK(CalledOnValidThread());
21 } 21 }
22 22
23 void TaskPump::WakeTasks() { 23 void TaskPump::WakeTasks() {
24 DCHECK(CalledOnValidThread()); 24 DCHECK(CalledOnValidThread());
25 if (!stopped_ && !posted_wake_) { 25 if (!stopped_ && !posted_wake_) {
26 base::MessageLoop* current_message_loop = base::MessageLoop::current();
27 CHECK(current_message_loop);
28 // Do the requested wake up. 26 // Do the requested wake up.
29 current_message_loop->PostTask( 27 base::ThreadTaskRunnerHandle::Get()->PostTask(
30 FROM_HERE, 28 FROM_HERE,
31 base::Bind(&TaskPump::CheckAndRunTasks, weak_factory_.GetWeakPtr())); 29 base::Bind(&TaskPump::CheckAndRunTasks, weak_factory_.GetWeakPtr()));
32 posted_wake_ = true; 30 posted_wake_ = true;
33 } 31 }
34 } 32 }
35 33
36 int64_t TaskPump::CurrentTime() { 34 int64_t TaskPump::CurrentTime() {
37 DCHECK(CalledOnValidThread()); 35 DCHECK(CalledOnValidThread());
38 // Only timeout tasks rely on this function. Since we're not using 36 // Only timeout tasks rely on this function. Since we're not using
39 // libjingle tasks for timeout, it's safe to return 0 here. 37 // 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 51 // We shouldn't be using libjingle for timeout tasks, so we should
54 // have no timeout tasks at all. 52 // have no timeout tasks at all.
55 53
56 // TODO(akalin): Add HasTimeoutTask() back in TaskRunner class and 54 // TODO(akalin): Add HasTimeoutTask() back in TaskRunner class and
57 // uncomment this check. 55 // uncomment this check.
58 // DCHECK(!HasTimeoutTask()) 56 // DCHECK(!HasTimeoutTask())
59 RunTasks(); 57 RunTasks();
60 } 58 }
61 59
62 } // namespace jingle_glue 60 } // namespace jingle_glue
OLDNEW
« no previous file with comments | « jingle/glue/proxy_resolving_client_socket_unittest.cc ('k') | jingle/glue/thread_wrapper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698