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

Side by Side Diff: content/renderer/android/synchronous_compositor_filter.cc

Issue 2337913003: Fork cc::OutputSurface into cc::CompositorFrameSink. (Closed)
Patch Set: cfsfork: android-vulkan 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/renderer/android/synchronous_compositor_filter.h" 5 #include "content/renderer/android/synchronous_compositor_filter.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 DLOG(WARNING) << "Failed to send message"; 124 DLOG(WARNING) << "Failed to send message";
125 } 125 }
126 126
127 void SynchronousCompositorFilter::FilterReadyOnCompositorThread() { 127 void SynchronousCompositorFilter::FilterReadyOnCompositorThread() {
128 DCHECK(!filter_ready_); 128 DCHECK(!filter_ready_);
129 filter_ready_ = true; 129 filter_ready_ = true;
130 for (const auto& entry_pair : synchronous_input_handler_proxy_map_) { 130 for (const auto& entry_pair : synchronous_input_handler_proxy_map_) {
131 DCHECK(entry_pair.second); 131 DCHECK(entry_pair.second);
132 int routing_id = entry_pair.first; 132 int routing_id = entry_pair.first;
133 CreateSynchronousCompositorProxy(routing_id, entry_pair.second); 133 CreateSynchronousCompositorProxy(routing_id, entry_pair.second);
134 auto output_surface_entry = output_surface_map_.find(routing_id); 134 auto compositor_frame_sink_entry =
135 if (output_surface_entry != output_surface_map_.end()) { 135 compositor_frame_sink_map_.find(routing_id);
136 SetProxyOutputSurface(routing_id, output_surface_entry->second); 136 if (compositor_frame_sink_entry != compositor_frame_sink_map_.end()) {
137 SetProxyCompositorFrameSink(routing_id,
138 compositor_frame_sink_entry->second);
137 } 139 }
138 } 140 }
139 } 141 }
140 142
141 void SynchronousCompositorFilter::RegisterOutputSurface( 143 void SynchronousCompositorFilter::RegisterCompositorFrameSink(
142 int routing_id, 144 int routing_id,
143 SynchronousCompositorOutputSurface* output_surface) { 145 SynchronousCompositorFrameSink* compositor_frame_sink) {
144 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); 146 DCHECK(compositor_task_runner_->BelongsToCurrentThread());
145 DCHECK(output_surface); 147 DCHECK(compositor_frame_sink);
146 SynchronousCompositorProxy* proxy = FindProxy(routing_id); 148 SynchronousCompositorProxy* proxy = FindProxy(routing_id);
147 if (proxy) { 149 if (proxy) {
148 proxy->SetOutputSurface(output_surface); 150 proxy->SetCompositorFrameSink(compositor_frame_sink);
149 } else { 151 } else {
150 DCHECK(output_surface_map_.find(routing_id) == output_surface_map_.end()); 152 DCHECK(compositor_frame_sink_map_.find(routing_id) ==
151 output_surface_map_[routing_id] = output_surface; 153 compositor_frame_sink_map_.end());
154 compositor_frame_sink_map_[routing_id] = compositor_frame_sink;
152 } 155 }
153 } 156 }
154 157
155 void SynchronousCompositorFilter::OnSynchronizeRendererState( 158 void SynchronousCompositorFilter::OnSynchronizeRendererState(
156 const std::vector<int>& routing_ids, 159 const std::vector<int>& routing_ids,
157 std::vector<SyncCompositorCommonRendererParams>* out) { 160 std::vector<SyncCompositorCommonRendererParams>* out) {
158 for (int routing_id : routing_ids) { 161 for (int routing_id : routing_ids) {
159 SynchronousCompositorProxy* proxy = FindProxy(routing_id); 162 SynchronousCompositorProxy* proxy = FindProxy(routing_id);
160 SyncCompositorCommonRendererParams param; 163 SyncCompositorCommonRendererParams param;
161 if (proxy) 164 if (proxy)
162 proxy->PopulateCommonParams(&param); 165 proxy->PopulateCommonParams(&param);
163 out->push_back(param); 166 out->push_back(param);
164 } 167 }
165 } 168 }
166 169
167 void SynchronousCompositorFilter::UnregisterOutputSurface( 170 void SynchronousCompositorFilter::UnregisterCompositorFrameSink(
168 int routing_id, 171 int routing_id,
169 SynchronousCompositorOutputSurface* output_surface) { 172 SynchronousCompositorFrameSink* compositor_frame_sink) {
170 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); 173 DCHECK(compositor_task_runner_->BelongsToCurrentThread());
171 DCHECK(output_surface); 174 DCHECK(compositor_frame_sink);
172 SynchronousCompositorProxy* proxy = FindProxy(routing_id); 175 SynchronousCompositorProxy* proxy = FindProxy(routing_id);
173 if (proxy) { 176 if (proxy) {
174 proxy->SetOutputSurface(nullptr); 177 proxy->SetCompositorFrameSink(nullptr);
175 } 178 }
176 auto entry = output_surface_map_.find(routing_id); 179 auto entry = compositor_frame_sink_map_.find(routing_id);
177 if (entry != output_surface_map_.end()) 180 if (entry != compositor_frame_sink_map_.end())
178 output_surface_map_.erase(entry); 181 compositor_frame_sink_map_.erase(entry);
179 } 182 }
180 183
181 void SynchronousCompositorFilter::CreateSynchronousCompositorProxy( 184 void SynchronousCompositorFilter::CreateSynchronousCompositorProxy(
182 int routing_id, 185 int routing_id,
183 ui::SynchronousInputHandlerProxy* synchronous_input_handler_proxy) { 186 ui::SynchronousInputHandlerProxy* synchronous_input_handler_proxy) {
184 DCHECK(!sync_compositor_map_.contains(routing_id)); 187 DCHECK(!sync_compositor_map_.contains(routing_id));
185 std::unique_ptr<SynchronousCompositorProxy> proxy( 188 std::unique_ptr<SynchronousCompositorProxy> proxy(
186 new SynchronousCompositorProxy(routing_id, this, 189 new SynchronousCompositorProxy(routing_id, this,
187 synchronous_input_handler_proxy)); 190 synchronous_input_handler_proxy));
188 sync_compositor_map_.add(routing_id, std::move(proxy)); 191 sync_compositor_map_.add(routing_id, std::move(proxy));
189 } 192 }
190 193
191 void SynchronousCompositorFilter::SetProxyOutputSurface( 194 void SynchronousCompositorFilter::SetProxyCompositorFrameSink(
192 int routing_id, 195 int routing_id,
193 SynchronousCompositorOutputSurface* output_surface) { 196 SynchronousCompositorFrameSink* compositor_frame_sink) {
194 DCHECK(output_surface); 197 DCHECK(compositor_frame_sink);
195 SynchronousCompositorProxy* proxy = FindProxy(routing_id); 198 SynchronousCompositorProxy* proxy = FindProxy(routing_id);
196 DCHECK(proxy); 199 DCHECK(proxy);
197 proxy->SetOutputSurface(output_surface); 200 proxy->SetCompositorFrameSink(compositor_frame_sink);
198 } 201 }
199 202
200 void SynchronousCompositorFilter::DidAddSynchronousHandlerProxy( 203 void SynchronousCompositorFilter::DidAddSynchronousHandlerProxy(
201 int routing_id, 204 int routing_id,
202 ui::SynchronousInputHandlerProxy* synchronous_input_handler_proxy) { 205 ui::SynchronousInputHandlerProxy* synchronous_input_handler_proxy) {
203 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); 206 DCHECK(compositor_task_runner_->BelongsToCurrentThread());
204 DCHECK(synchronous_input_handler_proxy); 207 DCHECK(synchronous_input_handler_proxy);
205 if (filter_ready_) { 208 if (filter_ready_) {
206 CreateSynchronousCompositorProxy(routing_id, 209 CreateSynchronousCompositorProxy(routing_id,
207 synchronous_input_handler_proxy); 210 synchronous_input_handler_proxy);
208 auto entry = output_surface_map_.find(routing_id); 211 auto entry = compositor_frame_sink_map_.find(routing_id);
209 if (entry != output_surface_map_.end()) 212 if (entry != compositor_frame_sink_map_.end())
210 SetProxyOutputSurface(routing_id, entry->second); 213 SetProxyCompositorFrameSink(routing_id, entry->second);
211 } else { 214 } else {
212 auto*& mapped_synchronous_input_handler_proxy = 215 auto*& mapped_synchronous_input_handler_proxy =
213 synchronous_input_handler_proxy_map_[routing_id]; 216 synchronous_input_handler_proxy_map_[routing_id];
214 DCHECK(!mapped_synchronous_input_handler_proxy); 217 DCHECK(!mapped_synchronous_input_handler_proxy);
215 mapped_synchronous_input_handler_proxy = synchronous_input_handler_proxy; 218 mapped_synchronous_input_handler_proxy = synchronous_input_handler_proxy;
216 } 219 }
217 } 220 }
218 221
219 void SynchronousCompositorFilter::DidRemoveSynchronousHandlerProxy( 222 void SynchronousCompositorFilter::DidRemoveSynchronousHandlerProxy(
220 int routing_id) { 223 int routing_id) {
221 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); 224 DCHECK(compositor_task_runner_->BelongsToCurrentThread());
222 if (base::ContainsKey(sync_compositor_map_, routing_id)) { 225 if (base::ContainsKey(sync_compositor_map_, routing_id)) {
223 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); 226 DCHECK(compositor_task_runner_->BelongsToCurrentThread());
224 DCHECK(sync_compositor_map_.contains(routing_id)); 227 DCHECK(sync_compositor_map_.contains(routing_id));
225 sync_compositor_map_.erase(routing_id); 228 sync_compositor_map_.erase(routing_id);
226 } 229 }
227 if (base::ContainsKey(synchronous_input_handler_proxy_map_, routing_id)) 230 if (base::ContainsKey(synchronous_input_handler_proxy_map_, routing_id))
228 synchronous_input_handler_proxy_map_.erase(routing_id); 231 synchronous_input_handler_proxy_map_.erase(routing_id);
229 } 232 }
230 233
231 } // namespace content 234 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/android/synchronous_compositor_filter.h ('k') | content/renderer/android/synchronous_compositor_frame_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698