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

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

Issue 12614013: Plumb cc::LatencyInfo through command buffer and output surface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 BrowserCompositorOutputSurface( 302 BrowserCompositorOutputSurface(
303 WebGraphicsContext3DCommandBufferImpl* context, 303 WebGraphicsContext3DCommandBufferImpl* context,
304 int surface_id, 304 int surface_id,
305 BrowserCompositorOutputSurfaceProxy* output_surface_proxy, 305 BrowserCompositorOutputSurfaceProxy* output_surface_proxy,
306 base::MessageLoopProxy* compositor_message_loop, 306 base::MessageLoopProxy* compositor_message_loop,
307 base::WeakPtr<ui::Compositor> compositor) 307 base::WeakPtr<ui::Compositor> compositor)
308 : OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D>(context)), 308 : OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D>(context)),
309 surface_id_(surface_id), 309 surface_id_(surface_id),
310 output_surface_proxy_(output_surface_proxy), 310 output_surface_proxy_(output_surface_proxy),
311 compositor_message_loop_(compositor_message_loop), 311 compositor_message_loop_(compositor_message_loop),
312 compositor_(compositor) { 312 compositor_(compositor),
313 context_(context) {
313 CommandLine* command_line = CommandLine::ForCurrentProcess(); 314 CommandLine* command_line = CommandLine::ForCurrentProcess();
314 if (command_line->HasSwitch(switches::kUIMaxFramesPending)) { 315 if (command_line->HasSwitch(switches::kUIMaxFramesPending)) {
315 std::string string_value = command_line->GetSwitchValueASCII( 316 std::string string_value = command_line->GetSwitchValueASCII(
316 switches::kUIMaxFramesPending); 317 switches::kUIMaxFramesPending);
317 int int_value; 318 int int_value;
318 if (base::StringToInt(string_value, &int_value)) 319 if (base::StringToInt(string_value, &int_value))
319 capabilities_.max_frames_pending = int_value; 320 capabilities_.max_frames_pending = int_value;
320 else 321 else
321 LOG(ERROR) << "Trouble parsing --" << switches::kUIMaxFramesPending; 322 LOG(ERROR) << "Trouble parsing --" << switches::kUIMaxFramesPending;
322 } 323 }
323 DetachFromThread(); 324 DetachFromThread();
324 } 325 }
325 326
326 virtual ~BrowserCompositorOutputSurface() { 327 virtual ~BrowserCompositorOutputSurface() {
327 DCHECK(CalledOnValidThread()); 328 DCHECK(CalledOnValidThread());
328 if (!client_) 329 if (!client_)
329 return; 330 return;
330 output_surface_proxy_->RemoveSurface(surface_id_); 331 output_surface_proxy_->RemoveSurface(surface_id_);
331 } 332 }
332 333
333 virtual bool BindToClient( 334 virtual bool BindToClient(
334 cc::OutputSurfaceClient* client) OVERRIDE { 335 cc::OutputSurfaceClient* client) OVERRIDE {
335 DCHECK(CalledOnValidThread()); 336 DCHECK(CalledOnValidThread());
336 337
337 if (!OutputSurface::BindToClient(client)) 338 if (!OutputSurface::BindToClient(client))
338 return false; 339 return false;
339 340
340 output_surface_proxy_->AddSurface(this, surface_id_); 341 output_surface_proxy_->AddSurface(this, surface_id_);
342 context_->GetCommandBufferProxy()->SetLatencyInfoCallback(
343 base::Bind(&BrowserCompositorOutputSurface::OnReceivedLatencyInfo,
344 base::Unretained(this)));
341 return true; 345 return true;
342 } 346 }
343 347
348 virtual void SetLatencyInfo(
349 const cc::LatencyInfo& latency_info) OVERRIDE {
350 context_->GetCommandBufferProxy()->SetLatencyInfo(latency_info);
351 }
352
344 void OnUpdateVSyncParameters( 353 void OnUpdateVSyncParameters(
345 base::TimeTicks timebase, base::TimeDelta interval) { 354 base::TimeTicks timebase, base::TimeDelta interval) {
346 DCHECK(CalledOnValidThread()); 355 DCHECK(CalledOnValidThread());
347 DCHECK(client_); 356 DCHECK(client_);
348 client_->OnVSyncParametersChanged(timebase, interval); 357 client_->OnVSyncParametersChanged(timebase, interval);
349 compositor_message_loop_->PostTask( 358 compositor_message_loop_->PostTask(
350 FROM_HERE, 359 FROM_HERE,
351 base::Bind(&ui::Compositor::OnUpdateVSyncParameters, 360 base::Bind(&ui::Compositor::OnUpdateVSyncParameters,
352 compositor_, timebase, interval)); 361 compositor_, timebase, interval));
353 } 362 }
354 363
355 private: 364 private:
365
366 void OnReceivedLatencyInfo(const cc::LatencyInfo& latency_info) {
367 client_->OnReceivedLatencyInfo(latency_info);
368 }
369
356 int surface_id_; 370 int surface_id_;
357 scoped_refptr<BrowserCompositorOutputSurfaceProxy> output_surface_proxy_; 371 scoped_refptr<BrowserCompositorOutputSurfaceProxy> output_surface_proxy_;
358 372
359 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_; 373 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_;
360 base::WeakPtr<ui::Compositor> compositor_; 374 base::WeakPtr<ui::Compositor> compositor_;
375 WebGraphicsContext3DCommandBufferImpl* context_;
361 }; 376 };
362 377
363 void BrowserCompositorOutputSurfaceProxy::OnUpdateVSyncParameters( 378 void BrowserCompositorOutputSurfaceProxy::OnUpdateVSyncParameters(
364 int surface_id, base::TimeTicks timebase, base::TimeDelta interval) { 379 int surface_id, base::TimeTicks timebase, base::TimeDelta interval) {
365 BrowserCompositorOutputSurface* surface = surface_map_.Lookup(surface_id); 380 BrowserCompositorOutputSurface* surface = surface_map_.Lookup(surface_id);
366 if (surface) 381 if (surface)
367 surface->OnUpdateVSyncParameters(timebase, interval); 382 surface->OnUpdateVSyncParameters(timebase, interval);
368 } 383 }
369 384
370 class GpuProcessTransportFactory 385 class GpuProcessTransportFactory
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 delete g_factory; 794 delete g_factory;
780 g_factory = NULL; 795 g_factory = NULL;
781 } 796 }
782 797
783 // static 798 // static
784 ImageTransportFactory* ImageTransportFactory::GetInstance() { 799 ImageTransportFactory* ImageTransportFactory::GetInstance() {
785 return g_factory; 800 return g_factory;
786 } 801 }
787 802
788 } // namespace content 803 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698