OLD | NEW |
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/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "cc/debug/debug_colors.h" |
15 #include "cc/debug/devtools_instrumentation.h" | 16 #include "cc/debug/devtools_instrumentation.h" |
16 #include "cc/resources/raster_worker_pool.h" | 17 #include "cc/resources/raster_worker_pool.h" |
17 #include "cc/resources/resource_pool.h" | 18 #include "cc/resources/resource_pool.h" |
18 #include "cc/resources/tile.h" | 19 #include "cc/resources/tile.h" |
19 #include "third_party/skia/include/core/SkDevice.h" | 20 #include "third_party/skia/include/core/SkDevice.h" |
20 | 21 |
21 namespace cc { | 22 namespace cc { |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 | 859 |
859 DCHECK(picture_pile); | 860 DCHECK(picture_pile); |
860 DCHECK(buffer); | 861 DCHECK(buffer); |
861 | 862 |
862 SkBitmap bitmap; | 863 SkBitmap bitmap; |
863 bitmap.setConfig(SkBitmap::kARGB_8888_Config, rect.width(), rect.height()); | 864 bitmap.setConfig(SkBitmap::kARGB_8888_Config, rect.width(), rect.height()); |
864 bitmap.setPixels(buffer); | 865 bitmap.setPixels(buffer); |
865 SkDevice device(bitmap); | 866 SkDevice device(bitmap); |
866 SkCanvas canvas(&device); | 867 SkCanvas canvas(&device); |
867 | 868 |
| 869 #ifndef NDEBUG |
| 870 // Any non-painted areas will be left in this color. |
| 871 canvas.clear(DebugColors::NonPaintedFillColor()); |
| 872 #endif // NDEBUG |
| 873 |
868 if (stats_instrumentation->record_rendering_stats()) { | 874 if (stats_instrumentation->record_rendering_stats()) { |
869 PicturePileImpl::RasterStats raster_stats; | 875 PicturePileImpl::RasterStats raster_stats; |
870 picture_pile->Raster(&canvas, rect, contents_scale, &raster_stats); | 876 picture_pile->Raster(&canvas, rect, contents_scale, &raster_stats); |
871 stats_instrumentation->AddRaster(raster_stats.total_rasterize_time, | 877 stats_instrumentation->AddRaster(raster_stats.total_rasterize_time, |
872 raster_stats.best_rasterize_time, | 878 raster_stats.best_rasterize_time, |
873 raster_stats.total_pixels_rasterized, | 879 raster_stats.total_pixels_rasterized, |
874 metadata.is_tile_in_pending_tree_now_bin); | 880 metadata.is_tile_in_pending_tree_now_bin); |
875 | 881 |
876 HISTOGRAM_CUSTOM_COUNTS("Renderer4.PictureRasterTimeUS", | 882 HISTOGRAM_CUSTOM_COUNTS("Renderer4.PictureRasterTimeUS", |
877 raster_stats.total_rasterize_time.InMicroseconds(), | 883 raster_stats.total_rasterize_time.InMicroseconds(), |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 skia::LazyPixelRef* pixel_ref, | 942 skia::LazyPixelRef* pixel_ref, |
937 RenderingStatsInstrumentation* stats_instrumentation) { | 943 RenderingStatsInstrumentation* stats_instrumentation) { |
938 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); | 944 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); |
939 base::TimeTicks start_time = stats_instrumentation->StartRecording(); | 945 base::TimeTicks start_time = stats_instrumentation->StartRecording(); |
940 pixel_ref->Decode(); | 946 pixel_ref->Decode(); |
941 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); | 947 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); |
942 stats_instrumentation->AddDeferredImageDecode(duration); | 948 stats_instrumentation->AddDeferredImageDecode(duration); |
943 } | 949 } |
944 | 950 |
945 } // namespace cc | 951 } // namespace cc |
OLD | NEW |