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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 1652983005: Remove Enumeration Histograms from the Blink Platform API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_blink_histograms_5a
Patch Set: Rebase two new histograms were added today 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 28 matching lines...) Expand all
39 #include "core/frame/Settings.h" 39 #include "core/frame/Settings.h"
40 #include "core/html/ImageData.h" 40 #include "core/html/ImageData.h"
41 #include "core/html/canvas/CanvasAsyncBlobCreator.h" 41 #include "core/html/canvas/CanvasAsyncBlobCreator.h"
42 #include "core/html/canvas/CanvasContextCreationAttributes.h" 42 #include "core/html/canvas/CanvasContextCreationAttributes.h"
43 #include "core/html/canvas/CanvasFontCache.h" 43 #include "core/html/canvas/CanvasFontCache.h"
44 #include "core/html/canvas/CanvasRenderingContext.h" 44 #include "core/html/canvas/CanvasRenderingContext.h"
45 #include "core/html/canvas/CanvasRenderingContextFactory.h" 45 #include "core/html/canvas/CanvasRenderingContextFactory.h"
46 #include "core/imagebitmap/ImageBitmapOptions.h" 46 #include "core/imagebitmap/ImageBitmapOptions.h"
47 #include "core/layout/LayoutHTMLCanvas.h" 47 #include "core/layout/LayoutHTMLCanvas.h"
48 #include "core/paint/PaintLayer.h" 48 #include "core/paint/PaintLayer.h"
49 #include "platform/Histogram.h"
49 #include "platform/MIMETypeRegistry.h" 50 #include "platform/MIMETypeRegistry.h"
50 #include "platform/RuntimeEnabledFeatures.h" 51 #include "platform/RuntimeEnabledFeatures.h"
51 #include "platform/graphics/Canvas2DImageBufferSurface.h" 52 #include "platform/graphics/Canvas2DImageBufferSurface.h"
52 #include "platform/graphics/CanvasMetrics.h" 53 #include "platform/graphics/CanvasMetrics.h"
53 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" 54 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h"
54 #include "platform/graphics/ImageBuffer.h" 55 #include "platform/graphics/ImageBuffer.h"
55 #include "platform/graphics/RecordingImageBufferSurface.h" 56 #include "platform/graphics/RecordingImageBufferSurface.h"
56 #include "platform/graphics/StaticBitmapImage.h" 57 #include "platform/graphics/StaticBitmapImage.h"
57 #include "platform/graphics/UnacceleratedImageBufferSurface.h" 58 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
58 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" 59 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 231
231 CanvasRenderingContext* HTMLCanvasElement::getCanvasRenderingContext(const Strin g& type, const CanvasContextCreationAttributes& attributes) 232 CanvasRenderingContext* HTMLCanvasElement::getCanvasRenderingContext(const Strin g& type, const CanvasContextCreationAttributes& attributes)
232 { 233 {
233 CanvasRenderingContext::ContextType contextType = CanvasRenderingContext::co ntextTypeFromId(type); 234 CanvasRenderingContext::ContextType contextType = CanvasRenderingContext::co ntextTypeFromId(type);
234 235
235 // Unknown type. 236 // Unknown type.
236 if (contextType == CanvasRenderingContext::ContextTypeCount) 237 if (contextType == CanvasRenderingContext::ContextTypeCount)
237 return nullptr; 238 return nullptr;
238 239
239 // Log the aliased context type used. 240 // Log the aliased context type used.
240 if (!m_context) 241 if (!m_context) {
241 Platform::current()->histogramEnumeration("Canvas.ContextType", contextT ype, CanvasRenderingContext::ContextTypeCount); 242 DEFINE_STATIC_LOCAL(EnumerationHistogram, contextTypeHistogram, ("Canvas .ContextType", CanvasRenderingContext::ContextTypeCount));
243 contextTypeHistogram.count(contextType);
244 }
242 245
243 contextType = CanvasRenderingContext::resolveContextTypeAliases(contextType) ; 246 contextType = CanvasRenderingContext::resolveContextTypeAliases(contextType) ;
244 247
245 CanvasRenderingContextFactory* factory = getRenderingContextFactory(contextT ype); 248 CanvasRenderingContextFactory* factory = getRenderingContextFactory(contextT ype);
246 if (!factory) 249 if (!factory)
247 return nullptr; 250 return nullptr;
248 251
249 // FIXME - The code depends on the context not going away once created, to p revent JS from 252 // FIXME - The code depends on the context not going away once created, to p revent JS from
250 // seeing a dangling pointer. So for now we will disallow the context from b eing changed 253 // seeing a dangling pointer. So for now we will disallow the context from b eing changed
251 // once it is created. 254 // once it is created.
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 } 1024 }
1022 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im ageBitmap::create(this, IntRect(sx, sy, sw, sh), options) : nullptr); 1025 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im ageBitmap::create(this, IntRect(sx, sy, sw, sh), options) : nullptr);
1023 } 1026 }
1024 1027
1025 bool HTMLCanvasElement::isOpaque() const 1028 bool HTMLCanvasElement::isOpaque() const
1026 { 1029 {
1027 return m_context && !m_context->hasAlpha(); 1030 return m_context && !m_context->hasAlpha();
1028 } 1031 }
1029 1032
1030 } // namespace blink 1033 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698