| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 } | 206 } |
| 207 | 207 |
| 208 void BlimpCompositor::SubmitCompositorFrame(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_valid() || current_surface_size_ != surface_size) { |
| 217 DestroyDelegatedContent(); | 217 DestroyDelegatedContent(); |
| 218 DCHECK(layer_->children().empty()); | 218 DCHECK(layer_->children().empty()); |
| 219 | 219 |
| 220 local_frame_id_ = surface_id_allocator_->GenerateId(); | 220 local_frame_id_ = surface_id_allocator_->GenerateId(); |
| 221 surface_factory_->Create(local_frame_id_); | 221 surface_factory_->Create(local_frame_id_); |
| 222 current_surface_size_ = surface_size; | 222 current_surface_size_ = surface_size; |
| 223 | 223 |
| 224 // manager must outlive compositors using it. | 224 // manager must outlive compositors using it. |
| 225 cc::SurfaceManager* surface_manager = | 225 cc::SurfaceManager* surface_manager = |
| 226 GetEmbedderDeps()->GetSurfaceManager(); | 226 GetEmbedderDeps()->GetSurfaceManager(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 base::Bind( | 268 base::Bind( |
| 269 &BlimpCompositorFrameSinkProxyClient::ReclaimCompositorResources, | 269 &BlimpCompositorFrameSinkProxyClient::ReclaimCompositorResources, |
| 270 proxy_client_, resources)); | 270 proxy_client_, resources)); |
| 271 } | 271 } |
| 272 | 272 |
| 273 CompositorDependencies* BlimpCompositor::GetEmbedderDeps() { | 273 CompositorDependencies* BlimpCompositor::GetEmbedderDeps() { |
| 274 return compositor_dependencies_->GetEmbedderDependencies(); | 274 return compositor_dependencies_->GetEmbedderDependencies(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 void BlimpCompositor::DestroyDelegatedContent() { | 277 void BlimpCompositor::DestroyDelegatedContent() { |
| 278 if (local_frame_id_.is_null()) | 278 if (!local_frame_id_.is_valid()) |
| 279 return; | 279 return; |
| 280 | 280 |
| 281 // Remove any references for the surface layer that uses this | 281 // Remove any references for the surface layer that uses this |
| 282 // |local_frame_id_|. | 282 // |local_frame_id_|. |
| 283 layer_->RemoveAllChildren(); | 283 layer_->RemoveAllChildren(); |
| 284 surface_factory_->Destroy(local_frame_id_); | 284 surface_factory_->Destroy(local_frame_id_); |
| 285 local_frame_id_ = cc::LocalFrameId(); | 285 local_frame_id_ = cc::LocalFrameId(); |
| 286 } | 286 } |
| 287 | 287 |
| 288 void BlimpCompositor::CreateLayerTreeHost() { | 288 void BlimpCompositor::CreateLayerTreeHost() { |
| (...skipping 53 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 |