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

Unified Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 1463573002: publish canvas context API stat metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/core/html/HTMLCanvasElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
index bf12c2feaf31ba82571f7577f0a1568762032aff..120c1a581abc2a0511df40b7ad4c9afac80c1fcd 100644
--- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -48,6 +48,7 @@
#include "platform/MIMETypeRegistry.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/graphics/Canvas2DImageBufferSurface.h"
+#include "platform/graphics/CanvasMetrics.h"
#include "platform/graphics/ExpensiveCanvasHeuristicParameters.h"
#include "platform/graphics/ImageBuffer.h"
#include "platform/graphics/RecordingImageBufferSurface.h"
@@ -117,6 +118,7 @@ inline HTMLCanvasElement::HTMLCanvasElement(Document& document)
, m_imageBufferIsClear(false)
{
setHasCustomStyleCallbacks();
+ CanvasMetrics::countCanvasContextStat(CanvasMetrics::ContextCreated);
Justin Novosad 2015/11/19 20:36:08 ContextCreated -> CanvasCreated
zmin 2015/11/19 22:23:36 Done.
}
DEFINE_NODE_FACTORY(HTMLCanvasElement)
@@ -653,20 +655,29 @@ PassOwnPtr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const
if (document().settings())
*msaaSampleCount = document().settings()->accelerated2dCanvasMSAASampleCount();
OwnPtr<ImageBufferSurface> surface = adoptPtr(new Canvas2DImageBufferSurface(deviceSize, *msaaSampleCount, opacityMode, Canvas2DLayerBridge::EnableAcceleration));
- if (surface->isValid())
+ if (surface->isValid()) {
+ CanvasMetrics::countCanvasContextStat(CanvasMetrics::ContextCreatedWithGPUAccelerated);
Justin Novosad 2015/11/19 20:36:08 GPUAccelerated2DCanvasImageBufferCreated
zmin 2015/11/19 22:23:36 Done.
return surface.release();
+ }
+ CanvasMetrics::countCanvasContextStat(CanvasMetrics::GPUContextCreationFailed);
Justin Novosad 2015/11/19 20:36:08 GPUAccelerated2DCanvasImageBufferCreationFailed
zmin 2015/11/19 22:23:36 Done.
}
OwnPtr<RecordingImageBufferFallbackSurfaceFactory> surfaceFactory = adoptPtr(new UnacceleratedSurfaceFactory());
if (shouldUseDisplayList(deviceSize)) {
OwnPtr<ImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(deviceSize, surfaceFactory.release(), opacityMode));
- if (surface->isValid())
+ if (surface->isValid()) {
+ CanvasMetrics::countCanvasContextStat(CanvasMetrics::ContextCreatedWithDisplayList);
Justin Novosad 2015/11/19 20:36:08 DisplayList2DCanvasImageBufferCreated
zmin 2015/11/19 22:23:36 Done.
return surface.release();
+ }
surfaceFactory = adoptPtr(new UnacceleratedSurfaceFactory()); // recreate because previous one was released
}
-
- return surfaceFactory->createSurface(deviceSize, opacityMode);
+ CanvasMetrics::countCanvasContextStat(CanvasMetrics::ContextCreatedWithSoftware);
Justin Novosad 2015/11/19 20:36:08 Too early to count this, we don't know if it will
zmin 2015/11/19 22:23:36 Done. Also change this to if (!surface->isValid())
+ auto surface = surfaceFactory->createSurface(deviceSize, opacityMode);
+ if (!surface->isValid()) {
+ CanvasMetrics::countCanvasContextStat(CanvasMetrics::SoftwareContextCreationFailed);
Justin Novosad 2015/11/19 20:36:08 Unaccelerated2DCanvasImageBufferCreationFailed
zmin 2015/11/19 22:23:36 Done.
+ }
+ return surface;
}
void HTMLCanvasElement::createImageBuffer()

Powered by Google App Engine
This is Rietveld 408576698