OLD | NEW |
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 CanvasRenderingContext* WebGLRenderingContext::Factory::create( | 88 CanvasRenderingContext* WebGLRenderingContext::Factory::create( |
89 ScriptState* scriptState, | 89 ScriptState* scriptState, |
90 OffscreenCanvas* offscreenCanvas, | 90 OffscreenCanvas* offscreenCanvas, |
91 const CanvasContextCreationAttributes& attrs) { | 91 const CanvasContextCreationAttributes& attrs) { |
92 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider( | 92 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider( |
93 createWebGraphicsContext3DProvider(scriptState, attrs, 1)); | 93 createWebGraphicsContext3DProvider(scriptState, attrs, 1)); |
94 if (!shouldCreateContext(contextProvider.get())) | 94 if (!shouldCreateContext(contextProvider.get())) |
95 return nullptr; | 95 return nullptr; |
96 | 96 |
97 WebGLRenderingContext* renderingContext = new WebGLRenderingContext( | 97 WebGLRenderingContext* renderingContext = |
98 offscreenCanvas, std::move(contextProvider), attrs); | 98 new WebGLRenderingContext(offscreenCanvas, std::move(contextProvider), |
| 99 attrs, scriptState->getExecutionContext()); |
99 if (!renderingContext->drawingBuffer()) | 100 if (!renderingContext->drawingBuffer()) |
100 return nullptr; | 101 return nullptr; |
101 renderingContext->initializeNewContext(); | 102 renderingContext->initializeNewContext(); |
102 renderingContext->registerContextExtensions(); | 103 renderingContext->registerContextExtensions(); |
103 | 104 |
104 return renderingContext; | 105 return renderingContext; |
105 } | 106 } |
106 | 107 |
107 CanvasRenderingContext* WebGLRenderingContext::Factory::create( | 108 CanvasRenderingContext* WebGLRenderingContext::Factory::create( |
108 HTMLCanvasElement* canvas, | 109 HTMLCanvasElement* canvas, |
(...skipping 29 matching lines...) Expand all Loading... |
138 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, | 139 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, |
139 const CanvasContextCreationAttributes& requestedAttributes) | 140 const CanvasContextCreationAttributes& requestedAttributes) |
140 : WebGLRenderingContextBase(passedCanvas, | 141 : WebGLRenderingContextBase(passedCanvas, |
141 std::move(contextProvider), | 142 std::move(contextProvider), |
142 requestedAttributes, | 143 requestedAttributes, |
143 1) {} | 144 1) {} |
144 | 145 |
145 WebGLRenderingContext::WebGLRenderingContext( | 146 WebGLRenderingContext::WebGLRenderingContext( |
146 OffscreenCanvas* passedOffscreenCanvas, | 147 OffscreenCanvas* passedOffscreenCanvas, |
147 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, | 148 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, |
148 const CanvasContextCreationAttributes& requestedAttributes) | 149 const CanvasContextCreationAttributes& requestedAttributes, |
| 150 ExecutionContext* executionContext) |
149 : WebGLRenderingContextBase(passedOffscreenCanvas, | 151 : WebGLRenderingContextBase(passedOffscreenCanvas, |
150 std::move(contextProvider), | 152 std::move(contextProvider), |
151 requestedAttributes, | 153 requestedAttributes, |
| 154 executionContext, |
152 1) {} | 155 1) {} |
153 | 156 |
154 WebGLRenderingContext::~WebGLRenderingContext() {} | 157 WebGLRenderingContext::~WebGLRenderingContext() {} |
155 | 158 |
156 void WebGLRenderingContext::setCanvasGetContextResult( | 159 void WebGLRenderingContext::setCanvasGetContextResult( |
157 RenderingContext& result) { | 160 RenderingContext& result) { |
158 result.setWebGLRenderingContext(this); | 161 result.setWebGLRenderingContext(this); |
159 } | 162 } |
160 | 163 |
161 void WebGLRenderingContext::setOffscreenCanvasGetContextResult( | 164 void WebGLRenderingContext::setOffscreenCanvasGetContextResult( |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 visitor->trace(m_webglDepthTexture); | 243 visitor->trace(m_webglDepthTexture); |
241 WebGLRenderingContextBase::trace(visitor); | 244 WebGLRenderingContextBase::trace(visitor); |
242 } | 245 } |
243 | 246 |
244 DEFINE_TRACE_WRAPPERS(WebGLRenderingContext) { | 247 DEFINE_TRACE_WRAPPERS(WebGLRenderingContext) { |
245 // Extensions are managed base WebGLRenderingContextBase. | 248 // Extensions are managed base WebGLRenderingContextBase. |
246 WebGLRenderingContextBase::traceWrappers(visitor); | 249 WebGLRenderingContextBase::traceWrappers(visitor); |
247 } | 250 } |
248 | 251 |
249 } // namespace blink | 252 } // namespace blink |
OLD | NEW |