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

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

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/ordered_simple_task_runner.h ('k') | cc/test/ordered_simple_task_runner_unittest.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 #include "cc/test/ordered_simple_task_runner.h" 5 #include "cc/test/ordered_simple_task_runner.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 const TestOrderablePendingTask& other) const { 57 const TestOrderablePendingTask& other) const {
58 if (*this == other) 58 if (*this == other)
59 return false; 59 return false;
60 60
61 if (GetTimeToRun() == other.GetTimeToRun()) { 61 if (GetTimeToRun() == other.GetTimeToRun()) {
62 return task_id_ < other.task_id_; 62 return task_id_ < other.task_id_;
63 } 63 }
64 return ShouldRunBefore(other); 64 return ShouldRunBefore(other);
65 } 65 }
66 66
67 scoped_ptr<base::trace_event::ConvertableToTraceFormat> 67 std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
68 TestOrderablePendingTask::AsValue() const { 68 TestOrderablePendingTask::AsValue() const {
69 scoped_ptr<base::trace_event::TracedValue> state( 69 std::unique_ptr<base::trace_event::TracedValue> state(
70 new base::trace_event::TracedValue()); 70 new base::trace_event::TracedValue());
71 AsValueInto(state.get()); 71 AsValueInto(state.get());
72 return std::move(state); 72 return std::move(state);
73 } 73 }
74 74
75 void TestOrderablePendingTask::AsValueInto( 75 void TestOrderablePendingTask::AsValueInto(
76 base::trace_event::TracedValue* state) const { 76 base::trace_event::TracedValue* state) const {
77 state->SetInteger("id", base::saturated_cast<int>(task_id_)); 77 state->SetInteger("id", base::saturated_cast<int>(task_id_));
78 state->SetInteger("run_at", GetTimeToRun().ToInternalValue()); 78 state->SetInteger("run_at", GetTimeToRun().ToInternalValue());
79 state->SetString("posted_from", location.ToString()); 79 state->SetString("posted_from", location.ToString());
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 254 }
255 255
256 return result; 256 return result;
257 } 257 }
258 258
259 bool OrderedSimpleTaskRunner::RunForPeriod(base::TimeDelta period) { 259 bool OrderedSimpleTaskRunner::RunForPeriod(base::TimeDelta period) {
260 return RunUntilTime(now_src_->NowTicks() + period); 260 return RunUntilTime(now_src_->NowTicks() + period);
261 } 261 }
262 262
263 // base::trace_event tracing functionality 263 // base::trace_event tracing functionality
264 scoped_ptr<base::trace_event::ConvertableToTraceFormat> 264 std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
265 OrderedSimpleTaskRunner::AsValue() const { 265 OrderedSimpleTaskRunner::AsValue() const {
266 scoped_ptr<base::trace_event::TracedValue> state( 266 std::unique_ptr<base::trace_event::TracedValue> state(
267 new base::trace_event::TracedValue()); 267 new base::trace_event::TracedValue());
268 AsValueInto(state.get()); 268 AsValueInto(state.get());
269 return std::move(state); 269 return std::move(state);
270 } 270 }
271 271
272 void OrderedSimpleTaskRunner::AsValueInto( 272 void OrderedSimpleTaskRunner::AsValueInto(
273 base::trace_event::TracedValue* state) const { 273 base::trace_event::TracedValue* state) const {
274 state->SetInteger("pending_tasks", 274 state->SetInteger("pending_tasks",
275 base::saturated_cast<int>(pending_tasks_.size())); 275 base::saturated_cast<int>(pending_tasks_.size()));
276 276
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 336
337 bool OrderedSimpleTaskRunner::AdvanceNowCallback() { 337 bool OrderedSimpleTaskRunner::AdvanceNowCallback() {
338 base::TimeTicks next_task_time = NextTaskTime(); 338 base::TimeTicks next_task_time = NextTaskTime();
339 if (now_src_->NowTicks() < next_task_time) { 339 if (now_src_->NowTicks() < next_task_time) {
340 now_src_->Advance(next_task_time - now_src_->NowTicks()); 340 now_src_->Advance(next_task_time - now_src_->NowTicks());
341 } 341 }
342 return true; 342 return true;
343 } 343 }
344 344
345 } // namespace cc 345 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/ordered_simple_task_runner.h ('k') | cc/test/ordered_simple_task_runner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698