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

Unified Diff: src/core/SkImageCacherator.cpp

Issue 1652053004: Add Histogram Macros to Skia (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Fix unused constant error in release w/ enum-based constant Created 4 years, 10 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 | « include/core/SkPostConfig.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageCacherator.cpp
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index 572778e19ca16a02e1e99ff89415b6aff390fc19..dc831d7cbf6522b04a64740dc5a30a7699c798dd 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -240,9 +240,24 @@ static GrTexture* set_key_and_return(GrTexture* tex, const GrUniqueKey& key) {
*/
GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key,
const SkImage* client, SkImage::CachingHint chint) {
+ // Values representing the various texture lock paths we can take. Used for logging the path
+ // taken to a histogram.
+ enum LockTexturePath {
+ kFailure_LockTexturePath,
+ kPreExisting_LockTexturePath,
+ kNative_LockTexturePath,
+ kCompressed_LockTexturePath,
+ kYUV_LockTexturePath,
+ kRGBA_LockTexturePath,
+ };
+
+ enum { kLockTexturePathCount = kRGBA_LockTexturePath + 1 };
ericrk 2016/02/05 22:59:02 This appears to be the style in Skia anyway for co
+
// 1. Check the cache for a pre-existing one
if (key.isValid()) {
if (GrTexture* tex = ctx->textureProvider()->findAndRefTextureByUniqueKey(key)) {
+ SK_HISTOGRAM_ENUMERATION("LockTexturePath", kPreExisting_LockTexturePath,
+ kLockTexturePathCount);
return tex;
}
}
@@ -252,6 +267,8 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key
ScopedGenerator generator(this);
SkIRect subset = SkIRect::MakeXYWH(fOrigin.x(), fOrigin.y(), fInfo.width(), fInfo.height());
if (GrTexture* tex = generator->generateTexture(ctx, &subset)) {
+ SK_HISTOGRAM_ENUMERATION("LockTexturePath", kNative_LockTexturePath,
+ kLockTexturePathCount);
return set_key_and_return(tex, key);
}
}
@@ -263,6 +280,8 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key
if (data) {
GrTexture* tex = load_compressed_into_texture(ctx, data, desc);
if (tex) {
+ SK_HISTOGRAM_ENUMERATION("LockTexturePath", kCompressed_LockTexturePath,
+ kLockTexturePathCount);
return set_key_and_return(tex, key);
}
}
@@ -273,6 +292,8 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key
Generator_GrYUVProvider provider(generator);
GrTexture* tex = provider.refAsTexture(ctx, desc, true);
if (tex) {
+ SK_HISTOGRAM_ENUMERATION("LockTexturePath", kYUV_LockTexturePath,
+ kLockTexturePathCount);
return set_key_and_return(tex, key);
}
}
@@ -282,9 +303,13 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key
if (this->tryLockAsBitmap(&bitmap, client, chint)) {
GrTexture* tex = GrUploadBitmapToTexture(ctx, bitmap);
if (tex) {
+ SK_HISTOGRAM_ENUMERATION("LockTexturePath", kRGBA_LockTexturePath,
+ kLockTexturePathCount);
return set_key_and_return(tex, key);
}
}
+ SK_HISTOGRAM_ENUMERATION("LockTexturePath", kFailure_LockTexturePath,
+ kLockTexturePathCount);
return nullptr;
}
« no previous file with comments | « include/core/SkPostConfig.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698