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

Side by Side Diff: cc/raster/tile_task_worker_pool_unittest.cc

Issue 1531013004: cc: Do solid color analysis before scheduling tiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments updated. Created 4 years, 11 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 // 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 "cc/raster/tile_task_worker_pool.h" 5 #include "cc/raster/tile_task_worker_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 enum TileTaskWorkerPoolType { 43 enum TileTaskWorkerPoolType {
44 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, 44 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY,
45 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, 45 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY,
46 TILE_TASK_WORKER_POOL_TYPE_GPU, 46 TILE_TASK_WORKER_POOL_TYPE_GPU,
47 TILE_TASK_WORKER_POOL_TYPE_BITMAP 47 TILE_TASK_WORKER_POOL_TYPE_BITMAP
48 }; 48 };
49 49
50 class TestRasterTaskImpl : public RasterTask { 50 class TestRasterTaskImpl : public RasterTask {
51 public: 51 public:
52 typedef base::Callback<void( 52 typedef base::Callback<void(bool was_canceled)> Reply;
53 const DisplayListRasterSource::SolidColorAnalysis& analysis,
54 bool was_canceled)> Reply;
55 53
56 TestRasterTaskImpl(const Resource* resource, 54 TestRasterTaskImpl(const Resource* resource,
57 const Reply& reply, 55 const Reply& reply,
58 ImageDecodeTask::Vector* dependencies) 56 ImageDecodeTask::Vector* dependencies)
59 : RasterTask(dependencies), 57 : RasterTask(dependencies),
60 resource_(resource), 58 resource_(resource),
61 reply_(reply), 59 reply_(reply),
62 raster_source_( 60 raster_source_(
63 FakeDisplayListRasterSource::CreateFilled(gfx::Size(1, 1))) {} 61 FakeDisplayListRasterSource::CreateFilled(gfx::Size(1, 1))) {}
64 62
65 // Overridden from Task: 63 // Overridden from Task:
66 void RunOnWorkerThread() override { 64 void RunOnWorkerThread() override {
67 uint64_t new_content_id = 0; 65 uint64_t new_content_id = 0;
68 raster_buffer_->Playback(raster_source_.get(), gfx::Rect(1, 1), 66 raster_buffer_->Playback(raster_source_.get(), gfx::Rect(1, 1),
69 gfx::Rect(1, 1), new_content_id, 1.f, true); 67 gfx::Rect(1, 1), new_content_id, 1.f, true);
70 } 68 }
71 69
72 // Overridden from TileTask: 70 // Overridden from TileTask:
73 void ScheduleOnOriginThread(TileTaskClient* client) override { 71 void ScheduleOnOriginThread(TileTaskClient* client) override {
74 // The raster buffer has no tile ids associated with it for partial update, 72 // The raster buffer has no tile ids associated with it for partial update,
75 // so doesn't need to provide a valid dirty rect. 73 // so doesn't need to provide a valid dirty rect.
76 raster_buffer_ = client->AcquireBufferForRaster(resource_, 0, 0); 74 raster_buffer_ = client->AcquireBufferForRaster(resource_, 0, 0);
77 } 75 }
78 void CompleteOnOriginThread(TileTaskClient* client) override { 76 void CompleteOnOriginThread(TileTaskClient* client) override {
79 client->ReleaseBufferForRaster(std::move(raster_buffer_)); 77 client->ReleaseBufferForRaster(std::move(raster_buffer_));
80 reply_.Run(DisplayListRasterSource::SolidColorAnalysis(), 78 reply_.Run(!HasFinishedRunning());
81 !HasFinishedRunning());
82 } 79 }
83 80
84 protected: 81 protected:
85 ~TestRasterTaskImpl() override {} 82 ~TestRasterTaskImpl() override {}
86 83
87 private: 84 private:
88 const Resource* resource_; 85 const Resource* resource_;
89 const Reply reply_; 86 const Reply reply_;
90 scoped_ptr<RasterBuffer> raster_buffer_; 87 scoped_ptr<RasterBuffer> raster_buffer_;
91 scoped_refptr<DisplayListRasterSource> raster_source_; 88 scoped_refptr<DisplayListRasterSource> raster_source_;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 output_surface_ = FakeOutputSurface::CreateSoftware( 258 output_surface_ = FakeOutputSurface::CreateSoftware(
262 make_scoped_ptr(new SoftwareOutputDevice)); 259 make_scoped_ptr(new SoftwareOutputDevice));
263 CHECK(output_surface_->BindToClient(&output_surface_client_)); 260 CHECK(output_surface_->BindToClient(&output_surface_client_));
264 resource_provider_ = FakeResourceProvider::Create( 261 resource_provider_ = FakeResourceProvider::Create(
265 output_surface_.get(), &shared_bitmap_manager_, nullptr); 262 output_surface_.get(), &shared_bitmap_manager_, nullptr);
266 } 263 }
267 264
268 void OnTaskCompleted( 265 void OnTaskCompleted(
269 scoped_ptr<ScopedResource> resource, 266 scoped_ptr<ScopedResource> resource,
270 unsigned id, 267 unsigned id,
271 const DisplayListRasterSource::SolidColorAnalysis& analysis,
272 bool was_canceled) { 268 bool was_canceled) {
273 RasterTaskResult result; 269 RasterTaskResult result;
274 result.id = id; 270 result.id = id;
275 result.canceled = was_canceled; 271 result.canceled = was_canceled;
276 completed_tasks_.push_back(result); 272 completed_tasks_.push_back(result);
277 } 273 }
278 274
279 void OnTimeout() { 275 void OnTimeout() {
280 timed_out_ = true; 276 timed_out_ = true;
281 base::MessageLoop::current()->QuitWhenIdle(); 277 base::MessageLoop::current()->QuitWhenIdle();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 364
369 INSTANTIATE_TEST_CASE_P(TileTaskWorkerPoolTests, 365 INSTANTIATE_TEST_CASE_P(TileTaskWorkerPoolTests,
370 TileTaskWorkerPoolTest, 366 TileTaskWorkerPoolTest,
371 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, 367 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY,
372 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, 368 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY,
373 TILE_TASK_WORKER_POOL_TYPE_GPU, 369 TILE_TASK_WORKER_POOL_TYPE_GPU,
374 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); 370 TILE_TASK_WORKER_POOL_TYPE_BITMAP));
375 371
376 } // namespace 372 } // namespace
377 } // namespace cc 373 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698