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

Unified Diff: cc/tiles/gpu_image_decode_controller.h

Issue 2036553002: cc: Add four new histograms for gpu image decode/upload usage tracking. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/tiles/gpu_image_decode_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/gpu_image_decode_controller.h
diff --git a/cc/tiles/gpu_image_decode_controller.h b/cc/tiles/gpu_image_decode_controller.h
index d8b4a2ff5b938b57514cdf22f9bf0abd8671d736..5ced06527577704a4c5a71566ef4329b17890ecb 100644
--- a/cc/tiles/gpu_image_decode_controller.h
+++ b/cc/tiles/gpu_image_decode_controller.h
@@ -111,14 +111,25 @@ class CC_EXPORT GpuImageDecodeController
void ResetData();
base::DiscardableMemory* data() const { return data_.get(); }
+ void mark_used() { usage_stats_.used = true; }
+
// May be null if image not yet decoded.
uint32_t ref_count = 0;
// Set to true if the image was corrupt and could not be decoded.
bool decode_failure = false;
private:
+ struct UsageStats {
+ int lock_count = 1;
+ bool used = false;
+ bool first_lock_wasted = false;
+ };
+
+ void ReportUsageStats() const;
+
std::unique_ptr<base::DiscardableMemory> data_;
bool is_locked_ = false;
+ UsageStats usage_stats_;
};
// Stores the GPU-side image and supporting fields.
@@ -129,13 +140,28 @@ class CC_EXPORT GpuImageDecodeController
void SetImage(sk_sp<SkImage> image);
const sk_sp<SkImage>& image() const { return image_; }
+ void mark_used() { usage_stats_.used = true; }
+ void notify_ref_reached_zero() {
+ if (++usage_stats_.ref_reached_zero_count == 1)
+ usage_stats_.first_ref_wasted = !usage_stats_.used;
+ }
+
// True if the image is counting against our memory limits.
bool budgeted = false;
uint32_t ref_count = 0;
private:
+ struct UsageStats {
+ bool used = false;
+ bool first_ref_wasted = false;
+ int ref_reached_zero_count = 0;
+ };
+
+ void ReportUsageStats() const;
+
// May be null if image not yet uploaded / prepared.
sk_sp<SkImage> image_;
+ UsageStats usage_stats_;
};
struct ImageData {
« no previous file with comments | « no previous file | cc/tiles/gpu_image_decode_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698