Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "services/ui/public/cpp/output_surface.h" | 5 #include "services/ui/public/cpp/output_surface.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/output/output_surface_client.h" | 9 #include "cc/output/output_surface_client.h" |
| 10 #include "services/ui/public/cpp/context_provider.h" | 10 #include "services/ui/public/cpp/context_provider.h" |
| 11 #include "services/ui/public/cpp/gpu_service.h" | |
| 11 #include "services/ui/public/cpp/window_surface.h" | 12 #include "services/ui/public/cpp/window_surface.h" |
| 12 | 13 |
| 13 namespace ui { | 14 namespace ui { |
| 14 | 15 |
| 15 OutputSurface::OutputSurface(GpuService* gpu_service, | 16 OutputSurface::OutputSurface(GpuService* gpu_service, |
| 16 std::unique_ptr<ui::WindowSurface> surface) | 17 std::unique_ptr<ui::WindowSurface> surface) |
| 17 : cc::OutputSurface(make_scoped_refptr(new ContextProvider(gpu_service)), | 18 : cc::OutputSurface(make_scoped_refptr(new ContextProvider(gpu_service)), |
| 18 nullptr, | 19 nullptr, |
| 19 nullptr), | 20 nullptr), |
| 20 surface_(std::move(surface)) { | 21 surface_(std::move(surface)) { |
| 21 capabilities_.delegated_rendering = true; | 22 capabilities_.delegated_rendering = true; |
| 23 | |
| 24 // TODO(enne): Get this from the WindowSurface via ServerWindowSurface. | |
| 25 begin_frame_source_.reset(new cc::DelayBasedBeginFrameSource( | |
| 26 base::MakeUnique<cc::DelayBasedTimeSource>( | |
| 27 gpu_service->main_task_runner().get()))); | |
|
Fady Samuel
2016/08/22 15:16:52
We shouldn't be giving it the main task runner rig
| |
| 22 } | 28 } |
| 23 | 29 |
| 24 OutputSurface::~OutputSurface() {} | 30 OutputSurface::~OutputSurface() {} |
| 25 | 31 |
| 26 bool OutputSurface::BindToClient(cc::OutputSurfaceClient* client) { | 32 bool OutputSurface::BindToClient(cc::OutputSurfaceClient* client) { |
| 27 surface_->BindToThread(); | 33 surface_->BindToThread(); |
| 28 surface_->set_client(this); | 34 surface_->set_client(this); |
| 35 client->SetBeginFrameSource(begin_frame_source_.get()); | |
|
sadrul
2016/08/22 14:46:40
Should |begin_frame_source_| be created here? (con
Fady Samuel
2016/08/22 15:16:52
+1
| |
| 29 return cc::OutputSurface::BindToClient(client); | 36 return cc::OutputSurface::BindToClient(client); |
| 30 } | 37 } |
| 31 | 38 |
| 32 void OutputSurface::DetachFromClient() { | 39 void OutputSurface::DetachFromClient() { |
| 40 client_->SetBeginFrameSource(nullptr); | |
| 33 surface_.reset(); | 41 surface_.reset(); |
| 34 cc::OutputSurface::DetachFromClient(); | 42 cc::OutputSurface::DetachFromClient(); |
| 35 } | 43 } |
| 36 | 44 |
| 37 void OutputSurface::BindFramebuffer() { | 45 void OutputSurface::BindFramebuffer() { |
| 38 // This is a delegating output surface, no framebuffer/direct drawing support. | 46 // This is a delegating output surface, no framebuffer/direct drawing support. |
| 39 NOTREACHED(); | 47 NOTREACHED(); |
| 40 } | 48 } |
| 41 | 49 |
| 42 uint32_t OutputSurface::GetFramebufferCopyTextureFormat() { | 50 uint32_t OutputSurface::GetFramebufferCopyTextureFormat() { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 58 ui::WindowSurface* surface, | 66 ui::WindowSurface* surface, |
| 59 mojo::Array<cc::ReturnedResource> resources) { | 67 mojo::Array<cc::ReturnedResource> resources) { |
| 60 ReclaimResources(resources.To<cc::ReturnedResourceArray>()); | 68 ReclaimResources(resources.To<cc::ReturnedResourceArray>()); |
| 61 } | 69 } |
| 62 | 70 |
| 63 void OutputSurface::SwapBuffersComplete() { | 71 void OutputSurface::SwapBuffersComplete() { |
| 64 client_->DidSwapBuffersComplete(); | 72 client_->DidSwapBuffersComplete(); |
| 65 } | 73 } |
| 66 | 74 |
| 67 } // namespace ui | 75 } // namespace ui |
| OLD | NEW |