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

Side by Side Diff: Source/core/html/canvas/WebGLRenderingContext.cpp

Issue 365653002: Oilpan: move 2D Canvas and WebGL objects to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Complete VectorTraits<> specialization for VertexAttribState Created 6 years, 5 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) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 Settings* settings = frame->settings(); 72 Settings* settings = frame->settings();
73 73
74 // The FrameLoaderClient might block creation of a new WebGL context despite the page settings; in 74 // The FrameLoaderClient might block creation of a new WebGL context despite the page settings; in
75 // particular, if WebGL contexts were lost one or more times via the GL_ARB_ robustness extension. 75 // particular, if WebGL contexts were lost one or more times via the GL_ARB_ robustness extension.
76 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled ())) { 76 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled ())) {
77 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Web page was not allowed to create a WebGL cont ext.")); 77 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Web page was not allowed to create a WebGL cont ext."));
78 return nullptr; 78 return nullptr;
79 } 79 }
80 80
81 // The only situation that attrs is null is through Document::getCSSCanvasCo ntext(). 81 // The only situation that attrs is null is through Document::getCSSCanvasCo ntext().
82 RefPtr<WebGLContextAttributes> defaultAttrs; 82 RefPtrWillBeRawPtr<WebGLContextAttributes> defaultAttrs = nullptr;
83 if (!attrs) { 83 if (!attrs) {
84 defaultAttrs = WebGLContextAttributes::create(); 84 defaultAttrs = WebGLContextAttributes::create();
85 attrs = defaultAttrs.get(); 85 attrs = defaultAttrs.get();
86 } 86 }
87 blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(docum ent.topDocument().url().string(), settings); 87 blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(docum ent.topDocument().url().string(), settings);
88 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr ent()->createOffscreenGraphicsContext3D(attributes, 0)); 88 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr ent()->createOffscreenGraphicsContext3D(attributes, 0));
89 if (!context || !context->makeContextCurrent()) { 89 if (!context || !context->makeContextCurrent()) {
90 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Could not create a WebGL context.")); 90 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Could not create a WebGL context."));
91 return nullptr; 91 return nullptr;
92 } 92 }
(...skipping 17 matching lines...) Expand all
110 } 110 }
111 111
112 WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, Pa ssOwnPtr<blink::WebGraphicsContext3D> context, WebGLContextAttributes* requested Attributes) 112 WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, Pa ssOwnPtr<blink::WebGraphicsContext3D> context, WebGLContextAttributes* requested Attributes)
113 : WebGLRenderingContextBase(passedCanvas, context, requestedAttributes) 113 : WebGLRenderingContextBase(passedCanvas, context, requestedAttributes)
114 { 114 {
115 ScriptWrappable::init(this); 115 ScriptWrappable::init(this);
116 } 116 }
117 117
118 WebGLRenderingContext::~WebGLRenderingContext() 118 WebGLRenderingContext::~WebGLRenderingContext()
119 { 119 {
120 120
haraken 2014/07/02 07:47:38 Nit: Unnecessary empty line.
sof 2014/07/02 11:43:52 Gone.
121 } 121 }
122 122
123 void WebGLRenderingContext::registerContextExtensions() 123 void WebGLRenderingContext::registerContextExtensions()
124 { 124 {
125 // Register extensions. 125 // Register extensions.
126 static const char* const bothPrefixes[] = { "", "WEBKIT_", 0, }; 126 static const char* const bothPrefixes[] = { "", "WEBKIT_", 0, };
127 127
128 registerExtension<ANGLEInstancedArrays>(m_angleInstancedArrays); 128 registerExtension<ANGLEInstancedArrays>(m_angleInstancedArrays);
129 registerExtension<EXTBlendMinMax>(m_extBlendMinMax); 129 registerExtension<EXTBlendMinMax>(m_extBlendMinMax);
130 registerExtension<EXTFragDepth>(m_extFragDepth); 130 registerExtension<EXTFragDepth>(m_extFragDepth);
(...skipping 10 matching lines...) Expand all
141 registerExtension<WebGLCompressedTextureETC1>(m_webglCompressedTextureETC1); 141 registerExtension<WebGLCompressedTextureETC1>(m_webglCompressedTextureETC1);
142 registerExtension<WebGLCompressedTexturePVRTC>(m_webglCompressedTexturePVRTC , ApprovedExtension, bothPrefixes); 142 registerExtension<WebGLCompressedTexturePVRTC>(m_webglCompressedTexturePVRTC , ApprovedExtension, bothPrefixes);
143 registerExtension<WebGLCompressedTextureS3TC>(m_webglCompressedTextureS3TC, ApprovedExtension, bothPrefixes); 143 registerExtension<WebGLCompressedTextureS3TC>(m_webglCompressedTextureS3TC, ApprovedExtension, bothPrefixes);
144 registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo); 144 registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo);
145 registerExtension<WebGLDebugShaders>(m_webglDebugShaders); 145 registerExtension<WebGLDebugShaders>(m_webglDebugShaders);
146 registerExtension<WebGLDepthTexture>(m_webglDepthTexture, ApprovedExtension, bothPrefixes); 146 registerExtension<WebGLDepthTexture>(m_webglDepthTexture, ApprovedExtension, bothPrefixes);
147 registerExtension<WebGLDrawBuffers>(m_webglDrawBuffers); 147 registerExtension<WebGLDrawBuffers>(m_webglDrawBuffers);
148 registerExtension<WebGLLoseContext>(m_webglLoseContext, ApprovedExtension, b othPrefixes); 148 registerExtension<WebGLLoseContext>(m_webglLoseContext, ApprovedExtension, b othPrefixes);
149 } 149 }
150 150
151 void WebGLRenderingContext::trace(Visitor* visitor)
152 {
153 visitor->trace(m_angleInstancedArrays);
154 visitor->trace(m_extBlendMinMax);
155 visitor->trace(m_extFragDepth);
156 visitor->trace(m_extShaderTextureLOD);
157 visitor->trace(m_extTextureFilterAnisotropic);
158 visitor->trace(m_oesTextureFloat);
159 visitor->trace(m_oesTextureFloatLinear);
160 visitor->trace(m_oesTextureHalfFloat);
161 visitor->trace(m_oesTextureHalfFloatLinear);
162 visitor->trace(m_oesStandardDerivatives);
163 visitor->trace(m_oesVertexArrayObject);
164 visitor->trace(m_oesElementIndexUint);
165 visitor->trace(m_webglLoseContext);
166 visitor->trace(m_webglDebugRendererInfo);
167 visitor->trace(m_webglDebugShaders);
168 visitor->trace(m_webglDrawBuffers);
169 visitor->trace(m_webglCompressedTextureATC);
170 visitor->trace(m_webglCompressedTextureETC1);
171 visitor->trace(m_webglCompressedTexturePVRTC);
172 visitor->trace(m_webglCompressedTextureS3TC);
173 visitor->trace(m_webglDepthTexture);
174 WebGLRenderingContextBase::trace(visitor);
175 }
176
151 } // namespace WebCore 177 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698