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

Side by Side Diff: cc/test/ordered_simple_task_runner.h

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « cc/test/layer_tree_pixel_test.cc ('k') | cc/test/ordered_simple_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
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 CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_ 5 #ifndef CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_
6 #define CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_ 6 #define CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_
7 7
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 16 matching lines...) Expand all
27 const base::Closure& task, 27 const base::Closure& task,
28 base::TimeTicks post_time, 28 base::TimeTicks post_time,
29 base::TimeDelta delay, 29 base::TimeDelta delay,
30 TestNestability nestability); 30 TestNestability nestability);
31 ~TestOrderablePendingTask(); 31 ~TestOrderablePendingTask();
32 32
33 // operators needed by std::set and comparison 33 // operators needed by std::set and comparison
34 bool operator==(const TestOrderablePendingTask& other) const; 34 bool operator==(const TestOrderablePendingTask& other) const;
35 bool operator<(const TestOrderablePendingTask& other) const; 35 bool operator<(const TestOrderablePendingTask& other) const;
36 36
37 // debug tracing functions 37 // base::trace_event tracing functionality
38 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; 38 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
39 void AsValueInto(base::debug::TracedValue* state) const; 39 void AsValueInto(base::trace_event::TracedValue* state) const;
40 40
41 private: 41 private:
42 static size_t task_id_counter; 42 static size_t task_id_counter;
43 const size_t task_id_; 43 const size_t task_id_;
44 }; 44 };
45 45
46 // This runs pending tasks based on task's post_time + delay. 46 // This runs pending tasks based on task's post_time + delay.
47 // We should not execute a delayed task sooner than some of the queued tasks 47 // We should not execute a delayed task sooner than some of the queued tasks
48 // which don't have a delay even though it is queued early. 48 // which don't have a delay even though it is queued early.
49 class OrderedSimpleTaskRunner : public base::SingleThreadTaskRunner { 49 class OrderedSimpleTaskRunner : public base::SingleThreadTaskRunner {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 bool RunPendingTasks(); 95 bool RunPendingTasks();
96 // Keep running tasks until no tasks are left. 96 // Keep running tasks until no tasks are left.
97 // Return code indicates tasks still exist to run which also indicates if 97 // Return code indicates tasks still exist to run which also indicates if
98 // runner reached idle. 98 // runner reached idle.
99 bool RunUntilIdle(); 99 bool RunUntilIdle();
100 // Keep running tasks until given time period. 100 // Keep running tasks until given time period.
101 // Return code indicates tasks still exist to run. 101 // Return code indicates tasks still exist to run.
102 bool RunUntilTime(base::TimeTicks time); 102 bool RunUntilTime(base::TimeTicks time);
103 bool RunForPeriod(base::TimeDelta period); 103 bool RunForPeriod(base::TimeDelta period);
104 104
105 // base::debug tracing functionality 105 // base::trace_event tracing functionality
106 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; 106 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
107 virtual void AsValueInto(base::debug::TracedValue* state) const; 107 virtual void AsValueInto(base::trace_event::TracedValue* state) const;
108 108
109 // Common conditions to run for, exposed publicly to allow external users to 109 // Common conditions to run for, exposed publicly to allow external users to
110 // use their own combinations. 110 // use their own combinations.
111 // ------------------------------------------------------------------------- 111 // -------------------------------------------------------------------------
112 112
113 // Keep running until the given number of tasks have run. 113 // Keep running until the given number of tasks have run.
114 // You generally shouldn't use this check as it will cause your tests to fail 114 // You generally shouldn't use this check as it will cause your tests to fail
115 // when code is changed adding a new task. It is useful as a "timeout" type 115 // when code is changed adding a new task. It is useful as a "timeout" type
116 // solution. 116 // solution.
117 base::Callback<bool(void)> TaskRunCountBelow(size_t max_tasks); 117 base::Callback<bool(void)> TaskRunCountBelow(size_t max_tasks);
(...skipping 26 matching lines...) Expand all
144 bool inside_run_tasks_until_; 144 bool inside_run_tasks_until_;
145 std::set<TestOrderablePendingTask> pending_tasks_; 145 std::set<TestOrderablePendingTask> pending_tasks_;
146 146
147 private: 147 private:
148 DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner); 148 DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner);
149 }; 149 };
150 150
151 } // namespace cc 151 } // namespace cc
152 152
153 #endif // CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_ 153 #endif // CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_
OLDNEW
« no previous file with comments | « cc/test/layer_tree_pixel_test.cc ('k') | cc/test/ordered_simple_task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698