| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 void BlimpCompositor::BindToProxyClient( | 204 void BlimpCompositor::BindToProxyClient( |
| 205 base::WeakPtr<BlimpCompositorFrameSinkProxyClient> proxy_client) { | 205 base::WeakPtr<BlimpCompositorFrameSinkProxyClient> proxy_client) { |
| 206 DCHECK(thread_checker_.CalledOnValidThread()); | 206 DCHECK(thread_checker_.CalledOnValidThread()); |
| 207 DCHECK(!surface_factory_); | 207 DCHECK(!surface_factory_); |
| 208 | 208 |
| 209 proxy_client_ = proxy_client; | 209 proxy_client_ = proxy_client; |
| 210 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>( | 210 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>( |
| 211 frame_sink_id_, GetEmbedderDeps()->GetSurfaceManager(), this); | 211 frame_sink_id_, GetEmbedderDeps()->GetSurfaceManager(), this); |
| 212 } | 212 } |
| 213 | 213 |
| 214 void BlimpCompositor::SwapCompositorFrame(cc::CompositorFrame frame) { | 214 void BlimpCompositor::SubmitCompositorFrame(cc::CompositorFrame frame) { |
| 215 DCHECK(thread_checker_.CalledOnValidThread()); | 215 DCHECK(thread_checker_.CalledOnValidThread()); |
| 216 DCHECK(surface_factory_); | 216 DCHECK(surface_factory_); |
| 217 | 217 |
| 218 cc::RenderPass* root_pass = | 218 cc::RenderPass* root_pass = |
| 219 frame.delegated_frame_data->render_pass_list.back().get(); | 219 frame.delegated_frame_data->render_pass_list.back().get(); |
| 220 gfx::Size surface_size = root_pass->output_rect.size(); | 220 gfx::Size surface_size = root_pass->output_rect.size(); |
| 221 | 221 |
| 222 if (local_frame_id_.is_null() || current_surface_size_ != surface_size) { | 222 if (local_frame_id_.is_null() || current_surface_size_ != surface_size) { |
| 223 DestroyDelegatedContent(); | 223 DestroyDelegatedContent(); |
| 224 DCHECK(layer_->children().empty()); | 224 DCHECK(layer_->children().empty()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 246 surface_factory_->SubmitCompositorFrame( | 246 surface_factory_->SubmitCompositorFrame( |
| 247 local_frame_id_, std::move(frame), | 247 local_frame_id_, std::move(frame), |
| 248 base::Bind(&BlimpCompositor::SubmitCompositorFrameAck, | 248 base::Bind(&BlimpCompositor::SubmitCompositorFrameAck, |
| 249 weak_ptr_factory_.GetWeakPtr())); | 249 weak_ptr_factory_.GetWeakPtr())); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void BlimpCompositor::SubmitCompositorFrameAck() { | 252 void BlimpCompositor::SubmitCompositorFrameAck() { |
| 253 DCHECK(surface_factory_); | 253 DCHECK(surface_factory_); |
| 254 compositor_dependencies_->GetCompositorTaskRunner()->PostTask( | 254 compositor_dependencies_->GetCompositorTaskRunner()->PostTask( |
| 255 FROM_HERE, | 255 FROM_HERE, |
| 256 base::Bind(&BlimpCompositorFrameSinkProxyClient::SwapCompositorFrameAck, | 256 base::Bind(&BlimpCompositorFrameSinkProxyClient::SubmitCompositorFrameAck, |
| 257 proxy_client_)); | 257 proxy_client_)); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void BlimpCompositor::UnbindProxyClient() { | 260 void BlimpCompositor::UnbindProxyClient() { |
| 261 DCHECK(thread_checker_.CalledOnValidThread()); | 261 DCHECK(thread_checker_.CalledOnValidThread()); |
| 262 DCHECK(surface_factory_); | 262 DCHECK(surface_factory_); |
| 263 | 263 |
| 264 DestroyDelegatedContent(); | 264 DestroyDelegatedContent(); |
| 265 surface_factory_.reset(); | 265 surface_factory_.reset(); |
| 266 proxy_client_ = nullptr; | 266 proxy_client_ = nullptr; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 it->second.Run(); | 359 it->second.Run(); |
| 360 it = pending_commit_trackers_.erase(it); | 360 it = pending_commit_trackers_.erase(it); |
| 361 } else { | 361 } else { |
| 362 ++it; | 362 ++it; |
| 363 } | 363 } |
| 364 } | 364 } |
| 365 } | 365 } |
| 366 | 366 |
| 367 } // namespace client | 367 } // namespace client |
| 368 } // namespace blimp | 368 } // namespace blimp |
| OLD | NEW |