OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "gpu/GLES2/gl2.h" | 9 #include "gpu/GLES2/gl2.h" |
10 #ifndef GL_GLEXT_PROTOTYPES | 10 #ifndef GL_GLEXT_PROTOTYPES |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 return false; | 84 return false; |
85 | 85 |
86 // The noExtensions and canRecoverFromContextLoss flags are | 86 // The noExtensions and canRecoverFromContextLoss flags are |
87 // currently used as hints that we are creating a context on | 87 // currently used as hints that we are creating a context on |
88 // behalf of WebGL or accelerated 2D canvas, respectively. | 88 // behalf of WebGL or accelerated 2D canvas, respectively. |
89 if (attributes.noExtensions || !attributes.canRecoverFromContextLoss) | 89 if (attributes.noExtensions || !attributes.canRecoverFromContextLoss) |
90 gpu_preference_ = gfx::PreferDiscreteGpu; | 90 gpu_preference_ = gfx::PreferDiscreteGpu; |
91 | 91 |
92 bool retry = false; | 92 bool retry = false; |
93 | 93 |
| 94 // Note similar code in Pepper PlatformContext3DImpl::Init. |
94 do { | 95 do { |
95 host_ = render_thread->EstablishGpuChannelSync( | 96 host_ = render_thread->EstablishGpuChannelSync( |
96 content:: | 97 content:: |
97 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE); | 98 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE); |
98 if (!host_) | 99 if (!host_) |
99 return false; | 100 return false; |
100 DCHECK(host_->state() == GpuChannelHost::kConnected); | 101 DCHECK(host_->state() == GpuChannelHost::kConnected); |
101 | 102 |
102 if (!retry) { | 103 if (!retry) { |
103 // If the creation of this context requires all contexts for this | 104 // If the creation of this context requires all contexts for this |
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 if (context_lost_callback_) { | 1145 if (context_lost_callback_) { |
1145 context_lost_callback_->onContextLost(); | 1146 context_lost_callback_->onContextLost(); |
1146 } | 1147 } |
1147 RenderViewImpl* renderview = | 1148 RenderViewImpl* renderview = |
1148 web_view_ ? RenderViewImpl::FromWebView(web_view_) : NULL; | 1149 web_view_ ? RenderViewImpl::FromWebView(web_view_) : NULL; |
1149 if (renderview) | 1150 if (renderview) |
1150 renderview->OnViewContextSwapBuffersAborted(); | 1151 renderview->OnViewContextSwapBuffersAborted(); |
1151 } | 1152 } |
1152 | 1153 |
1153 #endif // defined(ENABLE_GPU) | 1154 #endif // defined(ENABLE_GPU) |
OLD | NEW |