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

Side by Side Diff: cc/tiles/tile_manager_perftest.cc

Issue 1515843002: Fix invalid cast in tile_manager_perftest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « no previous file | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/lazy_instance.h" 5 #include "base/lazy_instance.h"
6 #include "base/location.h" 6 #include "base/location.h"
7 #include "base/thread_task_runner_handle.h" 7 #include "base/thread_task_runner_handle.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "cc/debug/lap_timer.h" 9 #include "cc/debug/lap_timer.h"
10 #include "cc/raster/raster_buffer.h" 10 #include "cc/raster/raster_buffer.h"
(...skipping 22 matching lines...) Expand all
33 static const int kTimeLimitMillis = 2000; 33 static const int kTimeLimitMillis = 2000;
34 static const int kWarmupRuns = 5; 34 static const int kWarmupRuns = 5;
35 static const int kTimeCheckInterval = 10; 35 static const int kTimeCheckInterval = 10;
36 36
37 class FakeTileTaskRunnerImpl : public TileTaskRunner, public TileTaskClient { 37 class FakeTileTaskRunnerImpl : public TileTaskRunner, public TileTaskClient {
38 public: 38 public:
39 // Overridden from TileTaskRunner: 39 // Overridden from TileTaskRunner:
40 void Shutdown() override {} 40 void Shutdown() override {}
41 void ScheduleTasks(TaskGraph* graph) override { 41 void ScheduleTasks(TaskGraph* graph) override {
42 for (auto& node : graph->nodes) { 42 for (auto& node : graph->nodes) {
43 RasterTask* task = static_cast<RasterTask*>(node.task); 43 TileTask* task = static_cast<TileTask*>(node.task);
44 44
45 task->WillSchedule(); 45 task->WillSchedule();
46 task->ScheduleOnOriginThread(this); 46 task->ScheduleOnOriginThread(this);
47 task->DidSchedule(); 47 task->DidSchedule();
48 48
49 completed_tasks_.push_back(task); 49 completed_tasks_.push_back(task);
50 } 50 }
51 } 51 }
52 void CheckForCompletedTasks() override { 52 void CheckForCompletedTasks() override {
53 for (RasterTask::Vector::iterator it = completed_tasks_.begin(); 53 for (TileTask::Vector::iterator it = completed_tasks_.begin();
54 it != completed_tasks_.end(); 54 it != completed_tasks_.end(); ++it) {
55 ++it) { 55 TileTask* task = it->get();
56 RasterTask* task = it->get();
57 56
58 task->WillComplete(); 57 task->WillComplete();
59 task->CompleteOnOriginThread(this); 58 task->CompleteOnOriginThread(this);
60 task->DidComplete(); 59 task->DidComplete();
61 } 60 }
62 completed_tasks_.clear(); 61 completed_tasks_.clear();
63 } 62 }
64 ResourceFormat GetResourceFormat(bool must_support_alpha) const override { 63 ResourceFormat GetResourceFormat(bool must_support_alpha) const override {
65 return RGBA_8888; 64 return RGBA_8888;
66 } 65 }
67 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override { 66 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override {
68 return !PlatformColor::SameComponentOrder( 67 return !PlatformColor::SameComponentOrder(
69 GetResourceFormat(must_support_alpha)); 68 GetResourceFormat(must_support_alpha));
70 } 69 }
71 70
72 // Overridden from TileTaskClient: 71 // Overridden from TileTaskClient:
73 scoped_ptr<RasterBuffer> AcquireBufferForRaster( 72 scoped_ptr<RasterBuffer> AcquireBufferForRaster(
74 const Resource* resource, 73 const Resource* resource,
75 uint64_t new_content_id, 74 uint64_t new_content_id,
76 uint64_t previous_content_id) override { 75 uint64_t previous_content_id) override {
77 return nullptr; 76 return nullptr;
78 } 77 }
79 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override {} 78 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override {}
80 79
81 private: 80 private:
82 RasterTask::Vector completed_tasks_; 81 TileTask::Vector completed_tasks_;
83 }; 82 };
84 base::LazyInstance<FakeTileTaskRunnerImpl> g_fake_tile_task_runner = 83 base::LazyInstance<FakeTileTaskRunnerImpl> g_fake_tile_task_runner =
85 LAZY_INSTANCE_INITIALIZER; 84 LAZY_INSTANCE_INITIALIZER;
86 85
87 class TileManagerPerfTest : public testing::Test { 86 class TileManagerPerfTest : public testing::Test {
88 public: 87 public:
89 TileManagerPerfTest() 88 TileManagerPerfTest()
90 : memory_limit_policy_(ALLOW_ANYTHING), 89 : memory_limit_policy_(ALLOW_ANYTHING),
91 max_tiles_(10000), 90 max_tiles_(10000),
92 id_(7), 91 id_(7),
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); 477 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64);
479 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); 478 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128);
480 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); 479 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16);
481 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); 480 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32);
482 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); 481 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64);
483 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); 482 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128);
484 } 483 }
485 484
486 } // namespace 485 } // namespace
487 } // namespace cc 486 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698