Chromium Code Reviews| 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/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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 346 base::TimeTicks timebase, base::TimeDelta interval) { | 346 base::TimeTicks timebase, base::TimeDelta interval) { |
| 347 DCHECK(CalledOnValidThread()); | 347 DCHECK(CalledOnValidThread()); |
| 348 DCHECK(client_); | 348 DCHECK(client_); |
| 349 client_->OnVSyncParametersChanged(timebase, interval); | 349 client_->OnVSyncParametersChanged(timebase, interval); |
| 350 compositor_message_loop_->PostTask( | 350 compositor_message_loop_->PostTask( |
| 351 FROM_HERE, | 351 FROM_HERE, |
| 352 base::Bind(&ui::Compositor::OnUpdateVSyncParameters, | 352 base::Bind(&ui::Compositor::OnUpdateVSyncParameters, |
| 353 compositor_, timebase, interval)); | 353 compositor_, timebase, interval)); |
| 354 } | 354 } |
| 355 | 355 |
| 356 virtual void SwapBuffers(const ui::LatencyInfo& latency_info) OVERRIDE { | |
| 357 WebGraphicsContext3DCommandBufferImpl* command_buffer = | |
| 358 static_cast<WebGraphicsContext3DCommandBufferImpl*>(context3d()); | |
| 359 CommandBufferProxyImpl* command_buffer_proxy = | |
| 360 command_buffer->GetCommandBufferProxy(); | |
| 361 DCHECK(command_buffer_proxy); | |
| 362 context3d()->shallowFlushCHROMIUM(); | |
| 363 command_buffer_proxy->SetLatencyInfo(latency_info); | |
| 364 OutputSurface::SwapBuffers(latency_info); | |
| 365 } | |
|
piman
2013/05/31 04:13:44
Since this is all the same as CompositorOutputSurf
jbauman
2013/05/31 21:51:36
Yeah, the WebGraphicsContext3D has no notion of th
| |
| 366 | |
| 367 virtual void PostSubBuffer(gfx::Rect rect, | |
| 368 const ui::LatencyInfo& latency_info) OVERRIDE { | |
| 369 WebGraphicsContext3DCommandBufferImpl* command_buffer = | |
| 370 static_cast<WebGraphicsContext3DCommandBufferImpl*>(context3d()); | |
| 371 CommandBufferProxyImpl* command_buffer_proxy = | |
| 372 command_buffer->GetCommandBufferProxy(); | |
| 373 DCHECK(command_buffer_proxy); | |
| 374 context3d()->shallowFlushCHROMIUM(); | |
| 375 command_buffer_proxy->SetLatencyInfo(latency_info); | |
| 376 OutputSurface::PostSubBuffer(rect, latency_info); | |
| 377 } | |
| 378 | |
| 356 private: | 379 private: |
| 357 int surface_id_; | 380 int surface_id_; |
| 358 scoped_refptr<BrowserCompositorOutputSurfaceProxy> output_surface_proxy_; | 381 scoped_refptr<BrowserCompositorOutputSurfaceProxy> output_surface_proxy_; |
| 359 | 382 |
| 360 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_; | 383 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_; |
| 361 base::WeakPtr<ui::Compositor> compositor_; | 384 base::WeakPtr<ui::Compositor> compositor_; |
| 362 }; | 385 }; |
| 363 | 386 |
| 364 void BrowserCompositorOutputSurfaceProxy::OnUpdateVSyncParameters( | 387 void BrowserCompositorOutputSurfaceProxy::OnUpdateVSyncParameters( |
| 365 int surface_id, base::TimeTicks timebase, base::TimeDelta interval) { | 388 int surface_id, base::TimeTicks timebase, base::TimeDelta interval) { |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 761 delete g_factory; | 784 delete g_factory; |
| 762 g_factory = NULL; | 785 g_factory = NULL; |
| 763 } | 786 } |
| 764 | 787 |
| 765 // static | 788 // static |
| 766 ImageTransportFactory* ImageTransportFactory::GetInstance() { | 789 ImageTransportFactory* ImageTransportFactory::GetInstance() { |
| 767 return g_factory; | 790 return g_factory; |
| 768 } | 791 } |
| 769 | 792 |
| 770 } // namespace content | 793 } // namespace content |
| OLD | NEW |