OLD | NEW |
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 "blimp/client/core/compositor/blimp_compositor.h" | 5 #include "blimp/client/core/compositor/blimp_compositor.h" |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 void BlimpCompositor::BindToProxyClient( | 198 void BlimpCompositor::BindToProxyClient( |
199 base::WeakPtr<BlimpCompositorFrameSinkProxyClient> proxy_client) { | 199 base::WeakPtr<BlimpCompositorFrameSinkProxyClient> proxy_client) { |
200 DCHECK(thread_checker_.CalledOnValidThread()); | 200 DCHECK(thread_checker_.CalledOnValidThread()); |
201 DCHECK(!surface_factory_); | 201 DCHECK(!surface_factory_); |
202 | 202 |
203 proxy_client_ = proxy_client; | 203 proxy_client_ = proxy_client; |
204 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>( | 204 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>( |
205 frame_sink_id_, GetEmbedderDeps()->GetSurfaceManager(), this); | 205 frame_sink_id_, GetEmbedderDeps()->GetSurfaceManager(), this); |
206 } | 206 } |
207 | 207 |
208 void BlimpCompositor::SwapCompositorFrame(cc::CompositorFrame frame) { | 208 void BlimpCompositor::SubmitCompositorFrame(cc::CompositorFrame frame) { |
209 DCHECK(thread_checker_.CalledOnValidThread()); | 209 DCHECK(thread_checker_.CalledOnValidThread()); |
210 DCHECK(surface_factory_); | 210 DCHECK(surface_factory_); |
211 | 211 |
212 cc::RenderPass* root_pass = | 212 cc::RenderPass* root_pass = |
213 frame.delegated_frame_data->render_pass_list.back().get(); | 213 frame.delegated_frame_data->render_pass_list.back().get(); |
214 gfx::Size surface_size = root_pass->output_rect.size(); | 214 gfx::Size surface_size = root_pass->output_rect.size(); |
215 | 215 |
216 if (local_frame_id_.is_null() || current_surface_size_ != surface_size) { | 216 if (local_frame_id_.is_null() || current_surface_size_ != surface_size) { |
217 DestroyDelegatedContent(); | 217 DestroyDelegatedContent(); |
218 DCHECK(layer_->children().empty()); | 218 DCHECK(layer_->children().empty()); |
(...skipping 21 matching lines...) Expand all Loading... |
240 surface_factory_->SubmitCompositorFrame( | 240 surface_factory_->SubmitCompositorFrame( |
241 local_frame_id_, std::move(frame), | 241 local_frame_id_, std::move(frame), |
242 base::Bind(&BlimpCompositor::SubmitCompositorFrameAck, | 242 base::Bind(&BlimpCompositor::SubmitCompositorFrameAck, |
243 weak_ptr_factory_.GetWeakPtr())); | 243 weak_ptr_factory_.GetWeakPtr())); |
244 } | 244 } |
245 | 245 |
246 void BlimpCompositor::SubmitCompositorFrameAck() { | 246 void BlimpCompositor::SubmitCompositorFrameAck() { |
247 DCHECK(surface_factory_); | 247 DCHECK(surface_factory_); |
248 compositor_dependencies_->GetCompositorTaskRunner()->PostTask( | 248 compositor_dependencies_->GetCompositorTaskRunner()->PostTask( |
249 FROM_HERE, | 249 FROM_HERE, |
250 base::Bind(&BlimpCompositorFrameSinkProxyClient::SwapCompositorFrameAck, | 250 base::Bind(&BlimpCompositorFrameSinkProxyClient::SubmitCompositorFrameAck, |
251 proxy_client_)); | 251 proxy_client_)); |
252 } | 252 } |
253 | 253 |
254 void BlimpCompositor::UnbindProxyClient() { | 254 void BlimpCompositor::UnbindProxyClient() { |
255 DCHECK(thread_checker_.CalledOnValidThread()); | 255 DCHECK(thread_checker_.CalledOnValidThread()); |
256 DCHECK(surface_factory_); | 256 DCHECK(surface_factory_); |
257 | 257 |
258 DestroyDelegatedContent(); | 258 DestroyDelegatedContent(); |
259 surface_factory_.reset(); | 259 surface_factory_.reset(); |
260 proxy_client_ = nullptr; | 260 proxy_client_ = nullptr; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 it->second.Run(); | 342 it->second.Run(); |
343 it = pending_commit_trackers_.erase(it); | 343 it = pending_commit_trackers_.erase(it); |
344 } else { | 344 } else { |
345 ++it; | 345 ++it; |
346 } | 346 } |
347 } | 347 } |
348 } | 348 } |
349 | 349 |
350 } // namespace client | 350 } // namespace client |
351 } // namespace blimp | 351 } // namespace blimp |
OLD | NEW |