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

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

Issue 11293121: Add latency measurement system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor input event changes Created 8 years 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 context_lost_callback_(0), 132 context_lost_callback_(0),
133 context_lost_reason_(GL_NO_ERROR), 133 context_lost_reason_(GL_NO_ERROR),
134 error_message_callback_(0), 134 error_message_callback_(0),
135 swapbuffers_complete_callback_(0), 135 swapbuffers_complete_callback_(0),
136 latency_info_callback_(0),
136 gpu_preference_(gfx::PreferIntegratedGpu), 137 gpu_preference_(gfx::PreferIntegratedGpu),
137 cached_width_(0), 138 cached_width_(0),
138 cached_height_(0), 139 cached_height_(0),
139 bound_fbo_(0), 140 bound_fbo_(0),
140 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 141 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
141 initialized_(false), 142 initialized_(false),
142 parent_(NULL), 143 parent_(NULL),
143 parent_texture_id_(0), 144 parent_texture_id_(0),
144 command_buffer_(NULL), 145 command_buffer_(NULL),
145 gles2_helper_(NULL), 146 gles2_helper_(NULL),
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 gl_->EnableFeatureCHROMIUM("webgl_enable_glsl_webgl_validation"); 229 gl_->EnableFeatureCHROMIUM("webgl_enable_glsl_webgl_validation");
229 230
230 command_buffer_->SetChannelErrorCallback( 231 command_buffer_->SetChannelErrorCallback(
231 base::Bind(&WebGraphicsContext3DCommandBufferImpl::OnContextLost, 232 base::Bind(&WebGraphicsContext3DCommandBufferImpl::OnContextLost,
232 weak_ptr_factory_.GetWeakPtr())); 233 weak_ptr_factory_.GetWeakPtr()));
233 234
234 command_buffer_->SetOnConsoleMessageCallback( 235 command_buffer_->SetOnConsoleMessageCallback(
235 base::Bind(&WebGraphicsContext3DCommandBufferImpl::OnErrorMessage, 236 base::Bind(&WebGraphicsContext3DCommandBufferImpl::OnErrorMessage,
236 weak_ptr_factory_.GetWeakPtr())); 237 weak_ptr_factory_.GetWeakPtr()));
237 238
239 command_buffer_->SetLatencyInfoCallback(
240 base::Bind(&WebGraphicsContext3DCommandBufferImpl::OnSetLatencyInfo,
241 weak_ptr_factory_.GetWeakPtr()));
242
238 client_error_message_callback_.reset( 243 client_error_message_callback_.reset(
239 new WebGraphicsContext3DErrorMessageCallback(this)); 244 new WebGraphicsContext3DErrorMessageCallback(this));
240 gl_->SetErrorMessageCallback(client_error_message_callback_.get()); 245 gl_->SetErrorMessageCallback(client_error_message_callback_.get());
241 246
242 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 247 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
243 free_command_buffer_when_invisible_ = 248 free_command_buffer_when_invisible_ =
244 command_line.HasSwitch(switches::kEnablePruneGpuCommandBuffers); 249 command_line.HasSwitch(switches::kEnablePruneGpuCommandBuffers);
245 250
246 // Set attributes_ from created offscreen context. 251 // Set attributes_ from created offscreen context.
247 { 252 {
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 // Same flow control as WebGraphicsContext3DCommandBufferImpl::prepareTexture 549 // Same flow control as WebGraphicsContext3DCommandBufferImpl::prepareTexture
545 // (see above). 550 // (see above).
546 if (ShouldUseSwapClient()) 551 if (ShouldUseSwapClient())
547 swap_client_->OnViewContextSwapBuffersPosted(); 552 swap_client_->OnViewContextSwapBuffersPosted();
548 gl_->PostSubBufferCHROMIUM(x, y, width, height); 553 gl_->PostSubBufferCHROMIUM(x, y, width, height);
549 command_buffer_->Echo(base::Bind( 554 command_buffer_->Echo(base::Bind(
550 &WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete, 555 &WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete,
551 weak_ptr_factory_.GetWeakPtr())); 556 weak_ptr_factory_.GetWeakPtr()));
552 } 557 }
553 558
559 void WebGraphicsContext3DCommandBufferImpl::setLatencyInfoCHROMIUM(
560 const WebKit::WebLatencyInfo& latency_info) {
561 command_buffer_->SetLatencyInfo(
562 static_cast<const WebKit::WebLatencyInfoImpl&>(latency_info));
563 }
564
565 void WebGraphicsContext3DCommandBufferImpl::setLatencyInfoCallbackCHROMIUM(
566 WebGraphicsContext3D::WebGraphicsLatencyInfoCallbackCHROMIUM* cb) {
567 latency_info_callback_ = cb;
568 }
569
570 void WebGraphicsContext3DCommandBufferImpl::OnSetLatencyInfo(
571 const WebKit::WebLatencyInfoImpl& latency_info) {
572 if (latency_info_callback_)
573 latency_info_callback_->onReceivedLatencyInfo(
574 static_cast<const WebKit::WebLatencyInfo&>(latency_info));
575 }
576
554 void WebGraphicsContext3DCommandBufferImpl::reshape(int width, int height) { 577 void WebGraphicsContext3DCommandBufferImpl::reshape(int width, int height) {
555 cached_width_ = width; 578 cached_width_ = width;
556 cached_height_ = height; 579 cached_height_ = height;
557 580
558 gl_->ResizeCHROMIUM(width, height); 581 gl_->ResizeCHROMIUM(width, height);
559 } 582 }
560 583
561 #ifdef FLIP_FRAMEBUFFER_VERTICALLY 584 #ifdef FLIP_FRAMEBUFFER_VERTICALLY
562 void WebGraphicsContext3DCommandBufferImpl::FlipVertically( 585 void WebGraphicsContext3DCommandBufferImpl::FlipVertically(
563 uint8* framebuffer, 586 uint8* framebuffer,
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 1737
1715 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( 1738 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage(
1716 const std::string& message, int id) { 1739 const std::string& message, int id) {
1717 if (error_message_callback_) { 1740 if (error_message_callback_) {
1718 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); 1741 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str());
1719 error_message_callback_->onErrorMessage(str, id); 1742 error_message_callback_->onErrorMessage(str, id);
1720 } 1743 }
1721 } 1744 }
1722 1745
1723 } // namespace content 1746 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698