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

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

Issue 179163004: Have Document::topDocument() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
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 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Web page was not allowed to create a WebGL cont ext.")); 72 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Web page was not allowed to create a WebGL cont ext."));
73 return nullptr; 73 return nullptr;
74 } 74 }
75 75
76 // The only situation that attrs is null is through Document::getCSSCanvasCo ntext(). 76 // The only situation that attrs is null is through Document::getCSSCanvasCo ntext().
77 RefPtr<WebGLContextAttributes> defaultAttrs; 77 RefPtr<WebGLContextAttributes> defaultAttrs;
78 if (!attrs) { 78 if (!attrs) {
79 defaultAttrs = WebGLContextAttributes::create(); 79 defaultAttrs = WebGLContextAttributes::create();
80 attrs = defaultAttrs.get(); 80 attrs = defaultAttrs.get();
81 } 81 }
82 blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(docum ent.topDocument()->url().string(), settings); 82 blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(docum ent.topDocument().url().string(), settings);
83 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr ent()->createOffscreenGraphicsContext3D(attributes)); 83 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr ent()->createOffscreenGraphicsContext3D(attributes));
84 if (!context || !context->makeContextCurrent()) { 84 if (!context || !context->makeContextCurrent()) {
85 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Could not create a WebGL context.")); 85 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Could not create a WebGL context."));
86 return nullptr; 86 return nullptr;
87 } 87 }
88 88
89 Extensions3DUtil extensionsUtil(context.get()); 89 Extensions3DUtil extensionsUtil(context.get());
90 if (extensionsUtil.supportsExtension("GL_EXT_debug_marker")) 90 if (extensionsUtil.supportsExtension("GL_EXT_debug_marker"))
91 context->pushGroupMarkerEXT("WebGLRenderingContext"); 91 context->pushGroupMarkerEXT("WebGLRenderingContext");
92 92
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 // Register draft extensions. 138 // Register draft extensions.
139 registerExtension<EXTFragDepth>(m_extFragDepth, DraftExtension); 139 registerExtension<EXTFragDepth>(m_extFragDepth, DraftExtension);
140 140
141 // Register privileged extensions. 141 // Register privileged extensions.
142 registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo, WebGLDeb ugRendererInfoExtension); 142 registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo, WebGLDeb ugRendererInfoExtension);
143 registerExtension<WebGLDebugShaders>(m_webglDebugShaders, PrivilegedExtensio n); 143 registerExtension<WebGLDebugShaders>(m_webglDebugShaders, PrivilegedExtensio n);
144 } 144 }
145 145
146 } // namespace WebCore 146 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698