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

Side by Side Diff: remoting/base/auto_thread_task_runner.h

Issue 667123002: Standardize usage of virtual/override/final in remoting/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « remoting/base/auto_thread.h ('k') | remoting/base/compound_buffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_ 5 #ifndef REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_
6 #define REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_ 6 #define REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 13
14 namespace remoting { 14 namespace remoting {
15 15
16 // A wrapper around |SingleThreadTaskRunner| that provides automatic lifetime 16 // A wrapper around |SingleThreadTaskRunner| that provides automatic lifetime
17 // management, by posting a caller-supplied task to the underlying task runner 17 // management, by posting a caller-supplied task to the underlying task runner
18 // when no more references remain. 18 // when no more references remain.
19 class AutoThreadTaskRunner : public base::SingleThreadTaskRunner { 19 class AutoThreadTaskRunner : public base::SingleThreadTaskRunner {
20 public: 20 public:
21 // Constructs an instance of |AutoThreadTaskRunner| wrapping |task_runner|. 21 // Constructs an instance of |AutoThreadTaskRunner| wrapping |task_runner|.
22 // |stop_task| is posted to |task_runner| when the last reference to 22 // |stop_task| is posted to |task_runner| when the last reference to
23 // the AutoThreadTaskRunner is dropped. 23 // the AutoThreadTaskRunner is dropped.
24 AutoThreadTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner, 24 AutoThreadTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
25 const base::Closure& stop_task); 25 const base::Closure& stop_task);
26 26
27 // SingleThreadTaskRunner implementation 27 // SingleThreadTaskRunner implementation
28 virtual bool PostDelayedTask( 28 bool PostDelayedTask(const tracked_objects::Location& from_here,
29 const tracked_objects::Location& from_here, 29 const base::Closure& task,
30 const base::Closure& task, 30 base::TimeDelta delay) override;
31 base::TimeDelta delay) override; 31 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
32 virtual bool PostNonNestableDelayedTask( 32 const base::Closure& task,
33 const tracked_objects::Location& from_here, 33 base::TimeDelta delay) override;
34 const base::Closure& task, 34 bool RunsTasksOnCurrentThread() const override;
35 base::TimeDelta delay) override;
36 virtual bool RunsTasksOnCurrentThread() const override;
37 35
38 private: 36 private:
39 virtual ~AutoThreadTaskRunner(); 37 ~AutoThreadTaskRunner() override;
40 38
41 // Task posted to |task_runner_| to notify the caller that it may be stopped. 39 // Task posted to |task_runner_| to notify the caller that it may be stopped.
42 base::Closure stop_task_; 40 base::Closure stop_task_;
43 41
44 // The wrapped task runner. 42 // The wrapped task runner.
45 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 43 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
46 44
47 DISALLOW_COPY_AND_ASSIGN(AutoThreadTaskRunner); 45 DISALLOW_COPY_AND_ASSIGN(AutoThreadTaskRunner);
48 }; 46 };
49 47
50 } // namespace remoting 48 } // namespace remoting
51 49
52 #endif // REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_ 50 #endif // REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_
OLDNEW
« no previous file with comments | « remoting/base/auto_thread.h ('k') | remoting/base/compound_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698