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

Side by Side Diff: content/browser/renderer_host/image_transport_factory.cc

Issue 11293121: Add latency measurement system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: create cc::LatencyInfo Created 7 years, 11 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/browser/renderer_host/image_transport_factory.h" 5 #include "content/browser/renderer_host/image_transport_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 DCHECK(CalledOnValidThread()); 314 DCHECK(CalledOnValidThread());
315 DCHECK(client); 315 DCHECK(client);
316 DCHECK(!client_); 316 DCHECK(!client_);
317 if (context3D_.get()) { 317 if (context3D_.get()) {
318 if (!context3D_->makeContextCurrent()) 318 if (!context3D_->makeContextCurrent())
319 return false; 319 return false;
320 } 320 }
321 321
322 client_ = client; 322 client_ = client;
323 output_surface_proxy_->AddSurface(this, surface_id_); 323 output_surface_proxy_->AddSurface(this, surface_id_);
324 context3D_->GetCommandBufferProxy()->SetLatencyInfoCallback(
325 base::Bind(&BrowserCompositorOutputSurface::OnReceivedLatencyInfo,
326 base::Unretained(this)));
324 return true; 327 return true;
325 } 328 }
326 329
327 virtual const struct Capabilities& Capabilities() const OVERRIDE { 330 virtual const struct Capabilities& Capabilities() const OVERRIDE {
328 DCHECK(CalledOnValidThread()); 331 DCHECK(CalledOnValidThread());
329 return capabilities_; 332 return capabilities_;
330 } 333 }
331 334
332 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE { 335 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE {
333 DCHECK(CalledOnValidThread()); 336 DCHECK(CalledOnValidThread());
334 return context3D_.get(); 337 return context3D_.get();
335 } 338 }
336 339
337 virtual cc::SoftwareOutputDevice* SoftwareDevice() const OVERRIDE { 340 virtual cc::SoftwareOutputDevice* SoftwareDevice() const OVERRIDE {
338 DCHECK(CalledOnValidThread()); 341 DCHECK(CalledOnValidThread());
339 return NULL; 342 return NULL;
340 } 343 }
341 344
342 virtual void SendFrameToParentCompositor( 345 virtual void SendFrameToParentCompositor(
343 const cc::CompositorFrame&) OVERRIDE { 346 const cc::CompositorFrame&) OVERRIDE {
344 } 347 }
345 348
349 virtual void SetLatencyInfo(
350 const cc::LatencyInfo& latency_info) OVERRIDE {
351 context3D_->GetCommandBufferProxy()->SetLatencyInfo(latency_info);
352 }
353
346 void OnUpdateVSyncParameters( 354 void OnUpdateVSyncParameters(
347 base::TimeTicks timebase, base::TimeDelta interval) { 355 base::TimeTicks timebase, base::TimeDelta interval) {
348 DCHECK(CalledOnValidThread()); 356 DCHECK(CalledOnValidThread());
349 DCHECK(client_); 357 DCHECK(client_);
350 client_->OnVSyncParametersChanged(timebase, interval); 358 client_->OnVSyncParametersChanged(timebase, interval);
351 } 359 }
352 360
353 private: 361 private:
362
363 void OnReceivedLatencyInfo(const cc::LatencyInfo& latency_info) {
364 client_->OnReceivedLatencyInfo(latency_info);
365 }
366
354 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3D_; 367 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3D_;
355 int surface_id_; 368 int surface_id_;
356 struct Capabilities capabilities_; 369 struct Capabilities capabilities_;
357 cc::OutputSurfaceClient* client_; 370 cc::OutputSurfaceClient* client_;
358 scoped_refptr<BrowserCompositorOutputSurfaceProxy> output_surface_proxy_; 371 scoped_refptr<BrowserCompositorOutputSurfaceProxy> output_surface_proxy_;
359 }; 372 };
360 373
361 void BrowserCompositorOutputSurfaceProxy::OnUpdateVSyncParameters( 374 void BrowserCompositorOutputSurfaceProxy::OnUpdateVSyncParameters(
362 int surface_id, base::TimeTicks timebase, base::TimeDelta interval) { 375 int surface_id, base::TimeTicks timebase, base::TimeDelta interval) {
363 BrowserCompositorOutputSurface* surface = surface_map_.Lookup(surface_id); 376 BrowserCompositorOutputSurface* surface = surface_map_.Lookup(surface_id);
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 delete g_factory; 649 delete g_factory;
637 g_factory = NULL; 650 g_factory = NULL;
638 } 651 }
639 652
640 // static 653 // static
641 ImageTransportFactory* ImageTransportFactory::GetInstance() { 654 ImageTransportFactory* ImageTransportFactory::GetInstance() {
642 return g_factory; 655 return g_factory;
643 } 656 }
644 657
645 } // namespace content 658 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/compositor_impl_android.cc ('k') | content/browser/renderer_host/render_widget_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698