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

Unified Diff: third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp

Issue 2411703004: Add usage counter to OffscreenCanvas API calls (Closed)
Patch Set: fix compile error 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/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
diff --git a/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
index 9502e2a9f24ba4be109a20e8adfa88ab7b1df14b..00b0a2ddb4afe36e632fa67ab551fec7c33854b7 100644
--- a/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
+++ b/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
@@ -45,7 +45,10 @@ DEFINE_TRACE(OffscreenCanvasRenderingContext2D) {
BaseRenderingContext2D::trace(visitor);
}
-void OffscreenCanvasRenderingContext2D::commit(ExceptionState& exceptionState) {
+void OffscreenCanvasRenderingContext2D::commit(ScriptState* scriptState,
+ ExceptionState& exceptionState) {
+ UseCounter::Feature feature = UseCounter::OffscreenCanvasCommit2D;
+ UseCounter::count(scriptState->getExecutionContext(), feature);
if (getOffscreenCanvas()->getAssociatedCanvasId() < 0) {
// If an OffscreenCanvas has no associated canvas Id, it indicates that
// it is not an OffscreenCanvas created by transfering control from html
@@ -137,7 +140,11 @@ OffscreenCanvasRenderingContext2D::transferToStaticBitmapImage() {
return image;
}
-ImageBitmap* OffscreenCanvasRenderingContext2D::transferToImageBitmap() {
+ImageBitmap* OffscreenCanvasRenderingContext2D::transferToImageBitmap(
+ ScriptState* scriptState) {
+ UseCounter::Feature feature =
+ UseCounter::OffscreenCanvasTransferToImageBitmap2D;
+ UseCounter::count(scriptState->getExecutionContext(), feature);
RefPtr<StaticBitmapImage> image = transferToStaticBitmapImage();
if (!image)
return nullptr;

Powered by Google App Engine
This is Rietveld 408576698