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

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

Issue 10796099: Introducing remoting::Stoppable helper base class implementing asynchronous shutdown on a specific t (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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(MessageLoop::Type type) {
12 message_loop_.reset(new MessageLoop(type));
13 }
14
15 AutoMessageLoop::~AutoMessageLoop() {
16 }
17
18 void AutoMessageLoop::Run() {
19 message_loop_->Run();
20 }
21
22 bool AutoMessageLoop::PostDelayedTask(
23 const tracked_objects::Location& from_here,
24 const base::Closure& task,
25 base::TimeDelta delay) {
26 message_loop_->PostDelayedTask(from_here, task, delay);
27 return true;
28 }
29
30 bool AutoMessageLoop::PostNonNestableDelayedTask(
31 const tracked_objects::Location& from_here,
32 const base::Closure& task,
33 base::TimeDelta delay) {
34 message_loop_->PostNonNestableDelayedTask(from_here, task, delay);
35 return true;
36 }
37
38 bool AutoMessageLoop::RunsTasksOnCurrentThread() const {
39 return MessageLoop::current() == message_loop_.get();
40 }
41
42 void AutoMessageLoop::OnDestruct() const {
43 message_loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure());
44 }
45
46 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698