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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 GLint samples = 0; | 257 GLint samples = 0; |
258 getIntegerv(GL_SAMPLES, &samples); | 258 getIntegerv(GL_SAMPLES, &samples); |
259 attributes_.antialias = samples > 0; | 259 attributes_.antialias = samples > 0; |
260 } | 260 } |
261 | 261 |
262 if (attributes_.shareResources) { | 262 if (attributes_.shareResources) { |
263 base::AutoLock lock(g_all_shared_contexts_lock.Get()); | 263 base::AutoLock lock(g_all_shared_contexts_lock.Get()); |
264 g_all_shared_contexts.Pointer()->insert(this); | 264 g_all_shared_contexts.Pointer()->insert(this); |
265 } | 265 } |
266 | 266 |
267 command_buffer_->SetMemoryAllocationChangedCallback(base::Bind( | |
268 &WebGraphicsContext3DCommandBufferImpl::OnMemoryAllocationChanged, | |
269 weak_ptr_factory_.GetWeakPtr())); | |
270 | |
271 visible_ = true; | 267 visible_ = true; |
272 initialized_ = true; | 268 initialized_ = true; |
273 return true; | 269 return true; |
274 } | 270 } |
275 | 271 |
276 bool WebGraphicsContext3DCommandBufferImpl::InitializeCommandBuffer( | 272 bool WebGraphicsContext3DCommandBufferImpl::InitializeCommandBuffer( |
277 bool onscreen, | 273 bool onscreen, |
278 const char* allowed_extensions) { | 274 const char* allowed_extensions) { |
279 if (!host_) | 275 if (!host_) |
280 return false; | 276 return false; |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
673 | 669 |
674 void WebGraphicsContext3DCommandBufferImpl::ensureFramebufferCHROMIUM() { | 670 void WebGraphicsContext3DCommandBufferImpl::ensureFramebufferCHROMIUM() { |
675 gl_->Flush(); | 671 gl_->Flush(); |
676 command_buffer_->EnsureBackbuffer(); | 672 command_buffer_->EnsureBackbuffer(); |
677 } | 673 } |
678 | 674 |
679 void WebGraphicsContext3DCommandBufferImpl:: | 675 void WebGraphicsContext3DCommandBufferImpl:: |
680 setMemoryAllocationChangedCallbackCHROMIUM( | 676 setMemoryAllocationChangedCallbackCHROMIUM( |
681 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* callback) { | 677 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* callback) { |
682 memory_allocation_changed_callback_ = callback; | 678 memory_allocation_changed_callback_ = callback; |
679 | |
nduca
2012/04/23 22:12:18
what if they clear clear it? You need to remove th
| |
680 command_buffer_->SetMemoryAllocationChangedCallback(base::Bind( | |
681 &WebGraphicsContext3DCommandBufferImpl::OnMemoryAllocationChanged, | |
682 weak_ptr_factory_.GetWeakPtr())); | |
683 } | 683 } |
684 | 684 |
685 | 685 |
686 void WebGraphicsContext3DCommandBufferImpl::copyTextureToParentTextureCHROMIUM( | 686 void WebGraphicsContext3DCommandBufferImpl::copyTextureToParentTextureCHROMIUM( |
687 WebGLId texture, WebGLId parentTexture) { | 687 WebGLId texture, WebGLId parentTexture) { |
688 NOTIMPLEMENTED(); | 688 NOTIMPLEMENTED(); |
689 } | 689 } |
690 | 690 |
691 void WebGraphicsContext3DCommandBufferImpl:: | 691 void WebGraphicsContext3DCommandBufferImpl:: |
692 rateLimitOffscreenContextCHROMIUM() { | 692 rateLimitOffscreenContextCHROMIUM() { |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1510 } | 1510 } |
1511 | 1511 |
1512 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( | 1512 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( |
1513 const std::string& message, int id) { | 1513 const std::string& message, int id) { |
1514 if (error_message_callback_) { | 1514 if (error_message_callback_) { |
1515 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); | 1515 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); |
1516 error_message_callback_->onErrorMessage(str, id); | 1516 error_message_callback_->onErrorMessage(str, id); |
1517 } | 1517 } |
1518 } | 1518 } |
1519 | 1519 |
OLD | NEW |