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

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

Issue 1124273004: Add SurfaceDisplayOutputSurface unittests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@displayScheduler16
Patch Set: Remove debug code and fix flakiness due to uninitialized variable Created 5 years, 7 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/surfaces/surface_display_output_surface_unittest.cc ('k') | no next file » | 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 <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 #include <sstream> 9 #include <sstream>
10 #include <string> 10 #include <string>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 void TestOrderablePendingTask::AsValueInto( 71 void TestOrderablePendingTask::AsValueInto(
72 base::trace_event::TracedValue* state) const { 72 base::trace_event::TracedValue* state) const {
73 state->SetInteger("id", task_id_); 73 state->SetInteger("id", task_id_);
74 state->SetInteger("run_at", GetTimeToRun().ToInternalValue()); 74 state->SetInteger("run_at", GetTimeToRun().ToInternalValue());
75 state->SetString("posted_from", location.ToString()); 75 state->SetString("posted_from", location.ToString());
76 } 76 }
77 77
78 OrderedSimpleTaskRunner::OrderedSimpleTaskRunner() 78 OrderedSimpleTaskRunner::OrderedSimpleTaskRunner()
79 : advance_now_(true), 79 : advance_now_(true),
80 now_src_(TestNowSource::Create(0)), 80 now_src_(TestNowSource::Create(0)),
81 max_tasks_(kAbsoluteMaxTasks),
81 inside_run_tasks_until_(false) { 82 inside_run_tasks_until_(false) {
82 } 83 }
83 84
84 OrderedSimpleTaskRunner::OrderedSimpleTaskRunner( 85 OrderedSimpleTaskRunner::OrderedSimpleTaskRunner(
85 scoped_refptr<TestNowSource> now_src, 86 scoped_refptr<TestNowSource> now_src,
86 bool advance_now) 87 bool advance_now)
87 : advance_now_(advance_now), 88 : advance_now_(advance_now),
88 now_src_(now_src), 89 now_src_(now_src),
89 max_tasks_(kAbsoluteMaxTasks), 90 max_tasks_(kAbsoluteMaxTasks),
90 inside_run_tasks_until_(false) { 91 inside_run_tasks_until_(false) {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 ++it) { 280 ++it) {
280 state->BeginDictionary(); 281 state->BeginDictionary();
281 it->AsValueInto(state); 282 it->AsValueInto(state);
282 state->EndDictionary(); 283 state->EndDictionary();
283 } 284 }
284 state->EndArray(); 285 state->EndArray();
285 286
286 state->BeginDictionary("now_src"); 287 state->BeginDictionary("now_src");
287 now_src_->AsValueInto(state); 288 now_src_->AsValueInto(state);
288 state->EndDictionary(); 289 state->EndDictionary();
290
291 state->SetBoolean("advance_now", advance_now_);
292 state->SetBoolean("inside_run_tasks_until", inside_run_tasks_until_);
293 state->SetString("max_tasks", base::SizeTToString(max_tasks_));
289 } 294 }
290 295
291 base::Callback<bool(void)> OrderedSimpleTaskRunner::TaskRunCountBelow( 296 base::Callback<bool(void)> OrderedSimpleTaskRunner::TaskRunCountBelow(
292 size_t max_tasks) { 297 size_t max_tasks) {
293 return base::Bind(&OrderedSimpleTaskRunner::TaskRunCountBelowCallback, 298 return base::Bind(&OrderedSimpleTaskRunner::TaskRunCountBelowCallback,
294 max_tasks, 299 max_tasks,
295 base::Owned(new size_t(0))); 300 base::Owned(new size_t(0)));
296 } 301 }
297 302
298 bool OrderedSimpleTaskRunner::TaskRunCountBelowCallback(size_t max_tasks, 303 bool OrderedSimpleTaskRunner::TaskRunCountBelowCallback(size_t max_tasks,
(...skipping 30 matching lines...) Expand all
329 334
330 bool OrderedSimpleTaskRunner::AdvanceNowCallback() { 335 bool OrderedSimpleTaskRunner::AdvanceNowCallback() {
331 base::TimeTicks next_task_time = NextTaskTime(); 336 base::TimeTicks next_task_time = NextTaskTime();
332 if (now_src_->Now() < next_task_time) { 337 if (now_src_->Now() < next_task_time) {
333 now_src_->SetNow(next_task_time); 338 now_src_->SetNow(next_task_time);
334 } 339 }
335 return true; 340 return true;
336 } 341 }
337 342
338 } // namespace cc 343 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_display_output_surface_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698