Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc

Issue 11195011: Send vsync timebase updates to the browser compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Send vsync timebase updates to the browser compositor Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 const base::WeakPtr<WebGraphicsContext3DSwapBuffersClient>& swap_client) 123 const base::WeakPtr<WebGraphicsContext3DSwapBuffersClient>& swap_client)
124 : initialize_failed_(false), 124 : initialize_failed_(false),
125 factory_(factory), 125 factory_(factory),
126 visible_(false), 126 visible_(false),
127 free_command_buffer_when_invisible_(false), 127 free_command_buffer_when_invisible_(false),
128 host_(NULL), 128 host_(NULL),
129 surface_id_(surface_id), 129 surface_id_(surface_id),
130 active_url_(active_url), 130 active_url_(active_url),
131 swap_client_(swap_client), 131 swap_client_(swap_client),
132 memory_allocation_changed_callback_(0), 132 memory_allocation_changed_callback_(0),
133 update_vsync_time_callback_(0),
133 context_lost_callback_(0), 134 context_lost_callback_(0),
134 context_lost_reason_(GL_NO_ERROR), 135 context_lost_reason_(GL_NO_ERROR),
135 error_message_callback_(0), 136 error_message_callback_(0),
136 swapbuffers_complete_callback_(0), 137 swapbuffers_complete_callback_(0),
137 gpu_preference_(gfx::PreferIntegratedGpu), 138 gpu_preference_(gfx::PreferIntegratedGpu),
138 cached_width_(0), 139 cached_width_(0),
139 cached_height_(0), 140 cached_height_(0),
140 bound_fbo_(0), 141 bound_fbo_(0),
141 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 142 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
142 initialized_(false), 143 initialized_(false),
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 698
698 if (callback) 699 if (callback)
699 command_buffer_->SetMemoryAllocationChangedCallback(base::Bind( 700 command_buffer_->SetMemoryAllocationChangedCallback(base::Bind(
700 &WebGraphicsContext3DCommandBufferImpl::OnMemoryAllocationChanged, 701 &WebGraphicsContext3DCommandBufferImpl::OnMemoryAllocationChanged,
701 weak_ptr_factory_.GetWeakPtr())); 702 weak_ptr_factory_.GetWeakPtr()));
702 else 703 else
703 command_buffer_->SetMemoryAllocationChangedCallback( 704 command_buffer_->SetMemoryAllocationChangedCallback(
704 base::Callback<void(const GpuMemoryAllocationForRenderer&)>()); 705 base::Callback<void(const GpuMemoryAllocationForRenderer&)>());
705 } 706 }
706 707
708 void WebGraphicsContext3DCommandBufferImpl::
709 setUpdateVSyncTimeCallbackCHROMIUM(
710 WebGraphicsUpdateVSyncTimeCallbackCHROMIUM* callback) {
711 update_vsync_time_callback_ = callback;
712
713 if (!command_buffer_)
714 return;
715
716 if (callback)
717 command_buffer_->SetUpdateVSyncTimeCallback(base::Bind(
718 &WebGraphicsContext3DCommandBufferImpl::OnUpdateVSyncTime,
719 weak_ptr_factory_.GetWeakPtr()));
720 else
721 command_buffer_->SetUpdateVSyncTimeCallback(
722 base::Callback<void(int64)>());
723 }
707 724
708 void WebGraphicsContext3DCommandBufferImpl::copyTextureToParentTextureCHROMIUM( 725 void WebGraphicsContext3DCommandBufferImpl::copyTextureToParentTextureCHROMIUM(
709 WebGLId texture, WebGLId parentTexture) { 726 WebGLId texture, WebGLId parentTexture) {
710 NOTIMPLEMENTED(); 727 NOTIMPLEMENTED();
711 } 728 }
712 729
713 void WebGraphicsContext3DCommandBufferImpl:: 730 void WebGraphicsContext3DCommandBufferImpl::
714 rateLimitOffscreenContextCHROMIUM() { 731 rateLimitOffscreenContextCHROMIUM() {
715 gl_->RateLimitOffscreenContextCHROMIUM(); 732 gl_->RateLimitOffscreenContextCHROMIUM();
716 } 733 }
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 1423
1407 void WebGraphicsContext3DCommandBufferImpl::OnMemoryAllocationChanged( 1424 void WebGraphicsContext3DCommandBufferImpl::OnMemoryAllocationChanged(
1408 const GpuMemoryAllocationForRenderer& allocation) { 1425 const GpuMemoryAllocationForRenderer& allocation) {
1409 if (memory_allocation_changed_callback_) 1426 if (memory_allocation_changed_callback_)
1410 memory_allocation_changed_callback_->onMemoryAllocationChanged( 1427 memory_allocation_changed_callback_->onMemoryAllocationChanged(
1411 WebKit::WebGraphicsMemoryAllocation( 1428 WebKit::WebGraphicsMemoryAllocation(
1412 allocation.gpu_resource_size_in_bytes, 1429 allocation.gpu_resource_size_in_bytes,
1413 allocation.suggest_have_backbuffer)); 1430 allocation.suggest_have_backbuffer));
1414 } 1431 }
1415 1432
1433 void WebGraphicsContext3DCommandBufferImpl::OnUpdateVSyncTime(int64 time) {
1434 if (update_vsync_time_callback_)
1435 update_vsync_time_callback_->onUpdateVSyncTime(time);
1436 }
1437
1438
1416 void WebGraphicsContext3DCommandBufferImpl::setErrorMessageCallback( 1439 void WebGraphicsContext3DCommandBufferImpl::setErrorMessageCallback(
1417 WebGraphicsContext3D::WebGraphicsErrorMessageCallback* cb) { 1440 WebGraphicsContext3D::WebGraphicsErrorMessageCallback* cb) {
1418 error_message_callback_ = cb; 1441 error_message_callback_ = cb;
1419 } 1442 }
1420 1443
1421 void WebGraphicsContext3DCommandBufferImpl::setContextLostCallback( 1444 void WebGraphicsContext3DCommandBufferImpl::setContextLostCallback(
1422 WebGraphicsContext3D::WebGraphicsContextLostCallback* cb) { 1445 WebGraphicsContext3D::WebGraphicsContextLostCallback* cb) {
1423 context_lost_callback_ = cb; 1446 context_lost_callback_ = cb;
1424 } 1447 }
1425 1448
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 swap_client_->OnViewContextSwapBuffersAborted(); 1611 swap_client_->OnViewContextSwapBuffersAborted();
1589 } 1612 }
1590 1613
1591 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( 1614 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage(
1592 const std::string& message, int id) { 1615 const std::string& message, int id) {
1593 if (error_message_callback_) { 1616 if (error_message_callback_) {
1594 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); 1617 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str());
1595 error_message_callback_->onErrorMessage(str, id); 1618 error_message_callback_->onErrorMessage(str, id);
1596 } 1619 }
1597 } 1620 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698