12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright 2012 The Chromium Authors. All rights reserved.
22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file.
42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "cc/trees/layer_tree_host.h"
62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
78bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include <sstream>
88bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/file_util.h"
102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/files/file_path.h"
112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/path_service.h"
12c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "base/strings/string_piece.h"
13424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#include "base/time/time.h"
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "cc/layers/content_layer.h"
152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "cc/layers/nine_patch_layer.h"
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "cc/layers/solid_color_layer.h"
178bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "cc/layers/texture_layer.h"
188bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "cc/resources/texture_mailbox.h"
192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "cc/test/fake_content_layer_client.h"
20424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#include "cc/test/lap_timer.h"
212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "cc/test/layer_tree_json_parser.h"
222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "cc/test/layer_tree_test.h"
232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "cc/test/paths.h"
24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "cc/trees/layer_tree_impl.h"
2558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include "testing/perf/perf_test.h"
262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace cc {
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace {
292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)static const int kTimeLimitMillis = 2000;
312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)static const int kWarmupRuns = 5;
322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)static const int kTimeCheckInterval = 10;
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class LayerTreeHostPerfTest : public LayerTreeTest {
352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public:
362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  LayerTreeHostPerfTest()
37424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)      : draw_timer_(kWarmupRuns,
38424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)                    base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
39424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)                    kTimeCheckInterval),
40424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)        commit_timer_(0, base::TimeDelta(), 1),
41b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)        full_damage_each_frame_(false),
42b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)        animation_driven_drawing_(false),
43b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)        measure_commit_cost_(false) {
442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    fake_content_layer_client_.set_paint_all_opaque(true);
452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
471e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
481e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)    settings->throttle_frame_production = false;
491e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  }
501e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void BeginTest() OVERRIDE {
522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    BuildTree();
532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    PostSetNeedsCommitToMainThread();
542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
56b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual void Animate(base::TimeTicks monotonic_time) OVERRIDE {
57b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    if (animation_driven_drawing_ && !TestEnded())
58b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)      layer_tree_host()->SetNeedsAnimate();
59b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  }
60b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
61b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
62b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    if (measure_commit_cost_)
63424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)      commit_timer_.Start();
64b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  }
65b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
66b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
67424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)    if (measure_commit_cost_ && draw_timer_.IsWarmedUp()) {
68424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)      commit_timer_.NextLap();
69868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    }
70b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  }
71b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
73a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    if (TestEnded() || CleanUpStarted())
74424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)      return;
75424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)    draw_timer_.NextLap();
76424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)    if (draw_timer_.HasTimeLimitExpired()) {
77a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)      CleanUpAndEndTest(impl);
78424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)      return;
792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    }
80b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    if (!animation_driven_drawing_)
81b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)      impl->SetNeedsRedraw();
82c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)    if (full_damage_each_frame_)
83c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)      impl->SetFullRootLayerDamage();
842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
86a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  virtual void CleanUpAndEndTest(LayerTreeHostImpl* host_impl) { EndTest(); }
87a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
88a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  virtual bool CleanUpStarted() { return false; }
89a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void BuildTree() {}
912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void AfterTest() OVERRIDE {
9358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)    CHECK(!test_name_.empty()) << "Must SetTestName() before AfterTest().";
9458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)    perf_test::PrintResult("layer_tree_host_frame_time", "", test_name_,
9558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)                           1000 * draw_timer_.MsPerLap(), "us", true);
96b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    if (measure_commit_cost_) {
9758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)      perf_test::PrintResult("layer_tree_host_commit_time", "", test_name_,
9858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)                             1000 * commit_timer_.MsPerLap(), "us", true);
99b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    }
1002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
1012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) protected:
103424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  LapTimer draw_timer_;
104424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  LapTimer commit_timer_;
105424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
1062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  std::string test_name_;
1072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  FakeContentLayerClient fake_content_layer_client_;
108c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  bool full_damage_each_frame_;
109b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  bool animation_driven_drawing_;
110b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
111b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  bool measure_commit_cost_;
1122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
1132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class LayerTreeHostPerfTestJsonReader : public LayerTreeHostPerfTest {
1162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public:
1172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  LayerTreeHostPerfTestJsonReader()
1182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      : LayerTreeHostPerfTest() {
1192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
1202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
12158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  void SetTestName(const std::string& name) {
1222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    test_name_ = name;
12358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  }
12458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
12558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  void ReadTestFile(const std::string& name) {
1262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    base::FilePath test_data_dir;
127a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    ASSERT_TRUE(PathService::Get(CCPaths::DIR_TEST_DATA, &test_data_dir));
1282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    base::FilePath json_file = test_data_dir.AppendASCII(name + ".json");
12958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)    ASSERT_TRUE(base::ReadFileToString(json_file, &json_));
1302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
1312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void BuildTree() OVERRIDE {
1332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    gfx::Size viewport = gfx::Size(720, 1038);
134c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)    layer_tree_host()->SetViewportSize(viewport);
1352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    scoped_refptr<Layer> root = ParseTreeFromJson(json_,
1362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                                  &fake_content_layer_client_);
1372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    ASSERT_TRUE(root.get());
1382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    layer_tree_host()->SetRootLayer(root);
1392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
1402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) private:
1422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  std::string json_;
1432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
1442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Simulates a tab switcher scene with two stacks of 10 tabs each.
1462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)TEST_F(LayerTreeHostPerfTestJsonReader, TenTenSingleThread) {
14758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  SetTestName("10_10_single_thread");
1482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ReadTestFile("10_10_layer_tree");
149a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)  RunTest(false, false, false);
1502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
1512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1524e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)TEST_F(LayerTreeHostPerfTestJsonReader, TenTenThreadedImplSide) {
1534e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  SetTestName("10_10_threaded_impl_side");
1544e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  ReadTestFile("10_10_layer_tree");
1554e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  RunTestWithImplSidePainting();
1564e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)}
1574e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
158c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// Simulates a tab switcher scene with two stacks of 10 tabs each.
159c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)TEST_F(LayerTreeHostPerfTestJsonReader,
160c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)       TenTenSingleThread_FullDamageEachFrame) {
161c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  full_damage_each_frame_ = true;
16258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  SetTestName("10_10_single_thread_full_damage_each_frame");
163c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  ReadTestFile("10_10_layer_tree");
164a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)  RunTest(false, false, false);
165c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)}
166c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
1674e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)TEST_F(LayerTreeHostPerfTestJsonReader,
1684e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)       TenTenThreadedImplSide_FullDamageEachFrame) {
1694e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  full_damage_each_frame_ = true;
1704e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  SetTestName("10_10_threaded_impl_side_full_damage_each_frame");
1714e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  ReadTestFile("10_10_layer_tree");
1724e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  RunTestWithImplSidePainting();
1734e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)}
1744e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
1757dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Invalidates a leaf layer in the tree on the main thread after every commit.
1767dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochclass LayerTreeHostPerfTestLeafInvalidates
1777dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    : public LayerTreeHostPerfTestJsonReader {
1787dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch public:
1797dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  virtual void BuildTree() OVERRIDE {
1807dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    LayerTreeHostPerfTestJsonReader::BuildTree();
1817dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
1827dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    // Find a leaf layer.
1837dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    for (layer_to_invalidate_ = layer_tree_host()->root_layer();
1847dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch         layer_to_invalidate_->children().size();
1857dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch         layer_to_invalidate_ = layer_to_invalidate_->children()[0]) {}
1867dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  }
1877dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
1887dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  virtual void DidCommitAndDrawFrame() OVERRIDE {
1897dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    if (TestEnded())
1907dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch      return;
1917dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
1927dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    static bool flip = true;
1937dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    layer_to_invalidate_->SetOpacity(flip ? 1.f : 0.5f);
1947dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    flip = !flip;
1957dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  }
1967dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
1977dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch protected:
1987dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  Layer* layer_to_invalidate_;
1997dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch};
2007dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
2017dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Simulates a tab switcher scene with two stacks of 10 tabs each. Invalidate a
2027dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// property on a leaf layer in the tree every commit.
2037dbb3d5cf0c15f500944d211057644d6a2f37371Ben MurdochTEST_F(LayerTreeHostPerfTestLeafInvalidates, TenTenSingleThread) {
20458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  SetTestName("10_10_single_thread_leaf_invalidates");
2057dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  ReadTestFile("10_10_layer_tree");
2067dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  RunTest(false, false, false);
2077dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch}
2087dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
2094e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)TEST_F(LayerTreeHostPerfTestLeafInvalidates, TenTenThreadedImplSide) {
2104e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  SetTestName("10_10_threaded_impl_side_leaf_invalidates");
2114e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  ReadTestFile("10_10_layer_tree");
2124e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  RunTestWithImplSidePainting();
2134e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)}
2144e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
2152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Simulates main-thread scrolling on each frame.
2162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class ScrollingLayerTreePerfTest : public LayerTreeHostPerfTestJsonReader {
2172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public:
2182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ScrollingLayerTreePerfTest()
2192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      : LayerTreeHostPerfTestJsonReader() {
2202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
2212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void BuildTree() OVERRIDE {
2232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    LayerTreeHostPerfTestJsonReader::BuildTree();
2242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    scrollable_ = layer_tree_host()->root_layer()->children()[1];
225868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    ASSERT_TRUE(scrollable_.get());
2262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
2272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void Layout() OVERRIDE {
2292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    static const gfx::Vector2d delta = gfx::Vector2d(0, 10);
2302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    scrollable_->SetScrollOffset(scrollable_->scroll_offset() + delta);
2312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
2322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) private:
2342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  scoped_refptr<Layer> scrollable_;
2352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
2362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2374e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)TEST_F(ScrollingLayerTreePerfTest, LongScrollablePageSingleThread) {
23858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  SetTestName("long_scrollable_page");
2392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ReadTestFile("long_scrollable_page");
240a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)  RunTest(false, false, false);
2412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
2422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2434e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)TEST_F(ScrollingLayerTreePerfTest, LongScrollablePageThreadedImplSide) {
2444e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  SetTestName("long_scrollable_page_threaded_impl_side");
2454e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  ReadTestFile("long_scrollable_page");
2464e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  RunTestWithImplSidePainting();
2474e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)}
248b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
2498bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)static void EmptyReleaseCallback(unsigned sync_point, bool lost_resource) {}
2508bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
2518bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Simulates main-thread scrolling on each frame.
2528bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class BrowserCompositorInvalidateLayerTreePerfTest
2538bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    : public LayerTreeHostPerfTestJsonReader {
2548bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) public:
2558bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  BrowserCompositorInvalidateLayerTreePerfTest()
256a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)      : next_sync_point_(1), clean_up_started_(false) {}
2578bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
2588bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual void BuildTree() OVERRIDE {
2598bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    LayerTreeHostPerfTestJsonReader::BuildTree();
2608bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    tab_contents_ =
2618bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)        static_cast<TextureLayer*>(
2628bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)            layer_tree_host()->root_layer()->children()[0]->
2638bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                                             children()[0]->
2648bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                                             children()[0]->
2658bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                                             children()[0].get());
2668bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    ASSERT_TRUE(tab_contents_.get());
2678bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  }
2688bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
269a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  virtual void WillCommit() OVERRIDE {
2708bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    gpu::Mailbox gpu_mailbox;
2718bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    std::ostringstream name_stream;
2728bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    name_stream << "name" << next_sync_point_;
273a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    gpu_mailbox.SetName(
274a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)        reinterpret_cast<const int8*>(name_stream.str().c_str()));
2758bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
2768bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)        base::Bind(&EmptyReleaseCallback));
2778bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    TextureMailbox mailbox(gpu_mailbox, next_sync_point_);
2788bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    next_sync_point_++;
2798bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
2808bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    tab_contents_->SetTextureMailbox(mailbox, callback.Pass());
2818bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  }
2828bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
283a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  virtual void DidCommit() OVERRIDE {
284a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    if (CleanUpStarted())
285a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)      return;
286a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    layer_tree_host()->SetNeedsCommit();
287a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  }
288a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
289a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  virtual void DidCommitAndDrawFrame() OVERRIDE {
290a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    if (CleanUpStarted())
291a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)      EndTest();
292a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  }
293a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
294a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  virtual void CleanUpAndEndTest(LayerTreeHostImpl* host_impl) OVERRIDE {
295a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    clean_up_started_ = true;
296a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    MainThreadTaskRunner()->PostTask(
297a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)        FROM_HERE,
298a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)        base::Bind(&BrowserCompositorInvalidateLayerTreePerfTest::
299a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                        CleanUpAndEndTestOnMainThread,
300a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                   base::Unretained(this)));
301a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  }
302a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
303a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  void CleanUpAndEndTestOnMainThread() {
304a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    tab_contents_->SetTextureMailbox(TextureMailbox(),
305a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                                     scoped_ptr<SingleReleaseCallback>());
306a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  }
307a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
308a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  virtual bool CleanUpStarted() OVERRIDE { return clean_up_started_; }
309a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
3108bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) private:
3118bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  scoped_refptr<TextureLayer> tab_contents_;
3128bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  unsigned next_sync_point_;
313a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  bool clean_up_started_;
3148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)};
3158bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
3168bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)TEST_F(BrowserCompositorInvalidateLayerTreePerfTest, DenseBrowserUI) {
3178bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  SetTestName("dense_layer_tree");
3188bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  ReadTestFile("dense_layer_tree");
3198bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  RunTestWithImplSidePainting();
3208bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)}
3218bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
322b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)// Simulates a page with several large, transformed and animated layers.
3234e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)TEST_F(LayerTreeHostPerfTestJsonReader, HeavyPageThreadedImplSide) {
324b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  animation_driven_drawing_ = true;
325b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  measure_commit_cost_ = true;
32658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  SetTestName("heavy_page");
327b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  ReadTestFile("heavy_layer_tree");
328a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)  RunTestWithImplSidePainting();
329b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)}
330b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
3314e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)class PageScaleImplSidePaintingPerfTest
3324e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    : public LayerTreeHostPerfTestJsonReader {
333868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) public:
334868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  PageScaleImplSidePaintingPerfTest()
335868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      : max_scale_(16.f), min_scale_(1.f / max_scale_) {}
336868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
337868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual void SetupTree() OVERRIDE {
338868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    layer_tree_host()->SetPageScaleFactorAndLimits(1.f, min_scale_, max_scale_);
339868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  }
340868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
341868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
342868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                                   float scale_delta) OVERRIDE {
343868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    float page_scale_factor = layer_tree_host()->page_scale_factor();
344868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    page_scale_factor *= scale_delta;
345868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    layer_tree_host()->SetPageScaleFactorAndLimits(
346868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)        page_scale_factor, min_scale_, max_scale_);
347868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  }
348868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
349868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual void AnimateLayers(LayerTreeHostImpl* host_impl,
350868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                             base::TimeTicks monotonic_time) OVERRIDE {
351868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    if (!host_impl->pinch_gesture_active()) {
352868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      host_impl->PinchGestureBegin();
353868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      start_time_ = monotonic_time;
354868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    }
355868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    gfx::Point anchor(200, 200);
356868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
357868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    float seconds = (monotonic_time - start_time_).InSecondsF();
358868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
359868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    // Every half second, zoom from min scale to max scale.
360868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    float interval = 0.5f;
361868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
362868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    // Start time in the middle of the interval when zoom = 1.
363868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    seconds += interval / 2.f;
364868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
365868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    // Stack two ranges together to go up from min to max and down from
366868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    // max to min in the next so as not to have a zoom discrepancy.
367868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    float time_in_two_intervals = fmod(seconds, 2.f * interval) / interval;
368868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
369868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    // Map everything to go from min to max between 0 and 1.
370868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    float time_in_one_interval =
371868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)        time_in_two_intervals > 1.f ? 2.f - time_in_two_intervals
372868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                                    : time_in_two_intervals;
373868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    // Normalize time to -1..1.
374868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    float normalized = 2.f * time_in_one_interval - 1.f;
375558790d6acca3451cf3a6b497803a5f07d0bec58Ben Murdoch    float scale_factor = std::abs(normalized) * (max_scale_ - 1.f) + 1.f;
376868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    float total_scale = normalized < 0.f ? 1.f / scale_factor : scale_factor;
377868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
378868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    float desired_delta =
379868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)        total_scale / host_impl->active_tree()->total_page_scale_factor();
380868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    host_impl->PinchGestureUpdate(desired_delta, anchor);
381868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  }
382868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
383868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) private:
384868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  float max_scale_;
385868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  float min_scale_;
386868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  base::TimeTicks start_time_;
387868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)};
388868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
389868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)TEST_F(PageScaleImplSidePaintingPerfTest, HeavyPage) {
390868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  measure_commit_cost_ = true;
39158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  SetTestName("heavy_page_page_scale");
392868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  ReadTestFile("heavy_layer_tree");
393868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  RunTestWithImplSidePainting();
394868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}
395868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
3962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}  // namespace
3972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}  // namespace cc
398