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

Side by Side Diff: content/browser/renderer_host/delegated_frame_host.cc

Issue 2708423002: DelegatedFrameHost should not send immediate ack when compositor is null (Closed)
Patch Set: Remove unit test Created 3 years, 10 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
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_aura_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/renderer_host/delegated_frame_host.h" 5 #include "content/browser/renderer_host/delegated_frame_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 SendReclaimCompositorResources(last_compositor_frame_sink_id_, 444 SendReclaimCompositorResources(last_compositor_frame_sink_id_,
445 false /* is_swap_ack */); 445 false /* is_swap_ack */);
446 } 446 }
447 last_compositor_frame_sink_id_ = compositor_frame_sink_id; 447 last_compositor_frame_sink_id_ = compositor_frame_sink_id;
448 } 448 }
449 bool skip_frame = false; 449 bool skip_frame = false;
450 pending_delegated_ack_count_++; 450 pending_delegated_ack_count_++;
451 451
452 background_color_ = frame.metadata.root_background_color; 452 background_color_ = frame.metadata.root_background_color;
453 453
454 bool did_send_ack_callback = false;
455 if (frame_size.IsEmpty()) { 454 if (frame_size.IsEmpty()) {
456 DCHECK(frame.resource_list.empty()); 455 DCHECK(frame.resource_list.empty());
457 EvictDelegatedFrame(); 456 EvictDelegatedFrame();
458 } else { 457 } else {
459 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 458 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
460 cc::SurfaceManager* manager = 459 cc::SurfaceManager* manager =
461 factory->GetContextFactoryPrivate()->GetSurfaceManager(); 460 factory->GetContextFactoryPrivate()->GetSurfaceManager();
462 bool allocated_new_local_surface_id = false; 461 bool allocated_new_local_surface_id = false;
463 if (!local_surface_id_.is_valid() || frame_size != current_surface_size_ || 462 if (!local_surface_id_.is_valid() || frame_size != current_surface_size_ ||
464 frame_size_in_dip != current_frame_size_in_dip_) { 463 frame_size_in_dip != current_frame_size_in_dip_) {
465 local_surface_id_ = id_allocator_->GenerateId(); 464 local_surface_id_ = id_allocator_->GenerateId();
466 allocated_new_local_surface_id = true; 465 allocated_new_local_surface_id = true;
467 } 466 }
468 467
469 gfx::Size desired_size = client_->DelegatedFrameHostDesiredSizeInDIP(); 468 gfx::Size desired_size = client_->DelegatedFrameHostDesiredSizeInDIP();
470 if (desired_size != frame_size_in_dip && !desired_size.IsEmpty()) { 469 if (desired_size != frame_size_in_dip && !desired_size.IsEmpty()) {
471 skip_frame = true; 470 skip_frame = true;
472 skipped_latency_info_list_.insert(skipped_latency_info_list_.end(), 471 skipped_latency_info_list_.insert(skipped_latency_info_list_.end(),
473 frame.metadata.latency_info.begin(), 472 frame.metadata.latency_info.begin(),
474 frame.metadata.latency_info.end()); 473 frame.metadata.latency_info.end());
475 frame.metadata.latency_info.clear(); 474 frame.metadata.latency_info.clear();
476 } else { 475 } else {
477 frame.metadata.latency_info.insert(frame.metadata.latency_info.end(), 476 frame.metadata.latency_info.insert(frame.metadata.latency_info.end(),
478 skipped_latency_info_list_.begin(), 477 skipped_latency_info_list_.begin(),
479 skipped_latency_info_list_.end()); 478 skipped_latency_info_list_.end());
480 skipped_latency_info_list_.clear(); 479 skipped_latency_info_list_.clear();
481 } 480 }
482 481
483 cc::SurfaceFactory::DrawCallback ack_callback; 482 cc::SurfaceFactory::DrawCallback ack_callback;
484 if (compositor_ && !skip_frame) { 483 if (!skip_frame) {
485 ack_callback = base::Bind(&DelegatedFrameHost::SurfaceDrawn, AsWeakPtr(), 484 ack_callback = base::Bind(&DelegatedFrameHost::SurfaceDrawn, AsWeakPtr(),
486 compositor_frame_sink_id); 485 compositor_frame_sink_id);
487 did_send_ack_callback = true;
488 } 486 }
489 surface_factory_->SubmitCompositorFrame(local_surface_id_, std::move(frame), 487 surface_factory_->SubmitCompositorFrame(local_surface_id_, std::move(frame),
490 ack_callback); 488 ack_callback);
491 if (allocated_new_local_surface_id) { 489 if (allocated_new_local_surface_id) {
492 // manager must outlive compositors using it. 490 // manager must outlive compositors using it.
493 cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_); 491 cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_);
494 cc::SurfaceInfo surface_info(surface_id, frame_device_scale_factor, 492 cc::SurfaceInfo surface_info(surface_id, frame_device_scale_factor,
495 frame_size); 493 frame_size);
496 client_->DelegatedFrameHostGetLayer()->SetShowSurface( 494 client_->DelegatedFrameHostGetLayer()->SetShowSurface(
497 surface_info, manager->reference_factory()); 495 surface_info, manager->reference_factory());
498 current_surface_size_ = frame_size; 496 current_surface_size_ = frame_size;
499 current_scale_factor_ = frame_device_scale_factor; 497 current_scale_factor_ = frame_device_scale_factor;
500 } 498 }
501 } 499 }
502 released_front_lock_ = NULL; 500 released_front_lock_ = NULL;
503 current_frame_size_in_dip_ = frame_size_in_dip; 501 current_frame_size_in_dip_ = frame_size_in_dip;
504 CheckResizeLock(); 502 CheckResizeLock();
505 503
506 UpdateGutters(); 504 UpdateGutters();
507 505
508 if (!damage_rect_in_dip.IsEmpty()) { 506 if (!damage_rect_in_dip.IsEmpty()) {
509 client_->DelegatedFrameHostGetLayer()->OnDelegatedFrameDamage( 507 client_->DelegatedFrameHostGetLayer()->OnDelegatedFrameDamage(
510 damage_rect_in_dip); 508 damage_rect_in_dip);
511 } 509 }
512 510
513 // Note that |compositor_| may be reset by SetShowSurface or 511 if (skip_frame) {
514 // SetShowDelegatedContent above.
515 if (!compositor_ || skip_frame) {
516 SendReclaimCompositorResources(compositor_frame_sink_id, 512 SendReclaimCompositorResources(compositor_frame_sink_id,
517 !did_send_ack_callback /* is_swap_ack */); 513 true /* is_swap_ack */);
518 } else { 514 }
515
516 if (compositor_ && !skip_frame)
519 can_lock_compositor_ = NO_PENDING_COMMIT; 517 can_lock_compositor_ = NO_PENDING_COMMIT;
520 } 518
521 if (local_surface_id_.is_valid()) { 519 if (local_surface_id_.is_valid()) {
522 delegated_frame_evictor_->SwappedFrame( 520 delegated_frame_evictor_->SwappedFrame(
523 client_->DelegatedFrameHostIsVisible()); 521 client_->DelegatedFrameHostIsVisible());
524 } 522 }
525 // Note: the frame may have been evicted immediately. 523 // Note: the frame may have been evicted immediately.
526 } 524 }
527 525
528 void DelegatedFrameHost::ClearDelegatedFrame() { 526 void DelegatedFrameHost::ClearDelegatedFrame() {
529 if (local_surface_id_.is_valid()) 527 if (local_surface_id_.is_valid())
530 EvictDelegatedFrame(); 528 EvictDelegatedFrame();
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 std::move(request)); 866 std::move(request));
869 } 867 }
870 } 868 }
871 869
872 void DelegatedFrameHost::UnlockResources() { 870 void DelegatedFrameHost::UnlockResources() {
873 DCHECK(local_surface_id_.is_valid()); 871 DCHECK(local_surface_id_.is_valid());
874 delegated_frame_evictor_->UnlockFrame(); 872 delegated_frame_evictor_->UnlockFrame();
875 } 873 }
876 874
877 } // namespace content 875 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_aura_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698