diff options
author | khushalsagar <khushalsagar@chromium.org> | 2015-12-15 23:04:20 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-16 07:06:00 +0000 |
commit | 0f081c459a326c76da497645ae97c4d7d7bfd750 (patch) | |
tree | b29464b2d91b34c04679ac32131625a15f4b198c /cc/trees | |
parent | 91d55c621307c578c233e3a07d896ce763abbae2 (diff) | |
download | chromium_src-0f081c459a326c76da497645ae97c4d7d7bfd750.zip chromium_src-0f081c459a326c76da497645ae97c4d7d7bfd750.tar.gz chromium_src-0f081c459a326c76da497645ae97c4d7d7bfd750.tar.bz2 |
cc: Fix error in smoothness_priority_expiration_notifier for ProxyImpl
The error was introduced by https://codereview.chromium.org/1417053005/
where using TimeDelta::FromSeconds for a double value caused the
DelayedUniqueNotifier to be initialized with zero delay.
This also fixes the flakiness for BenchmarkSmokeTest.thread_times on
Win7 bots, caused by an increase in the number of trace events from the
DelayedUniqueNotifier running with zero delay.
BUG=568120, 569658
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1527893002
Cr-Commit-Position: refs/heads/master@{#365492}
Diffstat (limited to 'cc/trees')
-rw-r--r-- | cc/trees/proxy_impl.cc | 2 | ||||
-rw-r--r-- | cc/trees/proxy_impl_unittest.cc | 60 |
2 files changed, 61 insertions, 1 deletions
diff --git a/cc/trees/proxy_impl.cc b/cc/trees/proxy_impl.cc index 810e73e..0ba4cc2 100644 --- a/cc/trees/proxy_impl.cc +++ b/cc/trees/proxy_impl.cc @@ -57,7 +57,7 @@ ProxyImpl::ProxyImpl(ChannelImpl* channel_impl, smoothness_priority_expiration_notifier_( task_runner_provider->ImplThreadTaskRunner(), base::Bind(&ProxyImpl::RenewTreePriority, base::Unretained(this)), - base::TimeDelta::FromSeconds( + base::TimeDelta::FromSecondsD( kSmoothnessTakesPriorityExpirationDelay)), external_begin_frame_source_(std::move(external_begin_frame_source)), rendering_stats_instrumentation_( diff --git a/cc/trees/proxy_impl_unittest.cc b/cc/trees/proxy_impl_unittest.cc new file mode 100644 index 0000000..ad99d53 --- /dev/null +++ b/cc/trees/proxy_impl_unittest.cc @@ -0,0 +1,60 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "cc/test/fake_channel_impl.h" +#include "cc/test/fake_layer_tree_host.h" +#include "cc/test/fake_layer_tree_host_client.h" +#include "cc/test/proxy_impl_for_test.h" +#include "cc/test/test_hooks.h" +#include "cc/test/test_task_graph_runner.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace cc { + +class ProxyImplTest : public testing::Test, public TestHooks { + public: + ~ProxyImplTest() override { + DebugScopedSetImplThreadAndMainThreadBlocked impl_and_main_blocked( + task_runner_provider_); + proxy_impl_.reset(); + } + + void RequestNewOutputSurface() override {} + + protected: + ProxyImplTest() + : host_client_(FakeLayerTreeHostClient::DIRECT_3D), + task_runner_provider_(nullptr) {} + + void Initialize(CompositorMode mode) { + layer_tree_host_ = FakeLayerTreeHost::Create( + &host_client_, &task_graph_runner_, settings_, mode); + task_runner_provider_ = layer_tree_host_->task_runner_provider(); + { + DebugScopedSetImplThreadAndMainThreadBlocked impl_and_main_blocked( + task_runner_provider_); + proxy_impl_ = + ProxyImplForTest::Create(this, &channel_impl_, layer_tree_host_.get(), + task_runner_provider_, nullptr); + } + } + + TestTaskGraphRunner task_graph_runner_; + LayerTreeSettings settings_; + FakeLayerTreeHostClient host_client_; + FakeChannelImpl channel_impl_; + TaskRunnerProvider* task_runner_provider_; + scoped_ptr<ProxyImplForTest> proxy_impl_; + scoped_ptr<FakeLayerTreeHost> layer_tree_host_; +}; + +// This is a regression test. See crbug/568120. +TEST_F(ProxyImplTest, NonZeroSmoothnessPriorityExpiration) { + Initialize(CompositorMode::Threaded); + DebugScopedSetImplThread impl_thread(task_runner_provider_); + EXPECT_FALSE( + proxy_impl_->smoothness_priority_expiration_notifier().delay().is_zero()); +} + +} // namespace cc |