OLD | NEW |
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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 if (!visible) { | 519 if (!visible) { |
520 DCHECK(host_->visible()); | 520 DCHECK(host_->visible()); |
521 | 521 |
522 // Make a best effort to try to complete pending readbacks. | 522 // Make a best effort to try to complete pending readbacks. |
523 // TODO(crbug.com/637035): Consider doing this in a better way, | 523 // TODO(crbug.com/637035): Consider doing this in a better way, |
524 // ideally with the guarantee of readbacks completing. | 524 // ideally with the guarantee of readbacks completing. |
525 if (display_.get() && HavePendingReadbacks()) | 525 if (display_.get() && HavePendingReadbacks()) |
526 display_->ForceImmediateDrawAndSwapIfPossible(); | 526 display_->ForceImmediateDrawAndSwapIfPossible(); |
527 | 527 |
528 host_->SetVisible(false); | 528 host_->SetVisible(false); |
529 if (!host_->output_surface_lost()) | 529 host_->ReleaseOutputSurface(); |
530 host_->ReleaseOutputSurface(); | |
531 pending_swapbuffers_ = 0; | 530 pending_swapbuffers_ = 0; |
532 display_.reset(); | 531 display_.reset(); |
533 } else { | 532 } else { |
534 host_->SetVisible(true); | 533 host_->SetVisible(true); |
535 if (output_surface_request_pending_) | 534 if (output_surface_request_pending_) |
536 HandlePendingOutputSurfaceRequest(); | 535 HandlePendingOutputSurfaceRequest(); |
537 } | 536 } |
538 } | 537 } |
539 | 538 |
540 void CompositorImpl::setDeviceScaleFactor(float factor) { | 539 void CompositorImpl::setDeviceScaleFactor(float factor) { |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 | 794 |
796 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); | 795 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); |
797 host_->SetNeedsAnimate(); | 796 host_->SetNeedsAnimate(); |
798 } | 797 } |
799 | 798 |
800 bool CompositorImpl::HavePendingReadbacks() { | 799 bool CompositorImpl::HavePendingReadbacks() { |
801 return !readback_layer_tree_->children().empty(); | 800 return !readback_layer_tree_->children().empty(); |
802 } | 801 } |
803 | 802 |
804 } // namespace content | 803 } // namespace content |
OLD | NEW |