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

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

Issue 2918023002: Set cc::Display visibility to false when going to the background. (Closed)
Patch Set: Created 3 years, 6 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 | 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/compositor_impl_android.h" 5 #include "content/browser/renderer_host/compositor_impl_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <unordered_set> 10 #include <unordered_set>
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 TRACE_EVENT1("cc", "CompositorImpl::SetVisible", "visible", visible); 552 TRACE_EVENT1("cc", "CompositorImpl::SetVisible", "visible", visible);
553 if (!visible) { 553 if (!visible) {
554 DCHECK(host_->IsVisible()); 554 DCHECK(host_->IsVisible());
555 555
556 // Make a best effort to try to complete pending readbacks. 556 // Make a best effort to try to complete pending readbacks.
557 // TODO(crbug.com/637035): Consider doing this in a better way, 557 // TODO(crbug.com/637035): Consider doing this in a better way,
558 // ideally with the guarantee of readbacks completing. 558 // ideally with the guarantee of readbacks completing.
559 if (display_.get() && HavePendingReadbacks()) 559 if (display_.get() && HavePendingReadbacks())
560 display_->ForceImmediateDrawAndSwapIfPossible(); 560 display_->ForceImmediateDrawAndSwapIfPossible();
561 561
562 if (display_)
563 display_->SetVisible(false);
562 host_->SetVisible(false); 564 host_->SetVisible(false);
563 host_->ReleaseCompositorFrameSink(); 565 host_->ReleaseCompositorFrameSink();
564 has_compositor_frame_sink_ = false; 566 has_compositor_frame_sink_ = false;
565 pending_frames_ = 0; 567 pending_frames_ = 0;
566 display_.reset(); 568 display_.reset();
boliu 2017/06/02 00:30:35 we reset the display a few lines below, does this
567 } else { 569 } else {
570 if (display_)
571 display_->SetVisible(true);
568 host_->SetVisible(true); 572 host_->SetVisible(true);
569 if (compositor_frame_sink_request_pending_) 573 if (compositor_frame_sink_request_pending_)
570 HandlePendingCompositorFrameSinkRequest(); 574 HandlePendingCompositorFrameSinkRequest();
571 } 575 }
572 } 576 }
573 577
574 void CompositorImpl::SetWindowBounds(const gfx::Size& size) { 578 void CompositorImpl::SetWindowBounds(const gfx::Size& size) {
575 if (size_ == size) 579 if (size_ == size)
576 return; 580 return;
577 581
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 auto compositor_frame_sink = 792 auto compositor_frame_sink =
789 vulkan_context_provider 793 vulkan_context_provider
790 ? base::MakeUnique<cc::DirectCompositorFrameSink>( 794 ? base::MakeUnique<cc::DirectCompositorFrameSink>(
791 frame_sink_id_, manager, display_.get(), 795 frame_sink_id_, manager, display_.get(),
792 vulkan_context_provider) 796 vulkan_context_provider)
793 : base::MakeUnique<cc::DirectCompositorFrameSink>( 797 : base::MakeUnique<cc::DirectCompositorFrameSink>(
794 frame_sink_id_, manager, display_.get(), context_provider, 798 frame_sink_id_, manager, display_.get(), context_provider,
795 nullptr, BrowserGpuMemoryBufferManager::current(), 799 nullptr, BrowserGpuMemoryBufferManager::current(),
796 viz::HostSharedBitmapManager::current()); 800 viz::HostSharedBitmapManager::current());
797 801
798 display_->SetVisible(true); 802 display_->SetVisible(host_->IsVisible());
799 display_->Resize(size_); 803 display_->Resize(size_);
800 host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); 804 host_->SetCompositorFrameSink(std::move(compositor_frame_sink));
801 } 805 }
802 806
803 void CompositorImpl::DidSwapBuffers() { 807 void CompositorImpl::DidSwapBuffers() {
804 client_->DidSwapBuffers(); 808 client_->DidSwapBuffers();
805 } 809 }
806 810
807 cc::UIResourceId CompositorImpl::CreateUIResource( 811 cc::UIResourceId CompositorImpl::CreateUIResource(
808 cc::UIResourceClient* client) { 812 cc::UIResourceClient* client) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 } 885 }
882 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, 886 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_,
883 frame_sink_id); 887 frame_sink_id);
884 } 888 }
885 889
886 bool CompositorImpl::HavePendingReadbacks() { 890 bool CompositorImpl::HavePendingReadbacks() {
887 return !readback_layer_tree_->children().empty(); 891 return !readback_layer_tree_->children().empty();
888 } 892 }
889 893
890 } // namespace content 894 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698