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

Side by Side Diff: services/ui/public/cpp/output_surface.cc

Issue 2260943002: Move default begin frame sources out to mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert SingleThreadProxy changes Created 4 years, 3 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
« no previous file with comments | « services/ui/public/cpp/output_surface.h ('k') | ui/compositor/compositor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "gpu/ipc/client/gpu_channel_host.h" 10 #include "gpu/ipc/client/gpu_channel_host.h"
11 #include "services/ui/public/cpp/context_provider.h" 11 #include "services/ui/public/cpp/context_provider.h"
12 #include "services/ui/public/cpp/gpu_service.h"
12 #include "services/ui/public/cpp/window_surface.h" 13 #include "services/ui/public/cpp/window_surface.h"
13 14
14 namespace ui { 15 namespace ui {
15 16
16 OutputSurface::OutputSurface( 17 OutputSurface::OutputSurface(
17 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, 18 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
18 std::unique_ptr<ui::WindowSurface> surface) 19 std::unique_ptr<ui::WindowSurface> surface)
19 : cc::OutputSurface( 20 : cc::OutputSurface(
20 make_scoped_refptr(new ContextProvider(std::move(gpu_channel_host))), 21 make_scoped_refptr(new ContextProvider(std::move(gpu_channel_host))),
21 nullptr, 22 nullptr,
22 nullptr), 23 nullptr),
23 surface_(std::move(surface)) { 24 surface_(std::move(surface)) {
24 capabilities_.delegated_rendering = true; 25 capabilities_.delegated_rendering = true;
25 } 26 }
26 27
27 OutputSurface::~OutputSurface() {} 28 OutputSurface::~OutputSurface() {}
28 29
29 bool OutputSurface::BindToClient(cc::OutputSurfaceClient* client) { 30 bool OutputSurface::BindToClient(cc::OutputSurfaceClient* client) {
30 surface_->BindToThread(); 31 surface_->BindToThread();
31 surface_->set_client(this); 32 surface_->set_client(this);
33
34 // TODO(enne): Get this from the WindowSurface via ServerWindowSurface.
35 begin_frame_source_.reset(new cc::DelayBasedBeginFrameSource(
36 base::MakeUnique<cc::DelayBasedTimeSource>(
37 base::ThreadTaskRunnerHandle::Get().get())));
38
39 client->SetBeginFrameSource(begin_frame_source_.get());
32 return cc::OutputSurface::BindToClient(client); 40 return cc::OutputSurface::BindToClient(client);
33 } 41 }
34 42
35 void OutputSurface::DetachFromClient() { 43 void OutputSurface::DetachFromClient() {
44 client_->SetBeginFrameSource(nullptr);
45 begin_frame_source_.reset();
36 surface_.reset(); 46 surface_.reset();
37 cc::OutputSurface::DetachFromClient(); 47 cc::OutputSurface::DetachFromClient();
38 } 48 }
39 49
40 void OutputSurface::BindFramebuffer() { 50 void OutputSurface::BindFramebuffer() {
41 // This is a delegating output surface, no framebuffer/direct drawing support. 51 // This is a delegating output surface, no framebuffer/direct drawing support.
42 NOTREACHED(); 52 NOTREACHED();
43 } 53 }
44 54
45 uint32_t OutputSurface::GetFramebufferCopyTextureFormat() { 55 uint32_t OutputSurface::GetFramebufferCopyTextureFormat() {
(...skipping 15 matching lines...) Expand all
61 ui::WindowSurface* surface, 71 ui::WindowSurface* surface,
62 mojo::Array<cc::ReturnedResource> resources) { 72 mojo::Array<cc::ReturnedResource> resources) {
63 ReclaimResources(resources.To<cc::ReturnedResourceArray>()); 73 ReclaimResources(resources.To<cc::ReturnedResourceArray>());
64 } 74 }
65 75
66 void OutputSurface::SwapBuffersComplete() { 76 void OutputSurface::SwapBuffersComplete() {
67 client_->DidSwapBuffersComplete(); 77 client_->DidSwapBuffersComplete();
68 } 78 }
69 79
70 } // namespace ui 80 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/public/cpp/output_surface.h ('k') | ui/compositor/compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698