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

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

Issue 44453002: Remove HistogramSupport abstraction layer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
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 25 matching lines...) Expand all
36 #include "bindings/v8/ScriptController.h" 36 #include "bindings/v8/ScriptController.h"
37 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/dom/ExceptionCode.h" 38 #include "core/dom/ExceptionCode.h"
39 #include "core/html/ImageData.h" 39 #include "core/html/ImageData.h"
40 #include "core/html/canvas/Canvas2DContextAttributes.h" 40 #include "core/html/canvas/Canvas2DContextAttributes.h"
41 #include "core/html/canvas/CanvasRenderingContext2D.h" 41 #include "core/html/canvas/CanvasRenderingContext2D.h"
42 #include "core/html/canvas/WebGLContextAttributes.h" 42 #include "core/html/canvas/WebGLContextAttributes.h"
43 #include "core/html/canvas/WebGLRenderingContext.h" 43 #include "core/html/canvas/WebGLRenderingContext.h"
44 #include "core/frame/Frame.h" 44 #include "core/frame/Frame.h"
45 #include "core/page/Settings.h" 45 #include "core/page/Settings.h"
46 #include "core/platform/HistogramSupport.h"
47 #include "core/platform/MIMETypeRegistry.h" 46 #include "core/platform/MIMETypeRegistry.h"
48 #include "core/platform/graphics/GraphicsContextStateSaver.h" 47 #include "core/platform/graphics/GraphicsContextStateSaver.h"
49 #include "core/platform/graphics/ImageBuffer.h" 48 #include "core/platform/graphics/ImageBuffer.h"
50 #include "core/rendering/RenderHTMLCanvas.h" 49 #include "core/rendering/RenderHTMLCanvas.h"
51 #include "public/platform/Platform.h" 50 #include "public/platform/Platform.h"
52 51
53 namespace WebCore { 52 namespace WebCore {
54 53
55 using namespace HTMLNames; 54 using namespace HTMLNames;
56 55
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 ContextTypeCount, 161 ContextTypeCount,
163 }; 162 };
164 163
165 // FIXME - The code depends on the context not going away once created, to p revent JS from 164 // FIXME - The code depends on the context not going away once created, to p revent JS from
166 // seeing a dangling pointer. So for now we will disallow the context from b eing changed 165 // seeing a dangling pointer. So for now we will disallow the context from b eing changed
167 // once it is created. 166 // once it is created.
168 if (type == "2d") { 167 if (type == "2d") {
169 if (m_context && !m_context->is2d()) 168 if (m_context && !m_context->is2d())
170 return 0; 169 return 0;
171 if (!m_context) { 170 if (!m_context) {
172 HistogramSupport::histogramEnumeration("Canvas.ContextType", Context 2d, ContextTypeCount); 171 WebKit::Platform::current()->histogramEnumeration("Canvas.ContextTyp e", Context2d, ContextTypeCount);
173 m_context = CanvasRenderingContext2D::create(this, static_cast<Canva s2DContextAttributes*>(attrs), document().inQuirksMode()); 172 m_context = CanvasRenderingContext2D::create(this, static_cast<Canva s2DContextAttributes*>(attrs), document().inQuirksMode());
174 if (m_context) 173 if (m_context)
175 scheduleLayerUpdate(); 174 scheduleLayerUpdate();
176 } 175 }
177 return m_context.get(); 176 return m_context.get();
178 } 177 }
179 178
180 Settings* settings = document().settings(); 179 Settings* settings = document().settings();
181 if (settings && settings->webGLEnabled()) { 180 if (settings && settings->webGLEnabled()) {
182 // Accept the legacy "webkit-3d" name as well as the provisional "experi mental-webgl" name. 181 // Accept the legacy "webkit-3d" name as well as the provisional "experi mental-webgl" name.
183 // Now that WebGL is ratified, we will also accept "webgl" as the contex t name in Chrome. 182 // Now that WebGL is ratified, we will also accept "webgl" as the contex t name in Chrome.
184 ContextType contextType; 183 ContextType contextType;
185 bool is3dContext = true; 184 bool is3dContext = true;
186 if (type == "webkit-3d") 185 if (type == "webkit-3d")
187 contextType = ContextWebkit3d; 186 contextType = ContextWebkit3d;
188 else if (type == "experimental-webgl") 187 else if (type == "experimental-webgl")
189 contextType = ContextExperimentalWebgl; 188 contextType = ContextExperimentalWebgl;
190 else if (type == "webgl") 189 else if (type == "webgl")
191 contextType = ContextWebgl; 190 contextType = ContextWebgl;
192 else 191 else
193 is3dContext = false; 192 is3dContext = false;
194 193
195 if (is3dContext) { 194 if (is3dContext) {
196 if (m_context && !m_context->is3d()) 195 if (m_context && !m_context->is3d())
197 return 0; 196 return 0;
198 if (!m_context) { 197 if (!m_context) {
199 HistogramSupport::histogramEnumeration("Canvas.ContextType", con textType, ContextTypeCount); 198 WebKit::Platform::current()->histogramEnumeration("Canvas.Contex tType", contextType, ContextTypeCount);
200 m_context = WebGLRenderingContext::create(this, static_cast<WebG LContextAttributes*>(attrs)); 199 m_context = WebGLRenderingContext::create(this, static_cast<WebG LContextAttributes*>(attrs));
201 if (m_context) 200 if (m_context)
202 scheduleLayerUpdate(); 201 scheduleLayerUpdate();
203 } 202 }
204 return m_context.get(); 203 return m_context.get();
205 } 204 }
206 } 205 }
207 return 0; 206 return 0;
208 } 207 }
209 208
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 FloatSize unscaledSize = size(); 582 FloatSize unscaledSize = size();
584 FloatSize deviceSize = convertLogicalToDevice(unscaledSize); 583 FloatSize deviceSize = convertLogicalToDevice(unscaledSize);
585 IntSize size(deviceSize.width(), deviceSize.height()); 584 IntSize size(deviceSize.width(), deviceSize.height());
586 AffineTransform transform; 585 AffineTransform transform;
587 if (size.width() && size.height()) 586 if (size.width() && size.height())
588 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig ht() / unscaledSize.height()); 587 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig ht() / unscaledSize.height());
589 return m_imageBuffer->baseTransform() * transform; 588 return m_imageBuffer->baseTransform() * transform;
590 } 589 }
591 590
592 } 591 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLAnchorElement.cpp ('k') | Source/core/html/parser/HTMLResourcePreloader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698