Chromium Code Reviews| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 cached_height_(0), | 227 cached_height_(0), |
| 228 weak_ptr_factory_(this), | 228 weak_ptr_factory_(this), |
| 229 initialized_(false), | 229 initialized_(false), |
| 230 gl_(NULL), | 230 gl_(NULL), |
| 231 frame_number_(0), | 231 frame_number_(0), |
| 232 bind_generates_resources_(false), | 232 bind_generates_resources_(false), |
| 233 use_echo_for_swap_ack_(true), | 233 use_echo_for_swap_ack_(true), |
| 234 command_buffer_size_(0), | 234 command_buffer_size_(0), |
| 235 start_transfer_buffer_size_(0), | 235 start_transfer_buffer_size_(0), |
| 236 min_transfer_buffer_size_(0), | 236 min_transfer_buffer_size_(0), |
| 237 max_transfer_buffer_size_(0) { | 237 max_transfer_buffer_size_(0), |
| 238 mapped_memory_limit_(gpu::gles2::GLES2Implementation::kNoLimit) { | |
| 238 #if (defined(OS_MACOSX) || defined(OS_WIN)) && !defined(USE_AURA) | 239 #if (defined(OS_MACOSX) || defined(OS_WIN)) && !defined(USE_AURA) |
| 239 // Get ViewMsg_SwapBuffers_ACK from browser for single-threaded path. | 240 // Get ViewMsg_SwapBuffers_ACK from browser for single-threaded path. |
| 240 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 241 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 241 use_echo_for_swap_ack_ = | 242 use_echo_for_swap_ack_ = |
| 242 command_line.HasSwitch(switches::kEnableThreadedCompositing); | 243 command_line.HasSwitch(switches::kEnableThreadedCompositing); |
| 243 #endif | 244 #endif |
| 244 } | 245 } |
| 245 | 246 |
| 246 WebGraphicsContext3DCommandBufferImpl:: | 247 WebGraphicsContext3DCommandBufferImpl:: |
| 247 ~WebGraphicsContext3DCommandBufferImpl() { | 248 ~WebGraphicsContext3DCommandBufferImpl() { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 259 bool WebGraphicsContext3DCommandBufferImpl::InitializeWithDefaultBufferSizes( | 260 bool WebGraphicsContext3DCommandBufferImpl::InitializeWithDefaultBufferSizes( |
| 260 const WebGraphicsContext3D::Attributes& attributes, | 261 const WebGraphicsContext3D::Attributes& attributes, |
| 261 bool bind_generates_resources, | 262 bool bind_generates_resources, |
| 262 CauseForGpuLaunch cause) { | 263 CauseForGpuLaunch cause) { |
| 263 return Initialize(attributes, | 264 return Initialize(attributes, |
| 264 bind_generates_resources, | 265 bind_generates_resources, |
| 265 cause, | 266 cause, |
| 266 kDefaultCommandBufferSize, | 267 kDefaultCommandBufferSize, |
| 267 kDefaultStartTransferBufferSize, | 268 kDefaultStartTransferBufferSize, |
| 268 kDefaultMinTransferBufferSize, | 269 kDefaultMinTransferBufferSize, |
| 269 kDefaultMaxTransferBufferSize); | 270 kDefaultMaxTransferBufferSize, |
| 271 gpu::gles2::GLES2Implementation::kNoLimit); | |
| 270 } | 272 } |
| 271 | 273 |
| 272 bool WebGraphicsContext3DCommandBufferImpl::Initialize( | 274 bool WebGraphicsContext3DCommandBufferImpl::Initialize( |
| 273 const WebGraphicsContext3D::Attributes& attributes, | 275 const WebGraphicsContext3D::Attributes& attributes, |
| 274 bool bind_generates_resources, | 276 bool bind_generates_resources, |
| 275 CauseForGpuLaunch cause, | 277 CauseForGpuLaunch cause, |
| 276 size_t command_buffer_size, | 278 size_t command_buffer_size, |
| 277 size_t start_transfer_buffer_size, | 279 size_t start_transfer_buffer_size, |
| 278 size_t min_transfer_buffer_size, | 280 size_t min_transfer_buffer_size, |
| 279 size_t max_transfer_buffer_size) { | 281 size_t max_transfer_buffer_size, |
| 282 size_t mapped_memory_limit) { | |
| 280 TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::initialize"); | 283 TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::initialize"); |
| 281 | 284 |
| 282 attributes_ = attributes; | 285 attributes_ = attributes; |
| 283 bind_generates_resources_ = bind_generates_resources; | 286 bind_generates_resources_ = bind_generates_resources; |
| 284 DCHECK(!command_buffer_); | 287 DCHECK(!command_buffer_); |
| 285 | 288 |
| 286 if (!factory_) | 289 if (!factory_) |
| 287 return false; | 290 return false; |
| 288 | 291 |
| 289 if (attributes.preferDiscreteGPU) | 292 if (attributes.preferDiscreteGPU) |
| 290 gpu_preference_ = gfx::PreferDiscreteGpu; | 293 gpu_preference_ = gfx::PreferDiscreteGpu; |
| 291 | 294 |
| 292 host_ = factory_->EstablishGpuChannelSync(cause); | 295 host_ = factory_->EstablishGpuChannelSync(cause); |
| 293 if (!host_.get()) | 296 if (!host_.get()) |
| 294 return false; | 297 return false; |
| 295 | 298 |
| 296 command_buffer_size_ = command_buffer_size; | 299 command_buffer_size_ = command_buffer_size; |
| 297 start_transfer_buffer_size_ = start_transfer_buffer_size; | 300 start_transfer_buffer_size_ = start_transfer_buffer_size; |
| 298 min_transfer_buffer_size_ = min_transfer_buffer_size; | 301 min_transfer_buffer_size_ = min_transfer_buffer_size; |
| 299 max_transfer_buffer_size_ = max_transfer_buffer_size; | 302 max_transfer_buffer_size_ = max_transfer_buffer_size; |
| 303 mapped_memory_limit_ = mapped_memory_limit; | |
|
piman
2013/08/19 21:44:21
This is set, but never used anywhere. We should ei
kaanb
2013/08/19 21:56:15
Done.
| |
| 300 | 304 |
| 301 return true; | 305 return true; |
| 302 } | 306 } |
| 303 | 307 |
| 304 bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL( | 308 bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL( |
| 305 const char* allowed_extensions) { | 309 const char* allowed_extensions) { |
| 306 if (initialized_) | 310 if (initialized_) |
| 307 return true; | 311 return true; |
| 308 | 312 |
| 309 if (initialize_failed_) | 313 if (initialize_failed_) |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1586 | 1590 |
| 1587 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( | 1591 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( |
| 1588 const std::string& message, int id) { | 1592 const std::string& message, int id) { |
| 1589 if (error_message_callback_) { | 1593 if (error_message_callback_) { |
| 1590 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); | 1594 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); |
| 1591 error_message_callback_->onErrorMessage(str, id); | 1595 error_message_callback_->onErrorMessage(str, id); |
| 1592 } | 1596 } |
| 1593 } | 1597 } |
| 1594 | 1598 |
| 1595 } // namespace content | 1599 } // namespace content |
| OLD | NEW |