OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MEDIA_CAST_TEST_SKEWED_TASK_RUNNER_H_ | 5 #ifndef MEDIA_CAST_TEST_SKEWED_TASK_RUNNER_H_ |
6 #define MEDIA_CAST_TEST_SKEWED_TASK_RUNNER_H_ | 6 #define MEDIA_CAST_TEST_SKEWED_TASK_RUNNER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // have to wait twice as long. | 22 // have to wait twice as long. |
23 class SkewedSingleThreadTaskRunner : public base::SingleThreadTaskRunner { | 23 class SkewedSingleThreadTaskRunner : public base::SingleThreadTaskRunner { |
24 public: | 24 public: |
25 explicit SkewedSingleThreadTaskRunner( | 25 explicit SkewedSingleThreadTaskRunner( |
26 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 26 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
27 | 27 |
28 // Set the delay multiplier to |skew|. | 28 // Set the delay multiplier to |skew|. |
29 void SetSkew(double skew); | 29 void SetSkew(double skew); |
30 | 30 |
31 // base::SingleThreadTaskRunner implementation. | 31 // base::SingleThreadTaskRunner implementation. |
32 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, | 32 bool PostDelayedTask(const tracked_objects::Location& from_here, |
33 const base::Closure& task, | 33 const base::Closure& task, |
34 base::TimeDelta delay) override; | 34 base::TimeDelta delay) override; |
35 | 35 |
36 virtual bool RunsTasksOnCurrentThread() const override; | 36 bool RunsTasksOnCurrentThread() const override; |
37 | 37 |
38 // This function is currently not used, and will return false. | 38 // This function is currently not used, and will return false. |
39 virtual bool PostNonNestableDelayedTask( | 39 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
40 const tracked_objects::Location& from_here, | 40 const base::Closure& task, |
41 const base::Closure& task, | 41 base::TimeDelta delay) override; |
42 base::TimeDelta delay) override; | |
43 | 42 |
44 protected: | 43 protected: |
45 virtual ~SkewedSingleThreadTaskRunner(); | 44 ~SkewedSingleThreadTaskRunner() override; |
46 | 45 |
47 private: | 46 private: |
48 double skew_; | 47 double skew_; |
49 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 48 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
50 | 49 |
51 DISALLOW_COPY_AND_ASSIGN(SkewedSingleThreadTaskRunner); | 50 DISALLOW_COPY_AND_ASSIGN(SkewedSingleThreadTaskRunner); |
52 }; | 51 }; |
53 | 52 |
54 } // namespace test | 53 } // namespace test |
55 } // namespace cast | 54 } // namespace cast |
56 } // namespace media | 55 } // namespace media |
57 | 56 |
58 #endif // MEDIA_CAST_TEST_SKEWED_TASK_RUNNER_H_ | 57 #endif // MEDIA_CAST_TEST_SKEWED_TASK_RUNNER_H_ |
OLD | NEW |