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

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

Issue 153683002: Implement DelegatedFrameResourceCollectionClient::UnusedResourcesAreAvailable for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 uint32 output_surface_id) { 727 uint32 output_surface_id) {
728 cc::CompositorFrameAck ack; 728 cc::CompositorFrameAck ack;
729 if (resource_collection_.get()) 729 if (resource_collection_.get())
730 resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources); 730 resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources);
731 RenderWidgetHostImpl::SendSwapCompositorFrameAck(host_->GetRoutingID(), 731 RenderWidgetHostImpl::SendSwapCompositorFrameAck(host_->GetRoutingID(),
732 output_surface_id, 732 output_surface_id,
733 host_->GetProcess()->GetID(), 733 host_->GetProcess()->GetID(),
734 ack); 734 ack);
735 } 735 }
736 736
737 void RenderWidgetHostViewAndroid::SendReturnedDelegatedResources(
738 uint32 output_surface_id) {
739 DCHECK(resource_collection_);
740
741 cc::CompositorFrameAck ack;
742 resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources);
743 DCHECK(!ack.resources.empty());
744
745 RenderWidgetHostImpl::SendReclaimCompositorResources(
746 host_->GetRoutingID(),
747 output_surface_id,
748 host_->GetProcess()->GetID(),
749 ack);
750 }
751
737 void RenderWidgetHostViewAndroid::UnusedResourcesAreAvailable() { 752 void RenderWidgetHostViewAndroid::UnusedResourcesAreAvailable() {
738 // TODO(danakj): If no ack is pending, collect and send resources now. 753 if (ack_callbacks_.size())
754 return;
755 SendReturnedDelegatedResources(last_output_surface_id_);
739 } 756 }
740 757
741 void RenderWidgetHostViewAndroid::DestroyDelegatedContent() { 758 void RenderWidgetHostViewAndroid::DestroyDelegatedContent() {
742 if (are_layers_attached_) 759 if (are_layers_attached_)
743 RemoveLayers(); 760 RemoveLayers();
744 frame_provider_ = NULL; 761 frame_provider_ = NULL;
745 delegated_renderer_layer_ = NULL; 762 delegated_renderer_layer_ = NULL;
746 layer_ = NULL; 763 layer_ = NULL;
747 } 764 }
748 765
749 void RenderWidgetHostViewAndroid::SwapDelegatedFrame( 766 void RenderWidgetHostViewAndroid::SwapDelegatedFrame(
750 uint32 output_surface_id, 767 uint32 output_surface_id,
751 scoped_ptr<cc::DelegatedFrameData> frame_data) { 768 scoped_ptr<cc::DelegatedFrameData> frame_data) {
752 bool has_content = !texture_size_in_layer_.IsEmpty(); 769 bool has_content = !texture_size_in_layer_.IsEmpty();
753 770
754 if (output_surface_id != last_output_surface_id_) { 771 if (output_surface_id != last_output_surface_id_) {
755 // TODO(danakj): Lose all resources and send them back here, such as:
756 // resource_collection_->LoseAllResources();
757 // SendReturnedDelegatedResources(last_output_surface_id_);
758
759 // Drop the cc::DelegatedFrameResourceCollection so that we will not return 772 // Drop the cc::DelegatedFrameResourceCollection so that we will not return
760 // any resources from the old output surface with the new output surface id. 773 // any resources from the old output surface with the new output surface id.
761 if (resource_collection_.get()) { 774 if (resource_collection_.get()) {
775 if (resource_collection_->LoseAllResources())
776 SendReturnedDelegatedResources(last_output_surface_id_);
777
762 resource_collection_->SetClient(NULL); 778 resource_collection_->SetClient(NULL);
763 resource_collection_ = NULL; 779 resource_collection_ = NULL;
764 } 780 }
765 DestroyDelegatedContent(); 781 DestroyDelegatedContent();
766 782
767 last_output_surface_id_ = output_surface_id; 783 last_output_surface_id_ = output_surface_id;
768 } 784 }
769 785
770 if (!has_content) { 786 if (!has_content) {
771 DestroyDelegatedContent(); 787 DestroyDelegatedContent();
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 // RenderWidgetHostView, public: 1508 // RenderWidgetHostView, public:
1493 1509
1494 // static 1510 // static
1495 RenderWidgetHostView* 1511 RenderWidgetHostView*
1496 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { 1512 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) {
1497 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); 1513 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget);
1498 return new RenderWidgetHostViewAndroid(rwhi, NULL); 1514 return new RenderWidgetHostViewAndroid(rwhi, NULL);
1499 } 1515 }
1500 1516
1501 } // namespace content 1517 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698