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

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

Issue 1405883002: cc: Remove the base RasterSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge more Created 5 years, 2 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
« no previous file with comments | « cc/tiles/tile_manager.h ('k') | cc/tiles/tile_manager_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/tiles/tile_manager.h" 5 #include "cc/tiles/tile_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 10
(...skipping 20 matching lines...) Expand all
31 // a tile is of solid color. 31 // a tile is of solid color.
32 const bool kUseColorEstimator = true; 32 const bool kUseColorEstimator = true;
33 33
34 DEFINE_SCOPED_UMA_HISTOGRAM_AREA_TIMER( 34 DEFINE_SCOPED_UMA_HISTOGRAM_AREA_TIMER(
35 ScopedRasterTaskTimer, 35 ScopedRasterTaskTimer,
36 "Compositing.%s.RasterTask.RasterUs", 36 "Compositing.%s.RasterTask.RasterUs",
37 "Compositing.%s.RasterTask.RasterPixelsPerMs"); 37 "Compositing.%s.RasterTask.RasterPixelsPerMs");
38 38
39 class RasterTaskImpl : public RasterTask { 39 class RasterTaskImpl : public RasterTask {
40 public: 40 public:
41 RasterTaskImpl( 41 RasterTaskImpl(const Resource* resource,
42 const Resource* resource, 42 DisplayListRasterSource* raster_source,
43 RasterSource* raster_source, 43 const gfx::Rect& content_rect,
44 const gfx::Rect& content_rect, 44 const gfx::Rect& invalid_content_rect,
45 const gfx::Rect& invalid_content_rect, 45 float contents_scale,
46 float contents_scale, 46 TileResolution tile_resolution,
47 TileResolution tile_resolution, 47 int layer_id,
48 int layer_id, 48 uint64_t source_prepare_tiles_id,
49 uint64_t source_prepare_tiles_id, 49 const void* tile,
50 const void* tile, 50 uint64_t new_content_id,
51 uint64_t new_content_id, 51 uint64_t previous_content_id,
52 uint64_t previous_content_id, 52 uint64_t resource_content_id,
53 uint64_t resource_content_id, 53 int source_frame_number,
54 int source_frame_number, 54 bool analyze_picture,
55 bool analyze_picture, 55 const base::Callback<
56 const base::Callback<void(const RasterSource::SolidColorAnalysis&, bool)>& 56 void(const DisplayListRasterSource::SolidColorAnalysis&,
57 reply, 57 bool)>& reply,
58 ImageDecodeTask::Vector* dependencies) 58 ImageDecodeTask::Vector* dependencies)
59 : RasterTask(dependencies), 59 : RasterTask(dependencies),
60 resource_(resource), 60 resource_(resource),
61 raster_source_(raster_source), 61 raster_source_(raster_source),
62 content_rect_(content_rect), 62 content_rect_(content_rect),
63 invalid_content_rect_(invalid_content_rect), 63 invalid_content_rect_(invalid_content_rect),
64 contents_scale_(contents_scale), 64 contents_scale_(contents_scale),
65 tile_resolution_(tile_resolution), 65 tile_resolution_(tile_resolution),
66 layer_id_(layer_id), 66 layer_id_(layer_id),
67 source_prepare_tiles_id_(source_prepare_tiles_id), 67 source_prepare_tiles_id_(source_prepare_tiles_id),
68 tile_(tile), 68 tile_(tile),
(...skipping 29 matching lines...) Expand all
98 } 98 }
99 void CompleteOnOriginThread(TileTaskClient* client) override { 99 void CompleteOnOriginThread(TileTaskClient* client) override {
100 client->ReleaseBufferForRaster(raster_buffer_.Pass()); 100 client->ReleaseBufferForRaster(raster_buffer_.Pass());
101 reply_.Run(analysis_, !HasFinishedRunning()); 101 reply_.Run(analysis_, !HasFinishedRunning());
102 } 102 }
103 103
104 protected: 104 protected:
105 ~RasterTaskImpl() override { DCHECK(!raster_buffer_); } 105 ~RasterTaskImpl() override { DCHECK(!raster_buffer_); }
106 106
107 private: 107 private:
108 void Analyze(const RasterSource* raster_source) { 108 void Analyze(const DisplayListRasterSource* raster_source) {
109 frame_viewer_instrumentation::ScopedAnalyzeTask analyze_task( 109 frame_viewer_instrumentation::ScopedAnalyzeTask analyze_task(
110 tile_, tile_resolution_, source_frame_number_, layer_id_); 110 tile_, tile_resolution_, source_frame_number_, layer_id_);
111 111
112 DCHECK(raster_source); 112 DCHECK(raster_source);
113 113
114 raster_source->PerformSolidColorAnalysis(content_rect_, contents_scale_, 114 raster_source->PerformSolidColorAnalysis(content_rect_, contents_scale_,
115 &analysis_); 115 &analysis_);
116 // Clear the flag if we're not using the estimator. 116 // Clear the flag if we're not using the estimator.
117 analysis_.is_solid_color &= kUseColorEstimator; 117 analysis_.is_solid_color &= kUseColorEstimator;
118 } 118 }
119 119
120 void Raster(const RasterSource* raster_source) { 120 void Raster(const DisplayListRasterSource* raster_source) {
121 frame_viewer_instrumentation::ScopedRasterTask raster_task( 121 frame_viewer_instrumentation::ScopedRasterTask raster_task(
122 tile_, tile_resolution_, source_frame_number_, layer_id_); 122 tile_, tile_resolution_, source_frame_number_, layer_id_);
123 ScopedRasterTaskTimer timer; 123 ScopedRasterTaskTimer timer;
124 timer.SetArea(content_rect_.size().GetArea()); 124 timer.SetArea(content_rect_.size().GetArea());
125 125
126 DCHECK(raster_source); 126 DCHECK(raster_source);
127 127
128 bool include_images = tile_resolution_ != LOW_RESOLUTION; 128 bool include_images = tile_resolution_ != LOW_RESOLUTION;
129 raster_buffer_->Playback(raster_source_.get(), content_rect_, 129 raster_buffer_->Playback(raster_source_.get(), content_rect_,
130 invalid_content_rect_, new_content_id_, 130 invalid_content_rect_, new_content_id_,
131 contents_scale_, include_images); 131 contents_scale_, include_images);
132 } 132 }
133 133
134 const Resource* resource_; 134 const Resource* resource_;
135 RasterSource::SolidColorAnalysis analysis_; 135 DisplayListRasterSource::SolidColorAnalysis analysis_;
136 scoped_refptr<RasterSource> raster_source_; 136 scoped_refptr<DisplayListRasterSource> raster_source_;
137 gfx::Rect content_rect_; 137 gfx::Rect content_rect_;
138 gfx::Rect invalid_content_rect_; 138 gfx::Rect invalid_content_rect_;
139 float contents_scale_; 139 float contents_scale_;
140 TileResolution tile_resolution_; 140 TileResolution tile_resolution_;
141 int layer_id_; 141 int layer_id_;
142 uint64_t source_prepare_tiles_id_; 142 uint64_t source_prepare_tiles_id_;
143 const void* tile_; 143 const void* tile_;
144 uint64_t new_content_id_; 144 uint64_t new_content_id_;
145 uint64_t previous_content_id_; 145 uint64_t previous_content_id_;
146 uint64_t resource_content_id_; 146 uint64_t resource_content_id_;
147 int source_frame_number_; 147 int source_frame_number_;
148 bool analyze_picture_; 148 bool analyze_picture_;
149 const base::Callback<void(const RasterSource::SolidColorAnalysis&, bool)> 149 const base::Callback<void(const DisplayListRasterSource::SolidColorAnalysis&,
150 reply_; 150 bool)> reply_;
151 scoped_ptr<RasterBuffer> raster_buffer_; 151 scoped_ptr<RasterBuffer> raster_buffer_;
152 152
153 DISALLOW_COPY_AND_ASSIGN(RasterTaskImpl); 153 DISALLOW_COPY_AND_ASSIGN(RasterTaskImpl);
154 }; 154 };
155 155
156 const char* TaskSetName(TaskSet task_set) { 156 const char* TaskSetName(TaskSet task_set) {
157 switch (task_set) { 157 switch (task_set) {
158 case TileManager::ALL: 158 case TileManager::ALL:
159 return "ALL"; 159 return "ALL";
160 case TileManager::REQUIRED_FOR_ACTIVATION: 160 case TileManager::REQUIRED_FOR_ACTIVATION:
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 tile->invalidated_id(), resource_content_id, tile->source_frame_number(), 693 tile->invalidated_id(), resource_content_id, tile->source_frame_number(),
694 tile->use_picture_analysis(), 694 tile->use_picture_analysis(),
695 base::Bind(&TileManager::OnRasterTaskCompleted, base::Unretained(this), 695 base::Bind(&TileManager::OnRasterTaskCompleted, base::Unretained(this),
696 tile->id(), resource), 696 tile->id(), resource),
697 &decode_tasks)); 697 &decode_tasks));
698 } 698 }
699 699
700 void TileManager::OnRasterTaskCompleted( 700 void TileManager::OnRasterTaskCompleted(
701 Tile::Id tile_id, 701 Tile::Id tile_id,
702 Resource* resource, 702 Resource* resource,
703 const RasterSource::SolidColorAnalysis& analysis, 703 const DisplayListRasterSource::SolidColorAnalysis& analysis,
704 bool was_canceled) { 704 bool was_canceled) {
705 DCHECK(tiles_.find(tile_id) != tiles_.end()); 705 DCHECK(tiles_.find(tile_id) != tiles_.end());
706 706
707 Tile* tile = tiles_[tile_id]; 707 Tile* tile = tiles_[tile_id];
708 DCHECK(tile->raster_task_.get()); 708 DCHECK(tile->raster_task_.get());
709 orphan_raster_tasks_.push_back(tile->raster_task_); 709 orphan_raster_tasks_.push_back(tile->raster_task_);
710 tile->raster_task_ = nullptr; 710 tile->raster_task_ = nullptr;
711 711
712 if (was_canceled) { 712 if (was_canceled) {
713 ++flush_stats_.canceled_count; 713 ++flush_stats_.canceled_count;
714 // TODO(ericrk): If more partial raster work is done in the future, it may 714 // TODO(ericrk): If more partial raster work is done in the future, it may
715 // be worth returning the resource to the pool with its previous ID (not 715 // be worth returning the resource to the pool with its previous ID (not
716 // currently tracked). crrev.com/1370333002/#ps40001 has a possible method 716 // currently tracked). crrev.com/1370333002/#ps40001 has a possible method
717 // of achieving this. 717 // of achieving this.
718 resource_pool_->ReleaseResource(resource, 0 /* content_id */); 718 resource_pool_->ReleaseResource(resource, 0 /* content_id */);
719 return; 719 return;
720 } 720 }
721 721
722 UpdateTileDrawInfo(tile, resource, analysis); 722 UpdateTileDrawInfo(tile, resource, analysis);
723 } 723 }
724 724
725 void TileManager::UpdateTileDrawInfo( 725 void TileManager::UpdateTileDrawInfo(
726 Tile* tile, 726 Tile* tile,
727 Resource* resource, 727 Resource* resource,
728 const RasterSource::SolidColorAnalysis& analysis) { 728 const DisplayListRasterSource::SolidColorAnalysis& analysis) {
729 TileDrawInfo& draw_info = tile->draw_info(); 729 TileDrawInfo& draw_info = tile->draw_info();
730 730
731 ++flush_stats_.completed_count; 731 ++flush_stats_.completed_count;
732 732
733 if (analysis.is_solid_color) { 733 if (analysis.is_solid_color) {
734 draw_info.set_solid_color(analysis.solid_color); 734 draw_info.set_solid_color(analysis.solid_color);
735 if (resource) { 735 if (resource) {
736 // TODO(ericrk): If more partial raster work is done in the future, it may 736 // TODO(ericrk): If more partial raster work is done in the future, it may
737 // be worth returning the resource to the pool with its previous ID (not 737 // be worth returning the resource to the pool with its previous ID (not
738 // currently tracked). crrev.com/1370333002/#ps40001 has a possible method 738 // currently tracked). crrev.com/1370333002/#ps40001 has a possible method
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 void TileManager::Signals::reset() { 1002 void TileManager::Signals::reset() {
1003 ready_to_activate = false; 1003 ready_to_activate = false;
1004 did_notify_ready_to_activate = false; 1004 did_notify_ready_to_activate = false;
1005 ready_to_draw = false; 1005 ready_to_draw = false;
1006 did_notify_ready_to_draw = false; 1006 did_notify_ready_to_draw = false;
1007 all_tile_tasks_completed = false; 1007 all_tile_tasks_completed = false;
1008 did_notify_all_tile_tasks_completed = false; 1008 did_notify_all_tile_tasks_completed = false;
1009 } 1009 }
1010 1010
1011 } // namespace cc 1011 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager.h ('k') | cc/tiles/tile_manager_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698