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

Unified Diff: third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp

Issue 2400223002: Add UMA metrics to OffscreenCanvas's commit type (Closed)
Patch Set: rebase + address comments Created 4 years, 2 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
Index: third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
index 63509a2b5a8131e012a4f46a3f453ee76e8a0029..0ac9f238db4510c057c37501c8a38d140dcc5b2e 100644
--- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
+++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
@@ -12,9 +12,8 @@
#include "cc/quads/texture_draw_quad.h"
#include "cc/resources/returned_resource.h"
#include "gpu/command_buffer/client/gles2_interface.h"
-#include "platform/RuntimeEnabledFeatures.h"
+#include "platform/Histogram.h"
#include "platform/graphics/gpu/SharedGpuContext.h"
-#include "platform/RuntimeEnabledFeatures.h"
#include "public/platform/InterfaceProvider.h"
#include "public/platform/Platform.h"
#include "public/platform/WebGraphicsContext3DProvider.h"
@@ -183,21 +182,35 @@ void OffscreenCanvasFrameDispatcherImpl::dispatchFrame(
// TODO(crbug.com/646022): making this overlay-able.
resource.is_overlay_candidate = false;
- if (image->isTextureBacked() &&
- Platform::current()->isGPUCompositingEnabled() &&
- !isWebGLSoftwareRendering) {
- // Case 1: both canvas and compositor are gpu accelerated.
- setTransferableResourceToStaticBitmapImage(resource, image);
- } else if (!Platform::current()->isGPUCompositingEnabled() ||
- isWebGLSoftwareRendering) {
- // Case 2: both canvas and compositor are not gpu accelerated, or canvas is
- // accelerated but --disable-gpu-compositing is specified, or
- // WebGL's commit called with swiftshader. The last case is indicated by
- // WebGraphicsContext3DProvider::isSoftwareRendering.
- setTransferableResourceToSharedBitmap(resource, image);
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(
+ EnumerationHistogram, commitTypeHistogram,
+ new EnumerationHistogram("OffscreenCanvas.CommitType",
+ OffscreenCanvasCommitTypeCount));
+ if (image->isTextureBacked()) {
+ if (Platform::current()->isGPUCompositingEnabled() &&
+ !isWebGLSoftwareRendering) {
+ // Case 1: both canvas and compositor are gpu accelerated.
+ commitTypeHistogram.count(CommitGPUCanvasGPUCompositing);
+ setTransferableResourceToStaticBitmapImage(resource, image);
+ } else {
+ // Case 2: canvas is accelerated but --disable-gpu-compositing is
+ // specified, or WebGL's commit is called with SwiftShader. The latter
+ // case is indicated by
+ // WebGraphicsContext3DProvider::isSoftwareRendering.
+ commitTypeHistogram.count(CommitGPUCanvasSoftwareCompositing);
+ setTransferableResourceToSharedBitmap(resource, image);
+ }
} else {
- // Case 3: canvas is not gpu-accelerated, but compositor is.
- setTransferableResourceToSharedGPUContext(resource, image);
+ if (Platform::current()->isGPUCompositingEnabled() &&
+ !isWebGLSoftwareRendering) {
+ // Case 3: canvas is not gpu-accelerated, but compositor is
+ commitTypeHistogram.count(CommitSoftwareCanvasGPUCompositing);
+ setTransferableResourceToSharedGPUContext(resource, image);
+ } else {
+ // Case 4: both canvas and compositor are not gpu accelerated.
+ commitTypeHistogram.count(CommitSoftwareCanvasSoftwareCompositing);
+ setTransferableResourceToSharedBitmap(resource, image);
+ }
}
m_nextResourceId++;

Powered by Google App Engine
This is Rietveld 408576698