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

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

Issue 13863015: Add flag for drawing layers to screen with Ganesh (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 7 years, 7 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 | Annotate | Revision Log
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/resources/tile_manager.h" 5 #include "cc/resources/tile_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "cc/debug/debug_colors.h"
15 #include "cc/debug/devtools_instrumentation.h" 14 #include "cc/debug/devtools_instrumentation.h"
16 #include "cc/debug/traced_value.h" 15 #include "cc/debug/traced_value.h"
17 #include "cc/resources/raster_worker_pool.h" 16 #include "cc/resources/raster_worker_pool.h"
18 #include "cc/resources/resource_pool.h" 17 #include "cc/resources/resource_pool.h"
19 #include "cc/resources/tile.h" 18 #include "cc/resources/tile.h"
20 #include "third_party/skia/include/core/SkDevice.h" 19 #include "third_party/skia/include/core/SkDevice.h"
21 #include "ui/gfx/rect_conversions.h" 20 #include "ui/gfx/rect_conversions.h"
22 21
23 namespace cc { 22 namespace cc {
24 23
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 882
884 if (analysis->is_solid_color) 883 if (analysis->is_solid_color)
885 return; 884 return;
886 885
887 SkBitmap bitmap; 886 SkBitmap bitmap;
888 bitmap.setConfig(SkBitmap::kARGB_8888_Config, rect.width(), rect.height()); 887 bitmap.setConfig(SkBitmap::kARGB_8888_Config, rect.width(), rect.height());
889 bitmap.setPixels(buffer); 888 bitmap.setPixels(buffer);
890 SkDevice device(bitmap); 889 SkDevice device(bitmap);
891 SkCanvas canvas(&device); 890 SkCanvas canvas(&device);
892 891
893 #ifndef NDEBUG
894 // Any non-painted areas will be left in this color.
895 canvas.clear(DebugColors::NonPaintedFillColor());
896 #endif // NDEBUG
897
898 if (stats_instrumentation->record_rendering_stats()) { 892 if (stats_instrumentation->record_rendering_stats()) {
899 PicturePileImpl::RasterStats raster_stats; 893 PicturePileImpl::RasterStats raster_stats;
900 picture_pile->Raster(&canvas, rect, contents_scale, &raster_stats); 894 picture_pile->RasterToBitmap(&canvas, rect, contents_scale, &raster_stats);
901 stats_instrumentation->AddRaster( 895 stats_instrumentation->AddRaster(
902 raster_stats.total_rasterize_time, 896 raster_stats.total_rasterize_time,
903 raster_stats.best_rasterize_time, 897 raster_stats.best_rasterize_time,
904 raster_stats.total_pixels_rasterized, 898 raster_stats.total_pixels_rasterized,
905 metadata.is_tile_in_pending_tree_now_bin); 899 metadata.is_tile_in_pending_tree_now_bin);
906 900
907 HISTOGRAM_CUSTOM_COUNTS( 901 HISTOGRAM_CUSTOM_COUNTS(
908 "Renderer4.PictureRasterTimeUS", 902 "Renderer4.PictureRasterTimeUS",
909 raster_stats.total_rasterize_time.InMicroseconds(), 903 raster_stats.total_rasterize_time.InMicroseconds(),
910 0, 904 0,
911 100000, 905 100000,
912 100); 906 100);
913 } else { 907 } else {
914 picture_pile->Raster(&canvas, rect, contents_scale, NULL); 908 picture_pile->RasterToBitmap(&canvas, rect, contents_scale, NULL);
915 } 909 }
916 } 910 }
917 911
918 // static 912 // static
919 void TileManager::RunImageDecodeTask( 913 void TileManager::RunImageDecodeTask(
920 skia::LazyPixelRef* pixel_ref, 914 skia::LazyPixelRef* pixel_ref,
921 RenderingStatsInstrumentation* stats_instrumentation) { 915 RenderingStatsInstrumentation* stats_instrumentation) {
922 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); 916 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask");
923 base::TimeTicks start_time = stats_instrumentation->StartRecording(); 917 base::TimeTicks start_time = stats_instrumentation->StartRecording();
924 pixel_ref->Decode(); 918 pixel_ref->Decode();
925 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); 919 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time);
926 stats_instrumentation->AddDeferredImageDecode(duration); 920 stats_instrumentation->AddDeferredImageDecode(duration);
927 } 921 }
928 922
929 } // namespace cc 923 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698