OLD | NEW |
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 "content/browser/compositor/delegated_frame_host.h" | 5 #include "content/browser/compositor/delegated_frame_host.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/compositor_frame_ack.h" | 10 #include "cc/output/compositor_frame_ack.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 resource_collection_->SetClient(NULL); | 365 resource_collection_->SetClient(NULL); |
366 | 366 |
367 if (resource_collection_->LoseAllResources()) | 367 if (resource_collection_->LoseAllResources()) |
368 SendReturnedDelegatedResources(last_output_surface_id_); | 368 SendReturnedDelegatedResources(last_output_surface_id_); |
369 | 369 |
370 resource_collection_ = NULL; | 370 resource_collection_ = NULL; |
371 } | 371 } |
372 last_output_surface_id_ = output_surface_id; | 372 last_output_surface_id_ = output_surface_id; |
373 } | 373 } |
374 bool immediate_ack = !compositor_; | 374 bool immediate_ack = !compositor_; |
| 375 pending_delegated_ack_count_++; |
| 376 |
375 if (frame_size.IsEmpty()) { | 377 if (frame_size.IsEmpty()) { |
376 DCHECK(frame_data->resource_list.empty()); | 378 DCHECK(frame_data->resource_list.empty()); |
377 EvictDelegatedFrame(); | 379 EvictDelegatedFrame(); |
378 } else { | 380 } else { |
379 if (use_surfaces_) { | 381 if (use_surfaces_) { |
380 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 382 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
381 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 383 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
382 if (!surface_factory_) { | 384 if (!surface_factory_) { |
383 id_allocator_ = | 385 id_allocator_ = |
384 factory->GetContextFactory()->CreateSurfaceIdAllocator(); | 386 factory->GetContextFactory()->CreateSurfaceIdAllocator(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 } | 445 } |
444 } | 446 } |
445 } | 447 } |
446 released_front_lock_ = NULL; | 448 released_front_lock_ = NULL; |
447 current_frame_size_in_dip_ = frame_size_in_dip; | 449 current_frame_size_in_dip_ = frame_size_in_dip; |
448 CheckResizeLock(); | 450 CheckResizeLock(); |
449 | 451 |
450 if (!damage_rect_in_dip.IsEmpty()) | 452 if (!damage_rect_in_dip.IsEmpty()) |
451 client_->GetLayer()->OnDelegatedFrameDamage(damage_rect_in_dip); | 453 client_->GetLayer()->OnDelegatedFrameDamage(damage_rect_in_dip); |
452 | 454 |
453 pending_delegated_ack_count_++; | |
454 | |
455 if (immediate_ack) { | 455 if (immediate_ack) { |
456 SendDelegatedFrameAck(output_surface_id); | 456 SendDelegatedFrameAck(output_surface_id); |
457 } else if (!use_surfaces_) { | 457 } else if (!use_surfaces_) { |
458 std::vector<ui::LatencyInfo>::const_iterator it; | 458 std::vector<ui::LatencyInfo>::const_iterator it; |
459 for (it = latency_info.begin(); it != latency_info.end(); ++it) | 459 for (it = latency_info.begin(); it != latency_info.end(); ++it) |
460 compositor_->SetLatencyInfo(*it); | 460 compositor_->SetLatencyInfo(*it); |
461 // If we've previously skipped any latency infos add them. | 461 // If we've previously skipped any latency infos add them. |
462 for (it = skipped_latency_info_list_.begin(); | 462 for (it = skipped_latency_info_list_.begin(); |
463 it != skipped_latency_info_list_.end(); | 463 it != skipped_latency_info_list_.end(); |
464 ++it) | 464 ++it) |
(...skipping 20 matching lines...) Expand all Loading... |
485 if (resource_collection_.get()) | 485 if (resource_collection_.get()) |
486 resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources); | 486 resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources); |
487 RenderWidgetHostImpl::SendSwapCompositorFrameAck(host->GetRoutingID(), | 487 RenderWidgetHostImpl::SendSwapCompositorFrameAck(host->GetRoutingID(), |
488 output_surface_id, | 488 output_surface_id, |
489 host->GetProcess()->GetID(), | 489 host->GetProcess()->GetID(), |
490 ack); | 490 ack); |
491 DCHECK_GT(pending_delegated_ack_count_, 0); | 491 DCHECK_GT(pending_delegated_ack_count_, 0); |
492 pending_delegated_ack_count_--; | 492 pending_delegated_ack_count_--; |
493 } | 493 } |
494 | 494 |
495 void DelegatedFrameHost::SurfaceDrawn(uint32 output_surface_id, bool drawn) { | 495 void DelegatedFrameHost::SurfaceDrawn(uint32 output_surface_id, |
| 496 cc::SurfaceDrawStatus drawn) { |
496 SendDelegatedFrameAck(output_surface_id); | 497 SendDelegatedFrameAck(output_surface_id); |
497 } | 498 } |
498 | 499 |
499 void DelegatedFrameHost::UnusedResourcesAreAvailable() { | 500 void DelegatedFrameHost::UnusedResourcesAreAvailable() { |
500 if (pending_delegated_ack_count_) | 501 if (pending_delegated_ack_count_) |
501 return; | 502 return; |
502 | 503 |
503 SendReturnedDelegatedResources(last_output_surface_id_); | 504 SendReturnedDelegatedResources(last_output_surface_id_); |
504 } | 505 } |
505 | 506 |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 1025 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
1025 new_layer->SetShowSurface( | 1026 new_layer->SetShowSurface( |
1026 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 1027 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
1027 base::Bind(&RequireCallback, base::Unretained(manager)), | 1028 base::Bind(&RequireCallback, base::Unretained(manager)), |
1028 current_surface_size_, current_scale_factor_, | 1029 current_surface_size_, current_scale_factor_, |
1029 current_frame_size_in_dip_); | 1030 current_frame_size_in_dip_); |
1030 } | 1031 } |
1031 } | 1032 } |
1032 | 1033 |
1033 } // namespace content | 1034 } // namespace content |
OLD | NEW |