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

Side by Side Diff: ui/aura/mus/window_compositor_frame_sink.cc

Issue 2474113002: Mus+Ash: Unified BeginFrame Skeleton (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 | « ui/aura/mus/window_compositor_frame_sink.h ('k') | no next file » | 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 "ui/aura/mus/window_compositor_frame_sink.h" 5 #include "ui/aura/mus/window_compositor_frame_sink.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "cc/output/compositor_frame_sink_client.h" 8 #include "cc/output/compositor_frame_sink_client.h"
9 #include "gpu/ipc/client/gpu_channel_host.h" 9 #include "gpu/ipc/client/gpu_channel_host.h"
10 10
(...skipping 27 matching lines...) Expand all
38 if (!cc::CompositorFrameSink::BindToClient(client)) 38 if (!cc::CompositorFrameSink::BindToClient(client))
39 return false; 39 return false;
40 40
41 DCHECK(!thread_checker_); 41 DCHECK(!thread_checker_);
42 thread_checker_.reset(new base::ThreadChecker()); 42 thread_checker_.reset(new base::ThreadChecker());
43 compositor_frame_sink_.Bind(std::move(compositor_frame_sink_info_)); 43 compositor_frame_sink_.Bind(std::move(compositor_frame_sink_info_));
44 client_binding_.reset( 44 client_binding_.reset(
45 new mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient>( 45 new mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient>(
46 this, std::move(client_request_))); 46 this, std::move(client_request_)));
47 47
48 // TODO(enne): Get this from the WindowSurface via ServerWindowSurface. 48 begin_frame_source_ = base::MakeUnique<cc::ExternalBeginFrameSource>(this);
49 begin_frame_source_.reset(new cc::DelayBasedBeginFrameSource(
50 base::MakeUnique<cc::DelayBasedTimeSource>(
51 base::ThreadTaskRunnerHandle::Get().get())));
52 49
53 client->SetBeginFrameSource(begin_frame_source_.get()); 50 client->SetBeginFrameSource(begin_frame_source_.get());
54 return true; 51 return true;
55 } 52 }
56 53
57 void WindowCompositorFrameSink::DetachFromClient() { 54 void WindowCompositorFrameSink::DetachFromClient() {
58 client_->SetBeginFrameSource(nullptr); 55 client_->SetBeginFrameSource(nullptr);
59 begin_frame_source_.reset(); 56 begin_frame_source_.reset();
60 compositor_frame_sink_.reset(); 57 compositor_frame_sink_.reset();
61 cc::CompositorFrameSink::DetachFromClient(); 58 cc::CompositorFrameSink::DetachFromClient();
(...skipping 22 matching lines...) Expand all
84 client_request_(std::move(client_request)) {} 81 client_request_(std::move(client_request)) {}
85 82
86 void WindowCompositorFrameSink::DidReceiveCompositorFrameAck() { 83 void WindowCompositorFrameSink::DidReceiveCompositorFrameAck() {
87 DCHECK(thread_checker_); 84 DCHECK(thread_checker_);
88 DCHECK(thread_checker_->CalledOnValidThread()); 85 DCHECK(thread_checker_->CalledOnValidThread());
89 if (!client_) 86 if (!client_)
90 return; 87 return;
91 client_->DidReceiveCompositorFrameAck(); 88 client_->DidReceiveCompositorFrameAck();
92 } 89 }
93 90
91 void WindowCompositorFrameSink::OnBeginFrame(
92 const cc::BeginFrameArgs& begin_frame_args) {
93 begin_frame_source_->OnBeginFrame(begin_frame_args);
94 }
95
94 void WindowCompositorFrameSink::ReclaimResources( 96 void WindowCompositorFrameSink::ReclaimResources(
95 const cc::ReturnedResourceArray& resources) { 97 const cc::ReturnedResourceArray& resources) {
96 DCHECK(thread_checker_); 98 DCHECK(thread_checker_);
97 DCHECK(thread_checker_->CalledOnValidThread()); 99 DCHECK(thread_checker_->CalledOnValidThread());
98 if (!client_) 100 if (!client_)
99 return; 101 return;
100 client_->ReclaimResources(resources); 102 client_->ReclaimResources(resources);
101 } 103 }
102 104
105 void WindowCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frames) {
106 compositor_frame_sink_->SetNeedsBeginFrame(needs_begin_frames);
107 }
108
103 WindowCompositorFrameSinkBinding::~WindowCompositorFrameSinkBinding() {} 109 WindowCompositorFrameSinkBinding::~WindowCompositorFrameSinkBinding() {}
104 110
105 WindowCompositorFrameSinkBinding::WindowCompositorFrameSinkBinding( 111 WindowCompositorFrameSinkBinding::WindowCompositorFrameSinkBinding(
106 cc::mojom::MojoCompositorFrameSinkRequest compositor_frame_sink_request, 112 cc::mojom::MojoCompositorFrameSinkRequest compositor_frame_sink_request,
107 mojo::InterfacePtrInfo<cc::mojom::MojoCompositorFrameSinkClient> 113 mojo::InterfacePtrInfo<cc::mojom::MojoCompositorFrameSinkClient>
108 compositor_frame_sink_client) 114 compositor_frame_sink_client)
109 : compositor_frame_sink_request_(std::move(compositor_frame_sink_request)), 115 : compositor_frame_sink_request_(std::move(compositor_frame_sink_request)),
110 compositor_frame_sink_client_(std::move(compositor_frame_sink_client)) {} 116 compositor_frame_sink_client_(std::move(compositor_frame_sink_client)) {}
111 117
112 } // namespace aura 118 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/window_compositor_frame_sink.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698