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

Side by Side Diff: third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp

Issue 2572893002: [Reland] Dont post delayed DoWork for disabled queues. (Closed)
Patch Set: Rebased Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 TestingPlatformSupportWithMockScheduler:: 212 TestingPlatformSupportWithMockScheduler::
213 TestingPlatformSupportWithMockScheduler(const Config& config) 213 TestingPlatformSupportWithMockScheduler(const Config& config)
214 : TestingPlatformSupport(config), 214 : TestingPlatformSupport(config),
215 m_clock(new base::SimpleTestTickClock()), 215 m_clock(new base::SimpleTestTickClock()),
216 m_mockTaskRunner(new cc::OrderedSimpleTaskRunner(m_clock.get(), true)), 216 m_mockTaskRunner(new cc::OrderedSimpleTaskRunner(m_clock.get(), true)),
217 m_scheduler(new scheduler::RendererSchedulerImpl( 217 m_scheduler(new scheduler::RendererSchedulerImpl(
218 scheduler::SchedulerTqmDelegateForTest::Create( 218 scheduler::SchedulerTqmDelegateForTest::Create(
219 m_mockTaskRunner, 219 m_mockTaskRunner,
220 base::WrapUnique(new scheduler::TestTimeSource(m_clock.get()))))), 220 base::WrapUnique(new scheduler::TestTimeSource(m_clock.get()))))),
221 m_thread(m_scheduler->CreateMainThread()) { 221 m_thread(m_scheduler->CreateMainThread()) {
222 // We need a non-zero start time because LazyNow in the blink scheduler can't
223 // be initialized with time t = 0;
224 m_clock->Advance(base::TimeDelta::FromSeconds(1));
225
222 // Set the work batch size to one so RunPendingTasks behaves as expected. 226 // Set the work batch size to one so RunPendingTasks behaves as expected.
223 m_scheduler->GetSchedulerHelperForTesting()->SetWorkBatchSizeForTesting(1); 227 m_scheduler->GetSchedulerHelperForTesting()->SetWorkBatchSizeForTesting(1);
224 228
225 WTF::setTimeFunctionsForTesting(getTestTime); 229 WTF::setTimeFunctionsForTesting(getTestTime);
226 } 230 }
227 231
228 TestingPlatformSupportWithMockScheduler:: 232 TestingPlatformSupportWithMockScheduler::
229 ~TestingPlatformSupportWithMockScheduler() { 233 ~TestingPlatformSupportWithMockScheduler() {
230 WTF::setTimeFunctionsForTesting(nullptr); 234 WTF::setTimeFunctionsForTesting(nullptr);
231 m_scheduler->Shutdown(); 235 m_scheduler->Shutdown();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 ThreadState::attachMainThread(); 346 ThreadState::attachMainThread();
343 ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr, nullptr, 347 ThreadState::current()->registerTraceDOMWrappers(nullptr, nullptr, nullptr,
344 nullptr); 348 nullptr);
345 HTTPNames::init(); 349 HTTPNames::init();
346 FetchInitiatorTypeNames::init(); 350 FetchInitiatorTypeNames::init();
347 } 351 }
348 352
349 ScopedUnittestsEnvironmentSetup::~ScopedUnittestsEnvironmentSetup() {} 353 ScopedUnittestsEnvironmentSetup::~ScopedUnittestsEnvironmentSetup() {}
350 354
351 } // namespace blink 355 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698