OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" | 7 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" |
8 | 8 |
9 #include "third_party/khronos/GLES2/gl2.h" | 9 #include "third_party/khronos/GLES2/gl2.h" |
10 #ifndef GL_GLEXT_PROTOTYPES | 10 #ifndef GL_GLEXT_PROTOTYPES |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 if (web_view && web_view->mainFrame()) | 140 if (web_view && web_view->mainFrame()) |
141 active_url_ = GURL(web_view->mainFrame()->document().url()); | 141 active_url_ = GURL(web_view->mainFrame()->document().url()); |
142 | 142 |
143 attributes_ = attributes; | 143 attributes_ = attributes; |
144 render_directly_to_web_view_ = render_directly_to_web_view; | 144 render_directly_to_web_view_ = render_directly_to_web_view; |
145 if (render_directly_to_web_view_) { | 145 if (render_directly_to_web_view_) { |
146 RenderViewImpl* render_view = RenderViewImpl::FromWebView(web_view); | 146 RenderViewImpl* render_view = RenderViewImpl::FromWebView(web_view); |
147 if (!render_view) | 147 if (!render_view) |
148 return false; | 148 return false; |
149 render_view_routing_id_ = render_view->routing_id(); | 149 surface_id_ = render_view->surface_id(); |
150 web_view_ = web_view; | 150 web_view_ = web_view; |
151 } | 151 } |
152 return true; | 152 return true; |
153 } | 153 } |
154 | 154 |
155 bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() { | 155 bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() { |
156 if (context_) | 156 if (context_) |
157 return true; | 157 return true; |
158 if (initialize_failed_) | 158 if (initialize_failed_) |
159 return false; | 159 return false; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 base::AutoLock lock(g_all_shared_contexts_lock.Get()); | 195 base::AutoLock lock(g_all_shared_contexts_lock.Get()); |
196 RendererGLContext* share_group = NULL; | 196 RendererGLContext* share_group = NULL; |
197 if (attributes_.shareResources) { | 197 if (attributes_.shareResources) { |
198 share_group = g_all_shared_contexts.Pointer()->empty() ? | 198 share_group = g_all_shared_contexts.Pointer()->empty() ? |
199 NULL : (*g_all_shared_contexts.Pointer()->begin())->context_; | 199 NULL : (*g_all_shared_contexts.Pointer()->begin())->context_; |
200 } | 200 } |
201 | 201 |
202 if (render_directly_to_web_view_) { | 202 if (render_directly_to_web_view_) { |
203 context_ = RendererGLContext::CreateViewContext( | 203 context_ = RendererGLContext::CreateViewContext( |
204 host_, | 204 host_, |
205 render_view_routing_id_, | 205 surface_id_, |
206 share_group, | 206 share_group, |
207 preferred_extensions, | 207 preferred_extensions, |
208 attribs, | 208 attribs, |
209 active_url_, | 209 active_url_, |
210 gpu_preference_); | 210 gpu_preference_); |
211 } else { | 211 } else { |
212 context_ = RendererGLContext::CreateOffscreenContext( | 212 context_ = RendererGLContext::CreateOffscreenContext( |
213 host_, | 213 host_, |
214 gfx::Size(1, 1), | 214 gfx::Size(1, 1), |
215 share_group, | 215 share_group, |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 } | 1199 } |
1200 if (attributes_.shareResources) | 1200 if (attributes_.shareResources) |
1201 ClearSharedContexts(); | 1201 ClearSharedContexts(); |
1202 RenderViewImpl* renderview = | 1202 RenderViewImpl* renderview = |
1203 web_view_ ? RenderViewImpl::FromWebView(web_view_) : NULL; | 1203 web_view_ ? RenderViewImpl::FromWebView(web_view_) : NULL; |
1204 if (renderview) | 1204 if (renderview) |
1205 renderview->OnViewContextSwapBuffersAborted(); | 1205 renderview->OnViewContextSwapBuffersAborted(); |
1206 } | 1206 } |
1207 | 1207 |
1208 #endif // defined(ENABLE_GPU) | 1208 #endif // defined(ENABLE_GPU) |
OLD | NEW |