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

Side by Side Diff: cc/resources/bitmap_skpicture_content_layer_updater.cc

Issue 13265003: cc: Switch ContentLayerUpdater to use RenderingStatsInstrumentation (Closed) Base URL: http://git.chromium.org/chromium/src.git@update
Patch Set: Added printfs Created 7 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 unified diff | Download patch
« no previous file with comments | « cc/resources/bitmap_content_layer_updater.cc ('k') | cc/resources/content_layer_updater.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/resources/bitmap_skpicture_content_layer_updater.h" 5 #include "cc/resources/bitmap_skpicture_content_layer_updater.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "cc/debug/rendering_stats_instrumentation.h" 8 #include "cc/debug/rendering_stats_instrumentation.h"
9 #include "cc/resources/layer_painter.h" 9 #include "cc/resources/layer_painter.h"
10 #include "cc/resources/prioritized_resource.h" 10 #include "cc/resources/prioritized_resource.h"
(...skipping 13 matching lines...) Expand all
24 gfx::Rect source_rect, 24 gfx::Rect source_rect,
25 gfx::Vector2d dest_offset, 25 gfx::Vector2d dest_offset,
26 bool partial_update, 26 bool partial_update,
27 RenderingStats* stats) { 27 RenderingStats* stats) {
28 bitmap_.setConfig( 28 bitmap_.setConfig(
29 SkBitmap::kARGB_8888_Config, source_rect.width(), source_rect.height()); 29 SkBitmap::kARGB_8888_Config, source_rect.width(), source_rect.height());
30 bitmap_.allocPixels(); 30 bitmap_.allocPixels();
31 bitmap_.setIsOpaque(updater_->layer_is_opaque()); 31 bitmap_.setIsOpaque(updater_->layer_is_opaque());
32 SkDevice device(bitmap_); 32 SkDevice device(bitmap_);
33 SkCanvas canvas(&device); 33 SkCanvas canvas(&device);
34 base::TimeTicks paint_begin_time; 34
35 if (stats)
36 paint_begin_time = base::TimeTicks::Now();
37 updater_->PaintContentsRect(&canvas, source_rect, stats); 35 updater_->PaintContentsRect(&canvas, source_rect, stats);
38 if (stats)
39 stats->total_paint_time += base::TimeTicks::Now() - paint_begin_time;
40 36
41 ResourceUpdate upload = ResourceUpdate::Create( 37 ResourceUpdate upload = ResourceUpdate::Create(
42 texture(), &bitmap_, source_rect, source_rect, dest_offset); 38 texture(), &bitmap_, source_rect, source_rect, dest_offset);
43 if (partial_update) 39 if (partial_update)
44 queue->AppendPartialUpload(upload); 40 queue->AppendPartialUpload(upload);
45 else 41 else
46 queue->AppendFullUpload(upload); 42 queue->AppendFullUpload(upload);
47 } 43 }
48 44
49 scoped_refptr<BitmapSkPictureContentLayerUpdater> 45 scoped_refptr<BitmapSkPictureContentLayerUpdater>
(...skipping 16 matching lines...) Expand all
66 BitmapSkPictureContentLayerUpdater::CreateResource( 62 BitmapSkPictureContentLayerUpdater::CreateResource(
67 PrioritizedResourceManager* manager) { 63 PrioritizedResourceManager* manager) {
68 return scoped_ptr<LayerUpdater::Resource>( 64 return scoped_ptr<LayerUpdater::Resource>(
69 new Resource(this, PrioritizedResource::Create(manager))); 65 new Resource(this, PrioritizedResource::Create(manager)));
70 } 66 }
71 67
72 void BitmapSkPictureContentLayerUpdater::PaintContentsRect( 68 void BitmapSkPictureContentLayerUpdater::PaintContentsRect(
73 SkCanvas* canvas, 69 SkCanvas* canvas,
74 gfx::Rect source_rect, 70 gfx::Rect source_rect,
75 RenderingStats* stats) { 71 RenderingStats* stats) {
72
73 printf("BitmapSkPictureContentLayerUpdater::PaintContentsRect\n");
74
76 // Translate the origin of content_rect to that of source_rect. 75 // Translate the origin of content_rect to that of source_rect.
77 canvas->translate(content_rect().x() - source_rect.x(), 76 canvas->translate(content_rect().x() - source_rect.x(),
78 content_rect().y() - source_rect.y()); 77 content_rect().y() - source_rect.y());
79 base::TimeTicks rasterize_begin_time; 78
80 if (stats) 79 base::TimeTicks start_time =
81 rasterize_begin_time = base::TimeTicks::Now(); 80 rendering_stats_instrumentation_->StartRecording();
81
82 DrawPicture(canvas); 82 DrawPicture(canvas);
83 if (stats) { 83
84 stats->total_rasterize_time += 84 base::TimeDelta duration =
85 base::TimeTicks::Now() - rasterize_begin_time; 85 rendering_stats_instrumentation_->EndRecording(start_time);
86 stats->total_pixels_rasterized += 86 rendering_stats_instrumentation_->AddRaster(
87 source_rect.width() * source_rect.height(); 87 duration,
88 } 88 source_rect.width() * source_rect.height(),
89 false);
90
91 // TODO: Clarify if this needs to be saved here. crbug.com/223693
92 rendering_stats_instrumentation_->AddPaint(duration, 0);
89 } 93 }
90 94
91 } // namespace cc 95 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/bitmap_content_layer_updater.cc ('k') | cc/resources/content_layer_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698