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

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

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase 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 | « cc/test/layer_tree_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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <limits> 10 #include <limits>
11 #include <memory>
11 #include <set> 12 #include <set>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
15 #include "base/logging.h" 16 #include "base/logging.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "base/test/simple_test_tick_clock.h" 18 #include "base/test/simple_test_tick_clock.h"
19 #include "base/test/test_simple_task_runner.h" 19 #include "base/test/test_simple_task_runner.h"
20 #include "base/trace_event/trace_event.h" 20 #include "base/trace_event/trace_event.h"
21 21
22 namespace cc { 22 namespace cc {
23 23
24 // Subclass of TestPendingTask which has a unique ID for every task, supports 24 // Subclass of TestPendingTask which has a unique ID for every task, supports
25 // being used inside a std::set and has debug tracing support. 25 // being used inside a std::set and has debug tracing support.
26 class TestOrderablePendingTask : public base::TestPendingTask { 26 class TestOrderablePendingTask : public base::TestPendingTask {
27 public: 27 public:
28 TestOrderablePendingTask(); 28 TestOrderablePendingTask();
29 TestOrderablePendingTask(const tracked_objects::Location& location, 29 TestOrderablePendingTask(const tracked_objects::Location& location,
30 const base::Closure& task, 30 const base::Closure& task,
31 base::TimeTicks post_time, 31 base::TimeTicks post_time,
32 base::TimeDelta delay, 32 base::TimeDelta delay,
33 TestNestability nestability); 33 TestNestability nestability);
34 ~TestOrderablePendingTask(); 34 ~TestOrderablePendingTask();
35 35
36 // operators needed by std::set and comparison 36 // operators needed by std::set and comparison
37 bool operator==(const TestOrderablePendingTask& other) const; 37 bool operator==(const TestOrderablePendingTask& other) const;
38 bool operator<(const TestOrderablePendingTask& other) const; 38 bool operator<(const TestOrderablePendingTask& other) const;
39 39
40 // base::trace_event tracing functionality 40 // base::trace_event tracing functionality
41 scoped_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; 41 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
42 void AsValueInto(base::trace_event::TracedValue* state) const; 42 void AsValueInto(base::trace_event::TracedValue* state) const;
43 43
44 private: 44 private:
45 static size_t task_id_counter; 45 static size_t task_id_counter;
46 const size_t task_id_; 46 const size_t task_id_;
47 }; 47 };
48 48
49 // This runs pending tasks based on task's post_time + delay. 49 // This runs pending tasks based on task's post_time + delay.
50 // We should not execute a delayed task sooner than some of the queued tasks 50 // We should not execute a delayed task sooner than some of the queued tasks
51 // which don't have a delay even though it is queued early. 51 // which don't have a delay even though it is queued early.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // Keep running tasks until no tasks are left. 100 // Keep running tasks until no tasks are left.
101 // Return code indicates tasks still exist to run which also indicates if 101 // Return code indicates tasks still exist to run which also indicates if
102 // runner reached idle. 102 // runner reached idle.
103 bool RunUntilIdle(); 103 bool RunUntilIdle();
104 // Keep running tasks until given time period. 104 // Keep running tasks until given time period.
105 // Return code indicates tasks still exist to run. 105 // Return code indicates tasks still exist to run.
106 bool RunUntilTime(base::TimeTicks time); 106 bool RunUntilTime(base::TimeTicks time);
107 bool RunForPeriod(base::TimeDelta period); 107 bool RunForPeriod(base::TimeDelta period);
108 108
109 // base::trace_event tracing functionality 109 // base::trace_event tracing functionality
110 scoped_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; 110 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
111 virtual void AsValueInto(base::trace_event::TracedValue* state) const; 111 virtual void AsValueInto(base::trace_event::TracedValue* state) const;
112 112
113 // Common conditions to run for, exposed publicly to allow external users to 113 // Common conditions to run for, exposed publicly to allow external users to
114 // use their own combinations. 114 // use their own combinations.
115 // ------------------------------------------------------------------------- 115 // -------------------------------------------------------------------------
116 116
117 // Keep running until the given number of tasks have run. 117 // Keep running until the given number of tasks have run.
118 // You generally shouldn't use this check as it will cause your tests to fail 118 // You generally shouldn't use this check as it will cause your tests to fail
119 // when code is changed adding a new task. It is useful as a "timeout" type 119 // when code is changed adding a new task. It is useful as a "timeout" type
120 // solution. 120 // solution.
(...skipping 28 matching lines...) Expand all
149 bool inside_run_tasks_until_; 149 bool inside_run_tasks_until_;
150 std::set<TestOrderablePendingTask> pending_tasks_; 150 std::set<TestOrderablePendingTask> pending_tasks_;
151 151
152 private: 152 private:
153 DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner); 153 DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner);
154 }; 154 };
155 155
156 } // namespace cc 156 } // namespace cc
157 157
158 #endif // CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_ 158 #endif // CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_
OLDNEW
« no previous file with comments | « cc/test/layer_tree_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