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

Side by Side Diff: cc/surfaces/direct_compositor_frame_sink.cc

Issue 2449853004: Getting rid of DelegatedFrameData (Closed)
Patch Set: Dana's comment 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
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 "cc/surfaces/direct_compositor_frame_sink.h" 5 #include "cc/surfaces/direct_compositor_frame_sink.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/compositor_frame_sink_client.h" 9 #include "cc/output/compositor_frame_sink_client.h"
10 #include "cc/surfaces/display.h" 10 #include "cc/surfaces/display.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Unregister the SurfaceFactoryClient here instead of the dtor so that only 82 // Unregister the SurfaceFactoryClient here instead of the dtor so that only
83 // one client is alive for this namespace at any given time. 83 // one client is alive for this namespace at any given time.
84 surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_); 84 surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_);
85 if (!delegated_local_frame_id_.is_null()) 85 if (!delegated_local_frame_id_.is_null())
86 factory_.Destroy(delegated_local_frame_id_); 86 factory_.Destroy(delegated_local_frame_id_);
87 87
88 CompositorFrameSink::DetachFromClient(); 88 CompositorFrameSink::DetachFromClient();
89 } 89 }
90 90
91 void DirectCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { 91 void DirectCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) {
92 gfx::Size frame_size = 92 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
93 frame.delegated_frame_data->render_pass_list.back()->output_rect.size();
94 if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) { 93 if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) {
95 if (!delegated_local_frame_id_.is_null()) { 94 if (!delegated_local_frame_id_.is_null()) {
96 factory_.Destroy(delegated_local_frame_id_); 95 factory_.Destroy(delegated_local_frame_id_);
97 } 96 }
98 delegated_local_frame_id_ = surface_id_allocator_.GenerateId(); 97 delegated_local_frame_id_ = surface_id_allocator_.GenerateId();
99 factory_.Create(delegated_local_frame_id_); 98 factory_.Create(delegated_local_frame_id_);
100 last_swap_frame_size_ = frame_size; 99 last_swap_frame_size_ = frame_size;
101 } 100 }
102 display_->SetSurfaceId(SurfaceId(frame_sink_id_, delegated_local_frame_id_), 101 display_->SetSurfaceId(SurfaceId(frame_sink_id_, delegated_local_frame_id_),
103 frame.metadata.device_scale_factor); 102 frame.metadata.device_scale_factor);
104 103
105 factory_.SubmitCompositorFrame( 104 factory_.SubmitCompositorFrame(
106 delegated_local_frame_id_, std::move(frame), 105 delegated_local_frame_id_, std::move(frame),
107 base::Bind(&DirectCompositorFrameSink::DidDrawCallback, 106 base::Bind(&DirectCompositorFrameSink::DidDrawCallback,
108 base::Unretained(this))); 107 base::Unretained(this)));
109 } 108 }
110 109
111 void DirectCompositorFrameSink::ForceReclaimResources() { 110 void DirectCompositorFrameSink::ForceReclaimResources() {
112 if (!delegated_local_frame_id_.is_null()) { 111 if (!delegated_local_frame_id_.is_null()) {
113 factory_.SubmitCompositorFrame(delegated_local_frame_id_, CompositorFrame(), 112 factory_.SubmitCompositorFrame(delegated_local_frame_id_, CompositorFrame(),
danakj 2016/11/16 01:57:00 Specifically should this EvictSurface or something
114 SurfaceFactory::DrawCallback()); 113 SurfaceFactory::DrawCallback());
115 } 114 }
116 } 115 }
117 116
118 void DirectCompositorFrameSink::ReturnResources( 117 void DirectCompositorFrameSink::ReturnResources(
119 const ReturnedResourceArray& resources) { 118 const ReturnedResourceArray& resources) {
120 if (client_) 119 if (client_)
121 client_->ReclaimResources(resources); 120 client_->ReclaimResources(resources);
122 } 121 }
123 122
(...skipping 18 matching lines...) Expand all
142 // This notification is not relevant to our client outside of tests. We 141 // This notification is not relevant to our client outside of tests. We
143 // unblock the client from DidDrawCallback() when the surface is going to 142 // unblock the client from DidDrawCallback() when the surface is going to
144 // be drawn. 143 // be drawn.
145 } 144 }
146 145
147 void DirectCompositorFrameSink::DidDrawCallback() { 146 void DirectCompositorFrameSink::DidDrawCallback() {
148 client_->DidReceiveCompositorFrameAck(); 147 client_->DidReceiveCompositorFrameAck();
149 } 148 }
150 149
151 } // namespace cc 150 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698