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

Side by Side Diff: services/ui/gpu/display_compositor/compositor_frame_sink_impl.cc

Issue 2167713002: cc: Delete SurfaceDrawStatus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Scott's comments Created 4 years, 5 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/gpu/display_compositor/compositor_frame_sink_impl.h" 5 #include "services/ui/gpu/display_compositor/compositor_frame_sink_impl.h"
6 6
7 #include "cc/ipc/compositor_frame.mojom.h" 7 #include "cc/ipc/compositor_frame.mojom.h"
8 #include "cc/surfaces/surface_factory.h" 8 #include "cc/surfaces/surface_factory.h"
9 #include "services/ui/gpu/display_compositor/compositor_frame_sink_delegate.h" 9 #include "services/ui/gpu/display_compositor/compositor_frame_sink_delegate.h"
10 10
11 namespace ui { 11 namespace ui {
12 namespace gpu { 12 namespace gpu {
13 13
14 namespace {
15
16 void CallCallback(
17 const mojom::CompositorFrameSink::SubmitCompositorFrameCallback& callback,
18 cc::SurfaceDrawStatus draw_status) {
19 callback.Run(static_cast<mojom::CompositorFrameDrawStatus>(draw_status));
20 }
21 }
22
23 CompositorFrameSinkImpl::CompositorFrameSinkImpl( 14 CompositorFrameSinkImpl::CompositorFrameSinkImpl(
24 CompositorFrameSinkDelegate* delegate, 15 CompositorFrameSinkDelegate* delegate,
25 int sink_id, 16 int sink_id,
26 const scoped_refptr<SurfacesState>& surfaces_state, 17 const scoped_refptr<SurfacesState>& surfaces_state,
27 mojo::InterfaceRequest<mojom::CompositorFrameSink> request, 18 mojo::InterfaceRequest<mojom::CompositorFrameSink> request,
28 mojom::CompositorFrameSinkClientPtr client) 19 mojom::CompositorFrameSinkClientPtr client)
29 : delegate_(delegate), 20 : delegate_(delegate),
30 surfaces_state_(surfaces_state), 21 surfaces_state_(surfaces_state),
31 sink_id_(sink_id), 22 sink_id_(sink_id),
32 begin_frame_source_(nullptr), 23 begin_frame_source_(nullptr),
(...skipping 29 matching lines...) Expand all
62 ->output_rect.size(); 53 ->output_rect.size();
63 if (frame_size.IsEmpty() || frame_size != last_submitted_frame_size_) { 54 if (frame_size.IsEmpty() || frame_size != last_submitted_frame_size_) {
64 if (!surface_id_.is_null()) 55 if (!surface_id_.is_null())
65 factory_.Destroy(surface_id_); 56 factory_.Destroy(surface_id_);
66 // TODO(fsamuel): The allocator should live on CompositorFrameSinkFactory. 57 // TODO(fsamuel): The allocator should live on CompositorFrameSinkFactory.
67 surface_id_ = delegate_->GenerateSurfaceId(); 58 surface_id_ = delegate_->GenerateSurfaceId();
68 factory_.Create(surface_id_); 59 factory_.Create(surface_id_);
69 last_submitted_frame_size_ = frame_size; 60 last_submitted_frame_size_ = frame_size;
70 } 61 }
71 factory_.SubmitCompositorFrame(surface_id_, std::move(compositor_frame), 62 factory_.SubmitCompositorFrame(surface_id_, std::move(compositor_frame),
72 base::Bind(&CallCallback, callback)); 63 callback);
73 } 64 }
74 65
75 void CompositorFrameSinkImpl::ReturnResources( 66 void CompositorFrameSinkImpl::ReturnResources(
76 const cc::ReturnedResourceArray& resources) { 67 const cc::ReturnedResourceArray& resources) {
77 if (!client_) 68 if (!client_)
78 return; 69 return;
79 70
80 client_->ReturnResources(mojo::Array<cc::ReturnedResource>::From(resources)); 71 client_->ReturnResources(mojo::Array<cc::ReturnedResource>::From(resources));
81 } 72 }
82 73
(...skipping 20 matching lines...) Expand all
103 void CompositorFrameSinkImpl::OnBeginFrameSourcePausedChanged(bool paused) { 94 void CompositorFrameSinkImpl::OnBeginFrameSourcePausedChanged(bool paused) {
104 // TODO(fsamuel): Implement this. 95 // TODO(fsamuel): Implement this.
105 } 96 }
106 97
107 void CompositorFrameSinkImpl::OnConnectionLost() { 98 void CompositorFrameSinkImpl::OnConnectionLost() {
108 delegate_->CompositorFrameSinkConnectionLost(sink_id_); 99 delegate_->CompositorFrameSinkConnectionLost(sink_id_);
109 } 100 }
110 101
111 } // namespace gpu 102 } // namespace gpu
112 } // namespace ui 103 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698