| 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 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 5 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 6 | 6 |
| 7 #include "third_party/khronos/GLES2/gl2.h" | 7 #include "third_party/khronos/GLES2/gl2.h" |
| 8 #ifndef GL_GLEXT_PROTOTYPES | 8 #ifndef GL_GLEXT_PROTOTYPES |
| 9 #define GL_GLEXT_PROTOTYPES 1 | 9 #define GL_GLEXT_PROTOTYPES 1 |
| 10 #endif | 10 #endif |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 if (host_->WillGpuSwitchOccur(true, gpu_preference_)) { | 114 if (host_->WillGpuSwitchOccur(true, gpu_preference_)) { |
| 115 host_->ForciblyCloseChannel(); | 115 host_->ForciblyCloseChannel(); |
| 116 ClearSharedContexts(); | 116 ClearSharedContexts(); |
| 117 retry = true; | 117 retry = true; |
| 118 } | 118 } |
| 119 } else { | 119 } else { |
| 120 retry = false; | 120 retry = false; |
| 121 } | 121 } |
| 122 } while (retry); | 122 } while (retry); |
| 123 | 123 |
| 124 const content::GPUInfo& gpu_info = host_->gpu_info(); | |
| 125 UMA_HISTOGRAM_ENUMERATION( | |
| 126 "GPU.WebGraphicsContext3D_Init_CanLoseContext", | |
| 127 attributes.canRecoverFromContextLoss * 2 + gpu_info.can_lose_context, | |
| 128 4); | |
| 129 if (attributes.canRecoverFromContextLoss == false) { | |
| 130 if (gpu_info.can_lose_context) | |
| 131 return false; | |
| 132 } | |
| 133 | |
| 134 attributes_ = attributes; | 124 attributes_ = attributes; |
| 135 return true; | 125 return true; |
| 136 } | 126 } |
| 137 | 127 |
| 138 bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() { | 128 bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() { |
| 139 if (context_) | 129 if (context_) |
| 140 return true; | 130 return true; |
| 141 if (initialize_failed_) | 131 if (initialize_failed_) |
| 142 return false; | 132 return false; |
| 143 | 133 |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 } | 1212 } |
| 1223 | 1213 |
| 1224 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( | 1214 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( |
| 1225 const std::string& message, int id) { | 1215 const std::string& message, int id) { |
| 1226 if (error_message_callback_) { | 1216 if (error_message_callback_) { |
| 1227 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); | 1217 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); |
| 1228 error_message_callback_->onErrorMessage(str, id); | 1218 error_message_callback_->onErrorMessage(str, id); |
| 1229 } | 1219 } |
| 1230 } | 1220 } |
| 1231 | 1221 |
| OLD | NEW |