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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 WebGraphicsContext3DCommandBufferImpl::ShareGroup::ShareGroup() { | 79 WebGraphicsContext3DCommandBufferImpl::ShareGroup::ShareGroup() { |
80 } | 80 } |
81 | 81 |
82 WebGraphicsContext3DCommandBufferImpl::ShareGroup::~ShareGroup() { | 82 WebGraphicsContext3DCommandBufferImpl::ShareGroup::~ShareGroup() { |
83 DCHECK(contexts_.empty()); | 83 DCHECK(contexts_.empty()); |
84 } | 84 } |
85 | 85 |
86 WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl( | 86 WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl( |
87 int surface_id, | 87 int surface_id, |
88 const GURL& active_url, | 88 const std::string& active_url, |
89 GpuChannelHost* host, | 89 GpuChannelHost* host, |
90 const Attributes& attributes, | 90 const Attributes& attributes, |
91 bool lose_context_when_out_of_memory, | 91 bool lose_context_when_out_of_memory, |
92 const SharedMemoryLimits& limits, | 92 const SharedMemoryLimits& limits, |
93 WebGraphicsContext3DCommandBufferImpl* share_context) | 93 WebGraphicsContext3DCommandBufferImpl* share_context) |
94 : lose_context_when_out_of_memory_(lose_context_when_out_of_memory), | 94 : lose_context_when_out_of_memory_(lose_context_when_out_of_memory), |
95 attributes_(attributes), | 95 attributes_(attributes), |
96 visible_(false), | 96 visible_(false), |
97 host_(host), | 97 host_(host), |
98 surface_id_(surface_id), | 98 surface_id_(surface_id), |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); | 332 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); |
333 return gpu::error::IsError(state.error); | 333 return gpu::error::IsError(state.error); |
334 } | 334 } |
335 | 335 |
336 // static | 336 // static |
337 WebGraphicsContext3DCommandBufferImpl* | 337 WebGraphicsContext3DCommandBufferImpl* |
338 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 338 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
339 GpuChannelHost* host, | 339 GpuChannelHost* host, |
340 const WebGraphicsContext3D::Attributes& attributes, | 340 const WebGraphicsContext3D::Attributes& attributes, |
341 bool lose_context_when_out_of_memory, | 341 bool lose_context_when_out_of_memory, |
342 const GURL& active_url, | 342 const std::string& active_url, |
343 const SharedMemoryLimits& limits, | 343 const SharedMemoryLimits& limits, |
344 WebGraphicsContext3DCommandBufferImpl* share_context) { | 344 WebGraphicsContext3DCommandBufferImpl* share_context) { |
345 if (!host) | 345 if (!host) |
346 return NULL; | 346 return NULL; |
347 | 347 |
348 if (share_context && share_context->IsCommandBufferContextLost()) | 348 if (share_context && share_context->IsCommandBufferContextLost()) |
349 return NULL; | 349 return NULL; |
350 | 350 |
351 return new WebGraphicsContext3DCommandBufferImpl( | 351 return new WebGraphicsContext3DCommandBufferImpl( |
352 0, | 352 0, |
(...skipping 15 matching lines...) Expand all Loading... |
368 { | 368 { |
369 base::AutoLock lock(g_default_share_groups_lock.Get()); | 369 base::AutoLock lock(g_default_share_groups_lock.Get()); |
370 g_default_share_groups.Get().erase(host_.get()); | 370 g_default_share_groups.Get().erase(host_.get()); |
371 } | 371 } |
372 | 372 |
373 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); | 373 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); |
374 UmaRecordContextLost(context_type_, state.error, state.context_lost_reason); | 374 UmaRecordContextLost(context_type_, state.error, state.context_lost_reason); |
375 } | 375 } |
376 | 376 |
377 } // namespace content | 377 } // namespace content |
OLD | NEW |