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

Side by Side Diff: remoting/base/auto_message_loop.cc

Issue 10829467: [Chromoting] Introducing refcount-based life time management of the message loops in the service (d… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback Created 8 years, 3 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 | Annotate | Revision Log
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 "remoting/base/auto_message_loop.h"
6
7 #include "base/logging.h"
8
9 namespace remoting {
10
11 AutoMessageLoop::AutoMessageLoop(base::SingleThreadTaskRunner* parent,
12 base::SingleThreadTaskRunner* task_runner,
13 const base::Closure& stop_callback)
14 : parent_(parent),
15 stop_callback_(stop_callback),
16 task_runner_(task_runner) {
17 }
18
19 bool AutoMessageLoop::PostDelayedTask(
20 const tracked_objects::Location& from_here,
21 const base::Closure& task,
22 base::TimeDelta delay) {
23 CHECK(task_runner_->PostDelayedTask(from_here, task, delay));
Wez 2012/08/28 17:34:53 Why CHECK rather than returning the result?
alexeypa (please no reviews) 2012/08/28 19:18:51 The whole purpose of this class is to make sure th
24 return true;
25 }
26
27 bool AutoMessageLoop::PostNonNestableDelayedTask(
28 const tracked_objects::Location& from_here,
29 const base::Closure& task,
30 base::TimeDelta delay) {
31 CHECK(task_runner_->PostNonNestableDelayedTask(from_here, task, delay));
Wez 2012/08/28 17:34:53 Ditto.
alexeypa (please no reviews) 2012/08/28 19:18:51 See above.
32 return true;
33 }
34
35 bool AutoMessageLoop::RunsTasksOnCurrentThread() const {
36 return task_runner_->RunsTasksOnCurrentThread();
37 }
38
39 void AutoMessageLoop::OnDestruct() const {
40 if (!stop_callback_.is_null())
41 stop_callback_.Run();
42 delete this;
43 }
44
45 AutoMessageLoop::~AutoMessageLoop() {
46 }
47
48 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698