Chromium Code Reviews| Index: content/browser/aura/browser_compositor_output_surface.cc |
| diff --git a/content/browser/aura/browser_compositor_output_surface.cc b/content/browser/aura/browser_compositor_output_surface.cc |
| index 7a60b86dd13dc149e37904ae1c7da999774f3b22..945ffe44350de7e4155a826243e297b4b9f76263 100644 |
| --- a/content/browser/aura/browser_compositor_output_surface.cc |
| +++ b/content/browser/aura/browser_compositor_output_surface.cc |
| @@ -9,10 +9,8 @@ |
| #include "base/location.h" |
| #include "base/message_loop/message_loop_proxy.h" |
| #include "base/strings/string_number_conversions.h" |
| -#include "cc/output/compositor_frame.h" |
| #include "content/browser/aura/reflector_impl.h" |
| #include "content/common/gpu/client/context_provider_command_buffer.h" |
| -#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| #include "ui/compositor/compositor.h" |
| #include "ui/compositor/compositor_switches.h" |
| @@ -29,6 +27,32 @@ BrowserCompositorOutputSurface::BrowserCompositorOutputSurface( |
| output_surface_map_(output_surface_map), |
| compositor_message_loop_(compositor_message_loop), |
| compositor_(compositor) { |
| + Initialize(); |
| + DetachFromThread(); |
| +} |
| + |
| +BrowserCompositorOutputSurface::BrowserCompositorOutputSurface( |
| + scoped_ptr<cc::SoftwareOutputDevice> software_device, |
| + int surface_id, |
| + IDMap<BrowserCompositorOutputSurface>* output_surface_map, |
| + base::MessageLoopProxy* compositor_message_loop, |
| + base::WeakPtr<ui::Compositor> compositor) |
| + : OutputSurface(software_device.Pass()), |
| + surface_id_(surface_id), |
| + output_surface_map_(output_surface_map), |
| + compositor_message_loop_(compositor_message_loop), |
| + compositor_(compositor) { |
| + Initialize(); |
|
piman
2013/11/07 20:37:16
nit: DetachFromThread here too - if/when software
dnicoara
2013/11/07 21:03:16
Done.
|
| +} |
| + |
| +BrowserCompositorOutputSurface::~BrowserCompositorOutputSurface() { |
| + DCHECK(CalledOnValidThread()); |
| + if (!HasClient()) |
| + return; |
| + output_surface_map_->Remove(surface_id_); |
| +} |
| + |
| +void BrowserCompositorOutputSurface::Initialize() { |
| CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| if (command_line->HasSwitch(switches::kUIMaxFramesPending)) { |
| std::string string_value = command_line->GetSwitchValueASCII( |
| @@ -40,14 +64,6 @@ BrowserCompositorOutputSurface::BrowserCompositorOutputSurface( |
| LOG(ERROR) << "Trouble parsing --" << switches::kUIMaxFramesPending; |
| } |
| capabilities_.adjust_deadline_for_parent = false; |
| - DetachFromThread(); |
| -} |
| - |
| -BrowserCompositorOutputSurface::~BrowserCompositorOutputSurface() { |
| - DCHECK(CalledOnValidThread()); |
| - if (!HasClient()) |
| - return; |
| - output_surface_map_->Remove(surface_id_); |
| } |
| bool BrowserCompositorOutputSurface::BindToClient( |
| @@ -70,29 +86,6 @@ void BrowserCompositorOutputSurface::Reshape(gfx::Size size, |
| reflector_->OnReshape(size); |
| } |
| -void BrowserCompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { |
| - DCHECK(frame->gl_frame_data); |
| - |
| - WebGraphicsContext3DCommandBufferImpl* command_buffer_context = |
| - static_cast<WebGraphicsContext3DCommandBufferImpl*>( |
| - context_provider_->Context3d()); |
| - CommandBufferProxyImpl* command_buffer_proxy = |
| - command_buffer_context->GetCommandBufferProxy(); |
| - DCHECK(command_buffer_proxy); |
| - context_provider_->Context3d()->shallowFlushCHROMIUM(); |
| - command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info); |
| - |
| - if (reflector_.get()) { |
| - if (frame->gl_frame_data->sub_buffer_rect == |
| - gfx::Rect(frame->gl_frame_data->size)) |
| - reflector_->OnSwapBuffers(); |
| - else |
| - reflector_->OnPostSubBuffer(frame->gl_frame_data->sub_buffer_rect); |
| - } |
| - |
| - OutputSurface::SwapBuffers(frame); |
| -} |
| - |
| void BrowserCompositorOutputSurface::OnUpdateVSyncParameters( |
| base::TimeTicks timebase, |
| base::TimeDelta interval) { |