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

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

Issue 1717283003: tracing: Make ConvertableToTraceFormat move-only scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 19 matching lines...) Expand all
30 base::TimeTicks post_time, 30 base::TimeTicks post_time,
31 base::TimeDelta delay, 31 base::TimeDelta delay,
32 TestNestability nestability); 32 TestNestability nestability);
33 ~TestOrderablePendingTask(); 33 ~TestOrderablePendingTask();
34 34
35 // operators needed by std::set and comparison 35 // operators needed by std::set and comparison
36 bool operator==(const TestOrderablePendingTask& other) const; 36 bool operator==(const TestOrderablePendingTask& other) const;
37 bool operator<(const TestOrderablePendingTask& other) const; 37 bool operator<(const TestOrderablePendingTask& other) const;
38 38
39 // base::trace_event tracing functionality 39 // base::trace_event tracing functionality
40 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; 40 scoped_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
41 void AsValueInto(base::trace_event::TracedValue* state) const; 41 void AsValueInto(base::trace_event::TracedValue* state) const;
42 42
43 private: 43 private:
44 static size_t task_id_counter; 44 static size_t task_id_counter;
45 const size_t task_id_; 45 const size_t task_id_;
46 }; 46 };
47 47
48 // This runs pending tasks based on task's post_time + delay. 48 // This runs pending tasks based on task's post_time + delay.
49 // We should not execute a delayed task sooner than some of the queued tasks 49 // We should not execute a delayed task sooner than some of the queued tasks
50 // which don't have a delay even though it is queued early. 50 // which don't have a delay even though it is queued early.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // Keep running tasks until no tasks are left. 99 // Keep running tasks until no tasks are left.
100 // Return code indicates tasks still exist to run which also indicates if 100 // Return code indicates tasks still exist to run which also indicates if
101 // runner reached idle. 101 // runner reached idle.
102 bool RunUntilIdle(); 102 bool RunUntilIdle();
103 // Keep running tasks until given time period. 103 // Keep running tasks until given time period.
104 // Return code indicates tasks still exist to run. 104 // Return code indicates tasks still exist to run.
105 bool RunUntilTime(base::TimeTicks time); 105 bool RunUntilTime(base::TimeTicks time);
106 bool RunForPeriod(base::TimeDelta period); 106 bool RunForPeriod(base::TimeDelta period);
107 107
108 // base::trace_event tracing functionality 108 // base::trace_event tracing functionality
109 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; 109 scoped_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
110 virtual void AsValueInto(base::trace_event::TracedValue* state) const; 110 virtual void AsValueInto(base::trace_event::TracedValue* state) const;
111 111
112 // Common conditions to run for, exposed publicly to allow external users to 112 // Common conditions to run for, exposed publicly to allow external users to
113 // use their own combinations. 113 // use their own combinations.
114 // ------------------------------------------------------------------------- 114 // -------------------------------------------------------------------------
115 115
116 // Keep running until the given number of tasks have run. 116 // Keep running until the given number of tasks have run.
117 // You generally shouldn't use this check as it will cause your tests to fail 117 // You generally shouldn't use this check as it will cause your tests to fail
118 // when code is changed adding a new task. It is useful as a "timeout" type 118 // when code is changed adding a new task. It is useful as a "timeout" type
119 // solution. 119 // solution.
(...skipping 28 matching lines...) Expand all
148 bool inside_run_tasks_until_; 148 bool inside_run_tasks_until_;
149 std::set<TestOrderablePendingTask> pending_tasks_; 149 std::set<TestOrderablePendingTask> pending_tasks_;
150 150
151 private: 151 private:
152 DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner); 152 DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner);
153 }; 153 };
154 154
155 } // namespace cc 155 } // namespace cc
156 156
157 #endif // CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_ 157 #endif // CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698