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

Unified Diff: cc/tiles/tile_manager.cc

Issue 1863053002: cc: Encapsulate rastering related data in RasteringInfo. Base URL: https://chromium.googlesource.com/chromium/src.git@refactor_one_copy
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/raster/rastering_info.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/tile_manager.cc
diff --git a/cc/tiles/tile_manager.cc b/cc/tiles/tile_manager.cc
index 6ecdd23a669d6a820b63735efa8f2be3e585fa9b..4fd8b4fa4f7cac4b5779d7be18e88c1876d70d0a 100644
--- a/cc/tiles/tile_manager.cc
+++ b/cc/tiles/tile_manager.cc
@@ -23,6 +23,7 @@
#include "cc/debug/frame_viewer_instrumentation.h"
#include "cc/debug/traced_value.h"
#include "cc/layers/picture_layer_impl.h"
+#include "cc/raster/rastering_info.h"
#include "cc/raster/task_category.h"
#include "cc/raster/tile_task_runner.h"
#include "cc/tiles/tile.h"
@@ -42,95 +43,54 @@ DEFINE_SCOPED_UMA_HISTOGRAM_AREA_TIMER(
class RasterTaskImpl : public Task {
public:
- RasterTaskImpl(RasterBufferProvider* raster_buffer_provider,
- const Resource* resource,
- scoped_refptr<RasterSource> raster_source,
- const gfx::Rect& content_rect,
- const gfx::Rect& invalid_content_rect,
- float contents_scale,
- const RasterSource::PlaybackSettings& playback_settings,
- TileResolution tile_resolution,
- int layer_id,
- uint64_t source_prepare_tiles_id,
- const void* tile,
- uint64_t new_content_id,
- uint64_t previous_content_id,
- uint64_t resource_content_id,
- int source_frame_number,
- const base::Callback<void(bool)>& reply,
+ RasterTaskImpl(scoped_ptr<RasteringInfo> rastering_info,
Task::Vector* dependencies)
- : Task(dependencies),
- raster_buffer_provider_(raster_buffer_provider),
- resource_(resource),
- raster_source_(std::move(raster_source)),
- content_rect_(content_rect),
- invalid_content_rect_(invalid_content_rect),
- contents_scale_(contents_scale),
- playback_settings_(playback_settings),
- tile_resolution_(tile_resolution),
- layer_id_(layer_id),
- source_prepare_tiles_id_(source_prepare_tiles_id),
- tile_(tile),
- new_content_id_(new_content_id),
- previous_content_id_(previous_content_id),
- resource_content_id_(resource_content_id),
- source_frame_number_(source_frame_number),
- reply_(reply) {}
+ : Task(dependencies), rastering_info_(std::move(rastering_info)) {}
// Overridden from Task:
void ScheduleOnOriginThread() override {
- DCHECK(raster_buffer_provider_);
- DCHECK(!raster_buffer_);
- raster_buffer_ = raster_buffer_provider_->AcquireBufferForRaster(
- resource_, resource_content_id_, previous_content_id_);
+ DCHECK(rastering_info_->raster_buffer_provider);
+ DCHECK(!rastering_info_->raster_buffer);
+ rastering_info_->raster_buffer =
+ rastering_info_->raster_buffer_provider->AcquireBufferForRaster(
+ rastering_info_->resource, rastering_info_->resource_content_id,
+ rastering_info_->previous_content_id);
}
void CompleteOnOriginThread() override {
- DCHECK(raster_buffer_provider_);
- raster_buffer_provider_->ReleaseBufferForRaster(std::move(raster_buffer_));
- reply_.Run(!HasFinishedRunning());
+ DCHECK(rastering_info_->raster_buffer_provider);
+ rastering_info_->raster_buffer_provider->ReleaseBufferForRaster(
+ std::move(rastering_info_->raster_buffer));
+ rastering_info_->reply.Run(!HasFinishedRunning());
}
void RunOnWorkerThread() override {
TRACE_EVENT1("cc", "RasterizerTaskImpl::RunOnWorkerThread",
- "source_prepare_tiles_id", source_prepare_tiles_id_);
+ "source_prepare_tiles_id",
+ rastering_info_->source_prepare_tiles_id);
- DCHECK(raster_source_.get());
- DCHECK(raster_buffer_);
+ DCHECK(rastering_info_->raster_source.get());
+ DCHECK(rastering_info_->raster_buffer);
frame_viewer_instrumentation::ScopedRasterTask raster_task(
- tile_, tile_resolution_, source_frame_number_, layer_id_);
+ rastering_info_->tile, rastering_info_->tile_resolution,
+ rastering_info_->source_frame_number, rastering_info_->layer_id);
ScopedRasterTaskTimer timer;
- timer.SetArea(content_rect_.size().GetArea());
+ timer.SetArea(rastering_info_->content_rect.size().GetArea());
- DCHECK(raster_source_);
+ DCHECK(rastering_info_->raster_source);
- raster_buffer_->Playback(raster_source_.get(), content_rect_,
- invalid_content_rect_, new_content_id_,
- contents_scale_, playback_settings_);
+ rastering_info_->raster_buffer->Playback(
+ rastering_info_->raster_source.get(), rastering_info_->content_rect,
+ rastering_info_->invalid_content_rect, rastering_info_->new_content_id,
+ rastering_info_->contents_scale, rastering_info_->playback_settings);
}
protected:
- ~RasterTaskImpl() override { DCHECK(!raster_buffer_); }
+ ~RasterTaskImpl() override { DCHECK(!rastering_info_->raster_buffer); }
private:
- RasterBufferProvider* raster_buffer_provider_;
- const Resource* resource_;
- scoped_refptr<RasterSource> raster_source_;
- gfx::Rect content_rect_;
- gfx::Rect invalid_content_rect_;
- float contents_scale_;
- RasterSource::PlaybackSettings playback_settings_;
- TileResolution tile_resolution_;
- int layer_id_;
- uint64_t source_prepare_tiles_id_;
- const void* tile_;
- uint64_t new_content_id_;
- uint64_t previous_content_id_;
- uint64_t resource_content_id_;
- int source_frame_number_;
- const base::Callback<void(bool)> reply_;
- scoped_ptr<RasterBuffer> raster_buffer_;
+ scoped_ptr<RasteringInfo> rastering_info_;
DISALLOW_COPY_AND_ASSIGN(RasterTaskImpl);
};
@@ -879,7 +839,7 @@ scoped_refptr<Task> TileManager::CreateRasterTask(
it = images.erase(it);
}
- return make_scoped_refptr(new RasterTaskImpl(
+ scoped_ptr<RasteringInfo> rastering_info = RasteringInfo::Create(
tile_task_runner_, resource, prioritized_tile.raster_source(),
tile->content_rect(), tile->invalidated_content_rect(),
tile->contents_scale(), playback_settings,
@@ -887,8 +847,9 @@ scoped_refptr<Task> TileManager::CreateRasterTask(
prepare_tiles_count_, static_cast<const void*>(tile), tile->id(),
tile->invalidated_id(), resource_content_id, tile->source_frame_number(),
base::Bind(&TileManager::OnRasterTaskCompleted, base::Unretained(this),
- tile->id(), resource),
- &decode_tasks));
+ tile->id(), resource));
+ return make_scoped_refptr(
+ new RasterTaskImpl(std::move(rastering_info), &decode_tasks));
}
void TileManager::OnRasterTaskCompleted(
« no previous file with comments | « cc/raster/rastering_info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698