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

Side by Side Diff: media/cast/test/fake_single_thread_task_runner.h

Issue 1829163002: Lazily prune the multibuffer block cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no export Created 4 years, 8 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 | « media/cast/test/end2end_unittest.cc ('k') | media/cast/test/fake_single_thread_task_runner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_CAST_TEST_FAKE_TASK_RUNNER_H_
6 #define MEDIA_CAST_TEST_FAKE_TASK_RUNNER_H_
7
8 #include <map>
9
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "base/single_thread_task_runner.h"
13 #include "base/test/simple_test_tick_clock.h"
14
15 namespace media {
16 namespace cast {
17 namespace test {
18
19 class FakeSingleThreadTaskRunner : public base::SingleThreadTaskRunner {
20 public:
21 explicit FakeSingleThreadTaskRunner(base::SimpleTestTickClock* clock);
22
23 void RunTasks();
24
25 // Note: Advances |clock_|.
26 void Sleep(base::TimeDelta t);
27
28 // base::SingleThreadTaskRunner implementation.
29 bool PostDelayedTask(const tracked_objects::Location& from_here,
30 const base::Closure& task,
31 base::TimeDelta delay) final;
32
33 bool RunsTasksOnCurrentThread() const final;
34
35 // This function is currently not used, and will return false.
36 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
37 const base::Closure& task,
38 base::TimeDelta delay) final;
39
40 protected:
41 ~FakeSingleThreadTaskRunner() final;
42
43 private:
44 base::SimpleTestTickClock* const clock_;
45
46 // A compound key is used to ensure FIFO execution of delayed tasks scheduled
47 // for the same point-in-time. The second part of the key is simply a FIFO
48 // sequence number.
49 using TaskKey = std::pair<base::TimeTicks, unsigned int>;
50
51 // Note: The std::map data structure was chosen because the entire
52 // cast_unittests suite performed 20% faster than when using
53 // std::priority_queue. http://crbug.com/530842
54 std::map<TaskKey, base::Closure> tasks_;
55
56 bool fail_on_next_task_;
57
58 DISALLOW_COPY_AND_ASSIGN(FakeSingleThreadTaskRunner);
59 };
60
61 } // namespace test
62 } // namespace cast
63 } // namespace media
64
65 #endif // MEDIA_CAST_TEST_FAKE_TASK_RUNNER_H_
OLDNEW
« no previous file with comments | « media/cast/test/end2end_unittest.cc ('k') | media/cast/test/fake_single_thread_task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698