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

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

Issue 14690020: cc: Don't consider padding for analysis. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: predictor benchmarking change 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
« no previous file with comments | « cc/resources/picture_pile_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 14 #include "cc/debug/debug_colors.h"
15 #include "cc/debug/devtools_instrumentation.h" 15 #include "cc/debug/devtools_instrumentation.h"
16 #include "cc/debug/traced_value.h" 16 #include "cc/debug/traced_value.h"
17 #include "cc/resources/raster_worker_pool.h" 17 #include "cc/resources/raster_worker_pool.h"
18 #include "cc/resources/resource_pool.h" 18 #include "cc/resources/resource_pool.h"
19 #include "cc/resources/tile.h" 19 #include "cc/resources/tile.h"
20 #include "third_party/skia/include/core/SkDevice.h" 20 #include "third_party/skia/include/core/SkDevice.h"
21 #include "ui/gfx/rect_conversions.h"
21 22
22 namespace cc { 23 namespace cc {
23 24
24 namespace { 25 namespace {
25 26
26 // If we raster too fast we become upload bound, and pending 27 // If we raster too fast we become upload bound, and pending
27 // uploads consume memory. For maximum upload throughput, we would 28 // uploads consume memory. For maximum upload throughput, we would
28 // want to allow for upload_throughput * pipeline_time of pending 29 // want to allow for upload_throughput * pipeline_time of pending
29 // uploads, after which we are just wasting memory. Since we don't 30 // uploads, after which we are just wasting memory. Since we don't
30 // know our upload throughput yet, this just caps our memory usage. 31 // know our upload throughput yet, this just caps our memory usage.
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 847
847 // Record the solid color prediction. 848 // Record the solid color prediction.
848 UMA_HISTOGRAM_BOOLEAN("Renderer4.SolidColorTilesAnalyzed", 849 UMA_HISTOGRAM_BOOLEAN("Renderer4.SolidColorTilesAnalyzed",
849 analysis->is_solid_color); 850 analysis->is_solid_color);
850 stats_instrumentation->AddTileAnalysisResult(analysis->is_solid_color); 851 stats_instrumentation->AddTileAnalysisResult(analysis->is_solid_color);
851 852
852 // Clear the flag if we're not using the estimator. 853 // Clear the flag if we're not using the estimator.
853 analysis->is_solid_color &= use_color_estimator; 854 analysis->is_solid_color &= use_color_estimator;
854 855
855 if (metadata.prediction_benchmarking) { 856 if (metadata.prediction_benchmarking) {
856 SkDevice device(SkBitmap::kARGB_8888_Config, rect.width(), rect.height()); 857 gfx::Rect layer_rect = gfx::ToEnclosingRect(
858 gfx::ScaleRect(rect, 1.0f / contents_scale));
859
860 SkDevice device(
861 SkBitmap::kARGB_8888_Config, layer_rect.width(), layer_rect.height());
857 SkCanvas canvas(&device); 862 SkCanvas canvas(&device);
858 picture_pile->Raster(&canvas, rect, contents_scale, NULL); 863 picture_pile->Raster(&canvas, layer_rect, 1.0f, NULL);
859 864
860 const SkBitmap bitmap = device.accessBitmap(false); 865 const SkBitmap bitmap = device.accessBitmap(false);
861 DCHECK_EQ(bitmap.rowBytes(), 866 DCHECK_EQ(bitmap.rowBytes(),
862 static_cast<size_t>(bitmap.width() * bitmap.bytesPerPixel())); 867 static_cast<size_t>(bitmap.width() * bitmap.bytesPerPixel()));
863 868
864 RecordSolidColorPredictorResults( 869 RecordSolidColorPredictorResults(
865 reinterpret_cast<SkPMColor*>(bitmap.getPixels()), 870 reinterpret_cast<SkPMColor*>(bitmap.getPixels()),
866 bitmap.getSize() / bitmap.bytesPerPixel(), 871 bitmap.getSize() / bitmap.bytesPerPixel(),
867 analysis->is_solid_color, 872 analysis->is_solid_color,
868 SkPreMultiplyColor(analysis->solid_color)); 873 SkPreMultiplyColor(analysis->solid_color));
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 is_predicted_solid && predicted_color != actual_color); 977 is_predicted_solid && predicted_color != actual_color);
973 HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.Accuracy", 978 HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.Accuracy",
974 is_predicted_solid == is_actually_solid && 979 is_predicted_solid == is_actually_solid &&
975 (!is_predicted_solid || predicted_color == actual_color)); 980 (!is_predicted_solid || predicted_color == actual_color));
976 HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.IsCorrectSolid", 981 HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.IsCorrectSolid",
977 is_predicted_solid == is_actually_solid && 982 is_predicted_solid == is_actually_solid &&
978 (is_predicted_solid && predicted_color == actual_color)); 983 (is_predicted_solid && predicted_color == actual_color));
979 } 984 }
980 985
981 } // namespace cc 986 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_pile_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698