diff options
author | hendrikw <hendrikw@chromium.org> | 2014-11-04 14:28:35 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-04 22:29:01 +0000 |
commit | 9b7f6d9839634f19cead07d91d1e3ea9dbfae139 (patch) | |
tree | 172fe159e14d38d646b16ef043561736f9d17dab /cc | |
parent | d04216fc7f51a90440ffa7bcf6a492d7bddb187f (diff) | |
download | chromium_src-9b7f6d9839634f19cead07d91d1e3ea9dbfae139.zip chromium_src-9b7f6d9839634f19cead07d91d1e3ea9dbfae139.tar.gz chromium_src-9b7f6d9839634f19cead07d91d1e3ea9dbfae139.tar.bz2 |
cc: Remove some of the instrumentation plumbing
Code cleanup
Since rasterize_time, analysis_time and rasterized_pixel_count are
no longer used, they can be removed and as a result, a lot of
plumbing to push these stats around can also be removed.
R=vmpstr, ernstm, reveman
Review URL: https://codereview.chromium.org/683863003
Cr-Commit-Position: refs/heads/master@{#302684}
Diffstat (limited to 'cc')
29 files changed, 88 insertions, 256 deletions
diff --git a/cc/debug/rasterize_and_record_benchmark_impl.cc b/cc/debug/rasterize_and_record_benchmark_impl.cc index b984655..2ffac1b 100644 --- a/cc/debug/rasterize_and_record_benchmark_impl.cc +++ b/cc/debug/rasterize_and_record_benchmark_impl.cc @@ -56,10 +56,10 @@ class BenchmarkRasterTask : public Task { SkCanvas canvas(bitmap); RasterSource::SolidColorAnalysis analysis; - raster_source_->PerformSolidColorAnalysis( - content_rect_, contents_scale_, &analysis, nullptr); - raster_source_->PlaybackToCanvas( - &canvas, content_rect_, contents_scale_, nullptr); + raster_source_->PerformSolidColorAnalysis(content_rect_, + contents_scale_, &analysis); + raster_source_->PlaybackToCanvas(&canvas, content_rect_, + contents_scale_); is_solid_color_ = analysis.is_solid_color; diff --git a/cc/debug/rendering_stats.cc b/cc/debug/rendering_stats.cc index 17a7b96..558c882 100644 --- a/cc/debug/rendering_stats.cc +++ b/cc/debug/rendering_stats.cc @@ -60,7 +60,6 @@ void RenderingStats::MainThreadRenderingStats::Add( RenderingStats::ImplThreadRenderingStats::ImplThreadRenderingStats() : frame_count(0), - rasterized_pixel_count(0), visible_content_area(0), approximated_visible_content_area(0) { } @@ -73,8 +72,6 @@ RenderingStats::ImplThreadRenderingStats::AsTraceableData() const { scoped_refptr<base::debug::TracedValue> record_data = new base::debug::TracedValue(); record_data->SetInteger("frame_count", frame_count); - record_data->SetDouble("rasterize_time", rasterize_time.InSecondsF()); - record_data->SetInteger("rasterized_pixel_count", rasterized_pixel_count); record_data->SetInteger("visible_content_area", visible_content_area); record_data->SetInteger("approximated_visible_content_area", approximated_visible_content_area); @@ -108,9 +105,6 @@ RenderingStats::ImplThreadRenderingStats::AsTraceableData() const { void RenderingStats::ImplThreadRenderingStats::Add( const ImplThreadRenderingStats& other) { frame_count += other.frame_count; - rasterize_time += other.rasterize_time; - analysis_time += other.analysis_time; - rasterized_pixel_count += other.rasterized_pixel_count; visible_content_area += other.visible_content_area; approximated_visible_content_area += other.approximated_visible_content_area; diff --git a/cc/debug/rendering_stats.h b/cc/debug/rendering_stats.h index a77187e..7b1898a 100644 --- a/cc/debug/rendering_stats.h +++ b/cc/debug/rendering_stats.h @@ -55,9 +55,6 @@ struct CC_EXPORT RenderingStats { // rendering_stats.cc. int64 frame_count; - base::TimeDelta rasterize_time; - base::TimeDelta analysis_time; - int64 rasterized_pixel_count; int64 visible_content_area; int64 approximated_visible_content_area; diff --git a/cc/debug/rendering_stats_instrumentation.cc b/cc/debug/rendering_stats_instrumentation.cc index fb7ec52..f5f2e07 100644 --- a/cc/debug/rendering_stats_instrumentation.cc +++ b/cc/debug/rendering_stats_instrumentation.cc @@ -99,25 +99,6 @@ void RenderingStatsInstrumentation::AddRecord(base::TimeDelta duration, main_thread_rendering_stats_.recorded_pixel_count += pixels; } -void RenderingStatsInstrumentation::AddRaster(base::TimeDelta duration, - int64 pixels) { - if (!record_rendering_stats_) - return; - - base::AutoLock scoped_lock(lock_); - impl_thread_rendering_stats_.rasterize_time += duration; - impl_thread_rendering_stats_.rasterized_pixel_count += pixels; -} - -void RenderingStatsInstrumentation::AddAnalysis(base::TimeDelta duration, - int64 pixels) { - if (!record_rendering_stats_) - return; - - base::AutoLock scoped_lock(lock_); - impl_thread_rendering_stats_.analysis_time += duration; -} - void RenderingStatsInstrumentation::AddVisibleContentArea(int64 area) { if (!record_rendering_stats_) return; diff --git a/cc/debug/rendering_stats_instrumentation.h b/cc/debug/rendering_stats_instrumentation.h index fd7f5c9..734583a 100644 --- a/cc/debug/rendering_stats_instrumentation.h +++ b/cc/debug/rendering_stats_instrumentation.h @@ -50,8 +50,6 @@ class CC_EXPORT RenderingStatsInstrumentation { void IncrementFrameCount(int64 count); void AddPaint(base::TimeDelta duration, int64 pixels); void AddRecord(base::TimeDelta duration, int64 pixels); - void AddRaster(base::TimeDelta duration, int64 pixels); - void AddAnalysis(base::TimeDelta duration, int64 pixels); void AddVisibleContentArea(int64 area); void AddApproximatedVisibleContentArea(int64 area); void AddDrawDuration(base::TimeDelta draw_duration, diff --git a/cc/layers/delegated_renderer_layer_impl_unittest.cc b/cc/layers/delegated_renderer_layer_impl_unittest.cc index 3fb1c48..5a797f9 100644 --- a/cc/layers/delegated_renderer_layer_impl_unittest.cc +++ b/cc/layers/delegated_renderer_layer_impl_unittest.cc @@ -13,7 +13,6 @@ #include "cc/test/fake_layer_tree_host_impl_client.h" #include "cc/test/fake_output_surface.h" #include "cc/test/fake_proxy.h" -#include "cc/test/fake_rendering_stats_instrumentation.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/layer_test_common.h" #include "cc/test/render_pass_test_common.h" diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc index 6b2d4c9..a46386c 100644 --- a/cc/layers/picture_layer_impl_unittest.cc +++ b/cc/layers/picture_layer_impl_unittest.cc @@ -268,8 +268,8 @@ class PictureLayerImplTest : public testing::Test { std::vector<SkRect>::const_iterator rect_iter = rects.begin(); for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) { MockCanvas mock_canvas(1000, 1000); - active_pile->RasterDirect( - &mock_canvas, (*tile_iter)->content_rect(), 1.0f, nullptr); + active_pile->RasterDirect(&mock_canvas, (*tile_iter)->content_rect(), + 1.0f); // This test verifies that when drawing the contents of a specific tile // at content scale 1.0, the playback canvas never receives content from diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc index 0f3112c..9c814be 100644 --- a/cc/layers/tiled_layer_unittest.cc +++ b/cc/layers/tiled_layer_unittest.cc @@ -18,7 +18,6 @@ #include "cc/test/fake_output_surface.h" #include "cc/test/fake_output_surface_client.h" #include "cc/test/fake_proxy.h" -#include "cc/test/fake_rendering_stats_instrumentation.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/test/tiled_layer_test_common.h" diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 6560876..02303ac 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -2005,8 +2005,8 @@ void GLRenderer::DrawPictureQuad(const DrawingFrame* frame, } SkCanvas canvas(on_demand_tile_raster_bitmap_); - quad->picture_pile->PlaybackToCanvas( - &canvas, quad->content_rect, quad->contents_scale, NULL); + quad->picture_pile->PlaybackToCanvas(&canvas, quad->content_rect, + quad->contents_scale); uint8_t* bitmap_pixels = NULL; SkBitmap on_demand_tile_raster_bitmap_dest; diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc index 010b1fa..06f1851 100644 --- a/cc/output/software_renderer.cc +++ b/cc/output/software_renderer.cc @@ -350,8 +350,8 @@ void SoftwareRenderer::DrawPictureQuad(const DrawingFrame* frame, TRACE_EVENT0("cc", "SoftwareRenderer::DrawPictureQuad"); - quad->picture_pile->RasterDirect( - current_canvas_, quad->content_rect, quad->contents_scale, NULL); + quad->picture_pile->RasterDirect(current_canvas_, quad->content_rect, + quad->contents_scale); current_canvas_->setDrawFilter(NULL); } diff --git a/cc/resources/bitmap_raster_worker_pool.cc b/cc/resources/bitmap_raster_worker_pool.cc index f58f293..3b3739a 100644 --- a/cc/resources/bitmap_raster_worker_pool.cc +++ b/cc/resources/bitmap_raster_worker_pool.cc @@ -26,9 +26,8 @@ class RasterBufferImpl : public RasterBuffer { // Overridden from RasterBuffer: void Playback(const RasterSource* raster_source, const gfx::Rect& rect, - float scale, - RenderingStatsInstrumentation* stats) override { - raster_source->PlaybackToCanvas(lock_.sk_canvas(), rect, scale, stats); + float scale) override { + raster_source->PlaybackToCanvas(lock_.sk_canvas(), rect, scale); } private: diff --git a/cc/resources/bitmap_skpicture_content_layer_updater.cc b/cc/resources/bitmap_skpicture_content_layer_updater.cc index 5b4187d..5b8e5e4 100644 --- a/cc/resources/bitmap_skpicture_content_layer_updater.cc +++ b/cc/resources/bitmap_skpicture_content_layer_updater.cc @@ -74,14 +74,7 @@ void BitmapSkPictureContentLayerUpdater::PaintContentsRect( // Translate the origin of content_rect to that of source_rect. canvas->translate(paint_rect().x() - source_rect.x(), paint_rect().y() - source_rect.y()); - base::TimeTicks start_time = - rendering_stats_instrumentation_->StartRecording(); DrawPicture(canvas); - base::TimeDelta duration = - rendering_stats_instrumentation_->EndRecording(start_time); - rendering_stats_instrumentation_->AddRaster( - duration, - source_rect.width() * source_rect.height()); } } // namespace cc diff --git a/cc/resources/gpu_raster_worker_pool.cc b/cc/resources/gpu_raster_worker_pool.cc index 3237500..04724f1 100644 --- a/cc/resources/gpu_raster_worker_pool.cc +++ b/cc/resources/gpu_raster_worker_pool.cc @@ -36,8 +36,7 @@ class RasterBufferImpl : public RasterBuffer { // Overridden from RasterBuffer: void Playback(const RasterSource* raster_source, const gfx::Rect& rect, - float scale, - RenderingStatsInstrumentation* stats) override { + float scale) override { // Turn on distance fields for layers that have ever animated. bool use_distance_field_text = use_distance_field_text_ || @@ -53,7 +52,7 @@ class RasterBufferImpl : public RasterBuffer { skia::SharePtr(recorder.beginRecording(size.width(), size.height())); canvas->save(); - raster_source->PlaybackToCanvas(canvas.get(), rect, scale, stats); + raster_source->PlaybackToCanvas(canvas.get(), rect, scale); canvas->restore(); // Add the canvas and recorded picture to |multi_picture_draw_|. diff --git a/cc/resources/one_copy_raster_worker_pool.cc b/cc/resources/one_copy_raster_worker_pool.cc index c803262..a558bbd 100644 --- a/cc/resources/one_copy_raster_worker_pool.cc +++ b/cc/resources/one_copy_raster_worker_pool.cc @@ -54,16 +54,10 @@ class RasterBufferImpl : public RasterBuffer { // Overridden from RasterBuffer: void Playback(const RasterSource* raster_source, const gfx::Rect& rect, - float scale, - RenderingStatsInstrumentation* stats) override { + float scale) override { sequence_ = worker_pool_->PlaybackAndScheduleCopyOnWorkerThread( - lock_.Pass(), - raster_resource_.Pass(), - resource_, - raster_source, - rect, - scale, - stats); + lock_.Pass(), raster_resource_.Pass(), resource_, raster_source, rect, + scale); } private: @@ -280,8 +274,7 @@ OneCopyRasterWorkerPool::PlaybackAndScheduleCopyOnWorkerThread( const Resource* dst, const RasterSource* raster_source, const gfx::Rect& rect, - float scale, - RenderingStatsInstrumentation* stats) { + float scale) { CopySequenceNumber sequence; { @@ -324,14 +317,9 @@ OneCopyRasterWorkerPool::PlaybackAndScheduleCopyOnWorkerThread( gfx::GpuMemoryBuffer* gpu_memory_buffer = write_lock->GetGpuMemoryBuffer(); if (gpu_memory_buffer) { - RasterWorkerPool::PlaybackToMemory(gpu_memory_buffer->Map(), - src->format(), - src->size(), - gpu_memory_buffer->GetStride(), - raster_source, - rect, - scale, - stats); + RasterWorkerPool::PlaybackToMemory( + gpu_memory_buffer->Map(), src->format(), src->size(), + gpu_memory_buffer->GetStride(), raster_source, rect, scale); gpu_memory_buffer->Unmap(); } } diff --git a/cc/resources/one_copy_raster_worker_pool.h b/cc/resources/one_copy_raster_worker_pool.h index 1dc102f..b209da2 100644 --- a/cc/resources/one_copy_raster_worker_pool.h +++ b/cc/resources/one_copy_raster_worker_pool.h @@ -62,8 +62,7 @@ class CC_EXPORT OneCopyRasterWorkerPool : public RasterWorkerPool, const Resource* dst, const RasterSource* raster_source, const gfx::Rect& rect, - float scale, - RenderingStatsInstrumentation* stats); + float scale); // Issues copy operations until |sequence| has been processed. This will // return immediately if |sequence| has already been processed. diff --git a/cc/resources/picture_pile_impl.cc b/cc/resources/picture_pile_impl.cc index f7c24c7..0ad746c 100644 --- a/cc/resources/picture_pile_impl.cc +++ b/cc/resources/picture_pile_impl.cc @@ -37,33 +37,25 @@ PicturePileImpl::PicturePileImpl(const PicturePileBase* other) PicturePileImpl::~PicturePileImpl() { } -void PicturePileImpl::RasterDirect( - SkCanvas* canvas, - const gfx::Rect& canvas_rect, - float contents_scale, - RenderingStatsInstrumentation* rendering_stats_instrumentation) const { +void PicturePileImpl::RasterDirect(SkCanvas* canvas, + const gfx::Rect& canvas_rect, + float contents_scale) const { RasterCommon(canvas, NULL, canvas_rect, contents_scale, - rendering_stats_instrumentation, false); } -void PicturePileImpl::RasterForAnalysis( - skia::AnalysisCanvas* canvas, - const gfx::Rect& canvas_rect, - float contents_scale, - RenderingStatsInstrumentation* stats_instrumentation) const { - RasterCommon( - canvas, canvas, canvas_rect, contents_scale, stats_instrumentation, true); +void PicturePileImpl::RasterForAnalysis(skia::AnalysisCanvas* canvas, + const gfx::Rect& canvas_rect, + float contents_scale) const { + RasterCommon(canvas, canvas, canvas_rect, contents_scale, true); } -void PicturePileImpl::PlaybackToCanvas( - SkCanvas* canvas, - const gfx::Rect& canvas_rect, - float contents_scale, - RenderingStatsInstrumentation* rendering_stats_instrumentation) const { +void PicturePileImpl::PlaybackToCanvas(SkCanvas* canvas, + const gfx::Rect& canvas_rect, + float contents_scale) const { canvas->discard(); if (clear_canvas_with_debug_color_) { // Any non-painted areas in the content bounds will be left in this color. @@ -125,7 +117,6 @@ void PicturePileImpl::PlaybackToCanvas( NULL, canvas_rect, contents_scale, - rendering_stats_instrumentation, false); } @@ -229,7 +220,6 @@ void PicturePileImpl::RasterCommon( SkDrawPictureCallback* callback, const gfx::Rect& canvas_rect, float contents_scale, - RenderingStatsInstrumentation* rendering_stats_instrumentation, bool is_analysis) const { DCHECK(contents_scale >= min_contents_scale_); @@ -265,34 +255,10 @@ void PicturePileImpl::RasterCommon( total_clip.Union(positive_clip); #endif // NDEBUG - base::TimeDelta best_duration = base::TimeDelta::Max(); int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_); - int rasterized_pixel_count = 0; - for (int j = 0; j < repeat_count; ++j) { - base::TimeTicks start_time; - if (rendering_stats_instrumentation) - start_time = rendering_stats_instrumentation->StartRecording(); - - rasterized_pixel_count = picture->Raster( - canvas, callback, negated_clip_region, contents_scale); - - if (rendering_stats_instrumentation) { - base::TimeDelta duration = - rendering_stats_instrumentation->EndRecording(start_time); - best_duration = std::min(best_duration, duration); - } - } - - if (rendering_stats_instrumentation) { - if (is_analysis) { - rendering_stats_instrumentation->AddAnalysis(best_duration, - rasterized_pixel_count); - } else { - rendering_stats_instrumentation->AddRaster(best_duration, - rasterized_pixel_count); - } - } + for (int j = 0; j < repeat_count; ++j) + picture->Raster(canvas, callback, negated_clip_region, contents_scale); } #ifndef NDEBUG @@ -316,7 +282,7 @@ skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { SkCanvas* canvas = recorder.beginRecording(tiling_rect.width(), tiling_rect.height()); if (!tiling_rect.IsEmpty()) - PlaybackToCanvas(canvas, tiling_rect, 1.0, NULL); + PlaybackToCanvas(canvas, tiling_rect, 1.0); skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); return picture; @@ -325,8 +291,7 @@ skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { void PicturePileImpl::PerformSolidColorAnalysis( const gfx::Rect& content_rect, float contents_scale, - RasterSource::SolidColorAnalysis* analysis, - RenderingStatsInstrumentation* stats_instrumentation) const { + RasterSource::SolidColorAnalysis* analysis) const { DCHECK(analysis); TRACE_EVENT0("cc", "PicturePileImpl::PerformSolidColorAnalysis"); @@ -337,7 +302,7 @@ void PicturePileImpl::PerformSolidColorAnalysis( skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height()); - RasterForAnalysis(&canvas, layer_rect, 1.0f, stats_instrumentation); + RasterForAnalysis(&canvas, layer_rect, 1.0f); analysis->is_solid_color = canvas.GetColorIfSolid(&analysis->solid_color); } diff --git a/cc/resources/picture_pile_impl.h b/cc/resources/picture_pile_impl.h index 1eb2187..9f350a9 100644 --- a/cc/resources/picture_pile_impl.h +++ b/cc/resources/picture_pile_impl.h @@ -32,16 +32,13 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase, public RasterSource { // When slow-down-raster-scale-factor is set to a value greater than 1, the // reported rasterize time (in stats_instrumentation) is the minimum measured // value over all runs. - void PlaybackToCanvas( - SkCanvas* canvas, - const gfx::Rect& canvas_rect, - float contents_scale, - RenderingStatsInstrumentation* stats_instrumentation) const override; + void PlaybackToCanvas(SkCanvas* canvas, + const gfx::Rect& canvas_rect, + float contents_scale) const override; void PerformSolidColorAnalysis( const gfx::Rect& content_rect, float contents_scale, - RasterSource::SolidColorAnalysis* analysis, - RenderingStatsInstrumentation* stats_instrumentation) const override; + RasterSource::SolidColorAnalysis* analysis) const override; void GatherPixelRefs(const gfx::Rect& content_rect, float contents_scale, std::vector<SkPixelRef*>* pixel_refs) const override; @@ -50,11 +47,9 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase, public RasterSource { bool SuitableForDistanceFieldText() const override; // Raster into the canvas without applying clips. - void RasterDirect( - SkCanvas* canvas, - const gfx::Rect& canvas_rect, - float contents_scale, - RenderingStatsInstrumentation* rendering_stats_instrumentation) const; + void RasterDirect(SkCanvas* canvas, + const gfx::Rect& canvas_rect, + float contents_scale) const; // Tracing functionality. void DidBeginTracing(); @@ -101,11 +96,9 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase, public RasterSource { // Called when analyzing a tile. We can use AnalysisCanvas as // SkDrawPictureCallback, which allows us to early out from analysis. - void RasterForAnalysis( - skia::AnalysisCanvas* canvas, - const gfx::Rect& canvas_rect, - float contents_scale, - RenderingStatsInstrumentation* stats_instrumentation) const; + void RasterForAnalysis(skia::AnalysisCanvas* canvas, + const gfx::Rect& canvas_rect, + float contents_scale) const; void CoalesceRasters(const gfx::Rect& canvas_rect, const gfx::Rect& content_rect, @@ -117,7 +110,6 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase, public RasterSource { SkDrawPictureCallback* callback, const gfx::Rect& canvas_rect, float contents_scale, - RenderingStatsInstrumentation* rendering_stats_instrumentation, bool is_analysis) const; bool likely_to_be_used_for_transform_animation_; diff --git a/cc/resources/picture_pile_impl_perftest.cc b/cc/resources/picture_pile_impl_perftest.cc index e3bbac7..7e24724 100644 --- a/cc/resources/picture_pile_impl_perftest.cc +++ b/cc/resources/picture_pile_impl_perftest.cc @@ -6,7 +6,6 @@ #include "cc/debug/lap_timer.h" #include "cc/test/fake_picture_pile_impl.h" -#include "cc/test/fake_rendering_stats_instrumentation.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/perf/perf_test.h" @@ -36,8 +35,7 @@ class PicturePileImplPerfTest : public testing::Test { RasterSource::SolidColorAnalysis analysis; timer_.Reset(); do { - pile->PerformSolidColorAnalysis( - content_rect, contents_scale, &analysis, nullptr); + pile->PerformSolidColorAnalysis(content_rect, contents_scale, &analysis); timer_.NextLap(); } while (!timer_.HasTimeLimitExpired()); @@ -55,13 +53,9 @@ class PicturePileImplPerfTest : public testing::Test { bitmap.allocN32Pixels(1, 1); SkCanvas canvas(bitmap); - FakeRenderingStatsInstrumentation rendering_stats_instrumentation; timer_.Reset(); do { - pile->PlaybackToCanvas(&canvas, - content_rect, - contents_scale, - &rendering_stats_instrumentation); + pile->PlaybackToCanvas(&canvas, content_rect, contents_scale); timer_.NextLap(); } while (!timer_.HasTimeLimitExpired()); diff --git a/cc/resources/picture_pile_impl_unittest.cc b/cc/resources/picture_pile_impl_unittest.cc index bd796a5..6dcf740 100644 --- a/cc/resources/picture_pile_impl_unittest.cc +++ b/cc/resources/picture_pile_impl_unittest.cc @@ -4,7 +4,6 @@ #include "base/memory/scoped_ptr.h" #include "cc/test/fake_picture_pile_impl.h" -#include "cc/test/fake_rendering_stats_instrumentation.h" #include "cc/test/skia_common.h" #include "skia/ext/refptr.h" #include "testing/gtest/include/gtest/gtest.h" @@ -39,7 +38,7 @@ TEST(PicturePileImplTest, AnalyzeIsSolidUnscaled) { for (int x = 0; x <= 300; x += 100) { RasterSource::SolidColorAnalysis analysis; gfx::Rect rect(x, y, 100, 100); - pile->PerformSolidColorAnalysis(rect, 1.0, &analysis, nullptr); + pile->PerformSolidColorAnalysis(rect, 1.0, &analysis); EXPECT_TRUE(analysis.is_solid_color) << rect.ToString(); EXPECT_EQ(analysis.solid_color, solid_color) << rect.ToString(); } @@ -50,31 +49,27 @@ TEST(PicturePileImplTest, AnalyzeIsSolidUnscaled) { pile->RerecordPile(); RasterSource::SolidColorAnalysis analysis; - pile->PerformSolidColorAnalysis( - gfx::Rect(0, 0, 100, 100), 1.0, &analysis, nullptr); + pile->PerformSolidColorAnalysis(gfx::Rect(0, 0, 100, 100), 1.0, &analysis); EXPECT_FALSE(analysis.is_solid_color); - pile->PerformSolidColorAnalysis( - gfx::Rect(100, 0, 100, 100), 1.0, &analysis, nullptr); + pile->PerformSolidColorAnalysis(gfx::Rect(100, 0, 100, 100), 1.0, &analysis); EXPECT_TRUE(analysis.is_solid_color); EXPECT_EQ(analysis.solid_color, solid_color); // Boundaries should be clipped analysis.is_solid_color = false; - pile->PerformSolidColorAnalysis( - gfx::Rect(350, 0, 100, 100), 1.0, &analysis, nullptr); + pile->PerformSolidColorAnalysis(gfx::Rect(350, 0, 100, 100), 1.0, &analysis); EXPECT_TRUE(analysis.is_solid_color); EXPECT_EQ(analysis.solid_color, solid_color); analysis.is_solid_color = false; - pile->PerformSolidColorAnalysis( - gfx::Rect(0, 350, 100, 100), 1.0, &analysis, nullptr); + pile->PerformSolidColorAnalysis(gfx::Rect(0, 350, 100, 100), 1.0, &analysis); EXPECT_TRUE(analysis.is_solid_color); EXPECT_EQ(analysis.solid_color, solid_color); analysis.is_solid_color = false; - pile->PerformSolidColorAnalysis( - gfx::Rect(350, 350, 100, 100), 1.0, &analysis, nullptr); + pile->PerformSolidColorAnalysis(gfx::Rect(350, 350, 100, 100), 1.0, + &analysis); EXPECT_TRUE(analysis.is_solid_color); EXPECT_EQ(analysis.solid_color, solid_color); } @@ -102,7 +97,7 @@ TEST(PicturePileImplTest, AnalyzeIsSolidScaled) { for (int x = 0; x <= 30; x += 10) { RasterSource::SolidColorAnalysis analysis; gfx::Rect rect(x, y, 10, 10); - pile->PerformSolidColorAnalysis(rect, 0.1f, &analysis, nullptr); + pile->PerformSolidColorAnalysis(rect, 0.1f, &analysis); EXPECT_TRUE(analysis.is_solid_color) << rect.ToString(); EXPECT_EQ(analysis.solid_color, solid_color) << rect.ToString(); } @@ -113,31 +108,26 @@ TEST(PicturePileImplTest, AnalyzeIsSolidScaled) { pile->RerecordPile(); RasterSource::SolidColorAnalysis analysis; - pile->PerformSolidColorAnalysis( - gfx::Rect(0, 0, 10, 10), 0.1f, &analysis, nullptr); + pile->PerformSolidColorAnalysis(gfx::Rect(0, 0, 10, 10), 0.1f, &analysis); EXPECT_FALSE(analysis.is_solid_color); - pile->PerformSolidColorAnalysis( - gfx::Rect(10, 0, 10, 10), 0.1f, &analysis, nullptr); + pile->PerformSolidColorAnalysis(gfx::Rect(10, 0, 10, 10), 0.1f, &analysis); EXPECT_TRUE(analysis.is_solid_color); EXPECT_EQ(analysis.solid_color, solid_color); // Boundaries should be clipped analysis.is_solid_color = false; - pile->PerformSolidColorAnalysis( - gfx::Rect(35, 0, 10, 10), 0.1f, &analysis, nullptr); + pile->PerformSolidColorAnalysis(gfx::Rect(35, 0, 10, 10), 0.1f, &analysis); EXPECT_TRUE(analysis.is_solid_color); EXPECT_EQ(analysis.solid_color, solid_color); analysis.is_solid_color = false; - pile->PerformSolidColorAnalysis( - gfx::Rect(0, 35, 10, 10), 0.1f, &analysis, nullptr); + pile->PerformSolidColorAnalysis(gfx::Rect(0, 35, 10, 10), 0.1f, &analysis); EXPECT_TRUE(analysis.is_solid_color); EXPECT_EQ(analysis.solid_color, solid_color); analysis.is_solid_color = false; - pile->PerformSolidColorAnalysis( - gfx::Rect(35, 35, 10, 10), 0.1f, &analysis, nullptr); + pile->PerformSolidColorAnalysis(gfx::Rect(35, 35, 10, 10), 0.1f, &analysis); EXPECT_TRUE(analysis.is_solid_color); EXPECT_EQ(analysis.solid_color, solid_color); } @@ -151,8 +141,7 @@ TEST(PicturePileImplTest, AnalyzeIsSolidEmpty) { RasterSource::SolidColorAnalysis analysis; EXPECT_FALSE(analysis.is_solid_color); - pile->PerformSolidColorAnalysis( - gfx::Rect(0, 0, 400, 400), 1.f, &analysis, nullptr); + pile->PerformSolidColorAnalysis(gfx::Rect(0, 0, 400, 400), 1.f, &analysis); EXPECT_TRUE(analysis.is_solid_color); EXPECT_EQ(analysis.solid_color, SkColorSetARGB(0, 0, 0, 0)); @@ -696,12 +685,7 @@ TEST_P(FullContentsTest, RasterFullContents) { SkCanvas canvas(bitmap); canvas.clear(SK_ColorTRANSPARENT); - FakeRenderingStatsInstrumentation rendering_stats_instrumentation; - - pile->PlaybackToCanvas(&canvas, - canvas_rect, - contents_scale, - &rendering_stats_instrumentation); + pile->PlaybackToCanvas(&canvas, canvas_rect, contents_scale); SkColor* pixels = reinterpret_cast<SkColor*>(bitmap.getPixels()); int num_pixels = bitmap.width() * bitmap.height(); @@ -748,9 +732,7 @@ TEST(PicturePileImpl, RasterContentsTransparent) { bitmap.allocN32Pixels(canvas_rect.width(), canvas_rect.height()); SkCanvas canvas(bitmap); - FakeRenderingStatsInstrumentation rendering_stats_instrumentation; - pile->PlaybackToCanvas( - &canvas, canvas_rect, contents_scale, &rendering_stats_instrumentation); + pile->PlaybackToCanvas(&canvas, canvas_rect, contents_scale); SkColor* pixels = reinterpret_cast<SkColor*>(bitmap.getPixels()); int num_pixels = bitmap.width() * bitmap.height(); @@ -794,11 +776,7 @@ TEST_P(OverlapTest, NoOverlap) { bitmap.allocN32Pixels(content_bounds.width(), content_bounds.height()); SkCanvas canvas(bitmap); - FakeRenderingStatsInstrumentation rendering_stats_instrumentation; - pile->PlaybackToCanvas(&canvas, - gfx::Rect(content_bounds), - contents_scale, - &rendering_stats_instrumentation); + pile->PlaybackToCanvas(&canvas, gfx::Rect(content_bounds), contents_scale); for (int y = 0; y < bitmap.height(); y++) { for (int x = 0; x < bitmap.width(); x++) { diff --git a/cc/resources/pixel_buffer_raster_worker_pool.cc b/cc/resources/pixel_buffer_raster_worker_pool.cc index 26ab728..175e7d4 100644 --- a/cc/resources/pixel_buffer_raster_worker_pool.cc +++ b/cc/resources/pixel_buffer_raster_worker_pool.cc @@ -37,19 +37,13 @@ class RasterBufferImpl : public RasterBuffer { // Overridden from RasterBuffer: void Playback(const RasterSource* raster_source, const gfx::Rect& rect, - float scale, - RenderingStatsInstrumentation* stats) override { + float scale) override { if (!memory_) return; - RasterWorkerPool::PlaybackToMemory(memory_, - resource_->format(), - resource_->size(), - stride_, - raster_source, - rect, - scale, - stats); + RasterWorkerPool::PlaybackToMemory(memory_, resource_->format(), + resource_->size(), stride_, + raster_source, rect, scale); } private: diff --git a/cc/resources/raster_buffer.h b/cc/resources/raster_buffer.h index d9791e9..2a72203 100644 --- a/cc/resources/raster_buffer.h +++ b/cc/resources/raster_buffer.h @@ -10,7 +10,6 @@ namespace cc { class RasterSource; -class RenderingStatsInstrumentation; class CC_EXPORT RasterBuffer { public: @@ -19,8 +18,7 @@ class CC_EXPORT RasterBuffer { virtual void Playback(const RasterSource* raster_source, const gfx::Rect& rect, - float scale, - RenderingStatsInstrumentation* stats) = 0; + float scale) = 0; }; } // namespace cc diff --git a/cc/resources/raster_source.h b/cc/resources/raster_source.h index 603b883..3e25408 100644 --- a/cc/resources/raster_source.h +++ b/cc/resources/raster_source.h @@ -15,8 +15,6 @@ class SkCanvas; namespace cc { -class RenderingStatsInstrumentation; - class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> { public: struct CC_EXPORT SolidColorAnalysis { @@ -32,20 +30,16 @@ class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> { // assumed that contents_scale has already been applied to this canvas. // Writes the total number of pixels rasterized and the time spent // rasterizing to the stats if the respective pointer is not nullptr. - // TODO(vmpstr): Remove RenderingStatsInstrumentation from the interface. - virtual void PlaybackToCanvas( - SkCanvas* canvas, - const gfx::Rect& canvas_rect, - float contents_scale, - RenderingStatsInstrumentation* rendering_stats_instrumentation) const = 0; + virtual void PlaybackToCanvas(SkCanvas* canvas, + const gfx::Rect& canvas_rect, + float contents_scale) const = 0; // Analyze to determine if the given rect at given scale is of solid color in // this raster source. virtual void PerformSolidColorAnalysis( const gfx::Rect& content_rect, float contents_scale, - SolidColorAnalysis* analysis, - RenderingStatsInstrumentation* rendering_stats_instrumentation) const = 0; + SolidColorAnalysis* analysis) const = 0; // Populate the given list with all SkPixelRefs that may overlap the given // rect at given scale. diff --git a/cc/resources/raster_worker_pool.cc b/cc/resources/raster_worker_pool.cc index bd91740..9229db6 100644 --- a/cc/resources/raster_worker_pool.cc +++ b/cc/resources/raster_worker_pool.cc @@ -201,8 +201,7 @@ void RasterWorkerPool::PlaybackToMemory(void* memory, int stride, const RasterSource* raster_source, const gfx::Rect& rect, - float scale, - RenderingStatsInstrumentation* stats) { + float scale) { SkBitmap bitmap; switch (format) { case RGBA_4444: @@ -226,7 +225,7 @@ void RasterWorkerPool::PlaybackToMemory(void* memory, } SkCanvas canvas(bitmap); - raster_source->PlaybackToCanvas(&canvas, rect, scale, stats); + raster_source->PlaybackToCanvas(&canvas, rect, scale); SkColorType buffer_color_type = ResourceFormatToSkColorType(format); if (buffer_color_type != bitmap.colorType()) { diff --git a/cc/resources/raster_worker_pool.h b/cc/resources/raster_worker_pool.h index 30d26e5..5259f83 100644 --- a/cc/resources/raster_worker_pool.h +++ b/cc/resources/raster_worker_pool.h @@ -72,8 +72,7 @@ class CC_EXPORT RasterWorkerPool { int stride, const RasterSource* raster_source, const gfx::Rect& rect, - float scale, - RenderingStatsInstrumentation* stats); + float scale); // Type-checking downcast routine. virtual Rasterizer* AsRasterizer() = 0; diff --git a/cc/resources/raster_worker_pool_unittest.cc b/cc/resources/raster_worker_pool_unittest.cc index c8feb73..9aee8e7 100644 --- a/cc/resources/raster_worker_pool_unittest.cc +++ b/cc/resources/raster_worker_pool_unittest.cc @@ -59,8 +59,7 @@ class TestRasterTaskImpl : public RasterTask { // Overridden from Task: void RunOnWorkerThread() override { - raster_buffer_->Playback( - picture_pile_.get(), gfx::Rect(0, 0, 1, 1), 1.0, NULL); + raster_buffer_->Playback(picture_pile_.get(), gfx::Rect(0, 0, 1, 1), 1.0); } // Overridden from RasterizerTask: diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc index c785cf6..6d53e57 100644 --- a/cc/resources/tile_manager.cc +++ b/cc/resources/tile_manager.cc @@ -96,8 +96,8 @@ class RasterTaskImpl : public RasterTask { DCHECK(raster_source); - raster_source->PerformSolidColorAnalysis( - content_rect_, contents_scale_, &analysis_, rendering_stats_); + raster_source->PerformSolidColorAnalysis(content_rect_, contents_scale_, + &analysis_); // Record the solid color prediction. UMA_HISTOGRAM_BOOLEAN("Renderer4.SolidColorTilesAnalyzed", @@ -113,30 +113,10 @@ class RasterTaskImpl : public RasterTask { devtools_instrumentation::ScopedLayerTask layer_task( devtools_instrumentation::kRasterTask, layer_id_); - base::TimeDelta prev_rasterize_time = - rendering_stats_->impl_thread_rendering_stats().rasterize_time; - - // Only record rasterization time for highres tiles, because - // lowres tiles are not required for activation and therefore - // introduce noise in the measurement (sometimes they get rasterized - // before we draw and sometimes they aren't) - RenderingStatsInstrumentation* stats = - tile_resolution_ == HIGH_RESOLUTION ? rendering_stats_ : NULL; DCHECK(raster_source); - raster_buffer_->Playback( - raster_source_.get(), content_rect_, contents_scale_, stats); - - if (rendering_stats_->record_rendering_stats()) { - base::TimeDelta current_rasterize_time = - rendering_stats_->impl_thread_rendering_stats().rasterize_time; - LOCAL_HISTOGRAM_CUSTOM_COUNTS( - "Renderer4.PictureRasterTimeUS", - (current_rasterize_time - prev_rasterize_time).InMicroseconds(), - 0, - 100000, - 100); - } + raster_buffer_->Playback(raster_source_.get(), content_rect_, + contents_scale_); } RasterSource::SolidColorAnalysis analysis_; diff --git a/cc/resources/zero_copy_raster_worker_pool.cc b/cc/resources/zero_copy_raster_worker_pool.cc index 4030942..ca2bc9b 100644 --- a/cc/resources/zero_copy_raster_worker_pool.cc +++ b/cc/resources/zero_copy_raster_worker_pool.cc @@ -26,20 +26,14 @@ class RasterBufferImpl : public RasterBuffer { // Overridden from RasterBuffer: void Playback(const RasterSource* raster_source, const gfx::Rect& rect, - float scale, - RenderingStatsInstrumentation* stats) override { + float scale) override { gfx::GpuMemoryBuffer* gpu_memory_buffer = lock_.GetGpuMemoryBuffer(); if (!gpu_memory_buffer) return; - RasterWorkerPool::PlaybackToMemory(gpu_memory_buffer->Map(), - resource_->format(), - resource_->size(), - gpu_memory_buffer->GetStride(), - raster_source, - rect, - scale, - stats); + RasterWorkerPool::PlaybackToMemory( + gpu_memory_buffer->Map(), resource_->format(), resource_->size(), + gpu_memory_buffer->GetStride(), raster_source, rect, scale); gpu_memory_buffer->Unmap(); } diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 74ff284..773fd1f 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -47,7 +47,6 @@ #include "cc/test/fake_picture_layer_impl.h" #include "cc/test/fake_picture_pile_impl.h" #include "cc/test/fake_proxy.h" -#include "cc/test/fake_rendering_stats_instrumentation.h" #include "cc/test/fake_video_frame_provider.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/layer_test_common.h" diff --git a/cc/trees/tree_synchronizer_unittest.cc b/cc/trees/tree_synchronizer_unittest.cc index 2715727..d48f821 100644 --- a/cc/trees/tree_synchronizer_unittest.cc +++ b/cc/trees/tree_synchronizer_unittest.cc @@ -16,6 +16,7 @@ #include "cc/test/animation_test_common.h" #include "cc/test/fake_impl_proxy.h" #include "cc/test/fake_layer_tree_host.h" +#include "cc/test/fake_rendering_stats_instrumentation.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/trees/proxy.h" #include "cc/trees/single_thread_proxy.h" |