Chromium Code Reviews| 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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 592 host_->SetViewportSize(size); | 592 host_->SetViewportSize(size); |
| 593 if (display_) | 593 if (display_) |
| 594 display_->Resize(size); | 594 display_->Resize(size); |
| 595 root_window_->GetLayer()->SetBounds(size); | 595 root_window_->GetLayer()->SetBounds(size); |
| 596 } | 596 } |
| 597 | 597 |
| 598 void CompositorImpl::SetHasTransparentBackground(bool transparent) { | 598 void CompositorImpl::SetHasTransparentBackground(bool transparent) { |
| 599 has_transparent_background_ = transparent; | 599 has_transparent_background_ = transparent; |
| 600 if (host_) { | 600 if (host_) { |
| 601 host_->set_has_transparent_background(transparent); | 601 host_->set_has_transparent_background(transparent); |
| 602 | 602 // TODO(steimel): Set the color based on the color of the renderer frame. |
|
aelias_OOO_until_Jul13
2017/06/16 22:46:40
This is done in OnFrameMetadataUpdated right now.
steimel
2017/06/22 01:32:11
Done.
| |
| 603 // Give a delay in setting the background color to avoid the color for | 603 SetBackgroundColor(transparent ? SK_ColorBLACK : SK_ColorWHITE); |
| 604 // the normal mode (white) affecting the UI transition. | |
| 605 base::ThreadTaskRunnerHandle::Get().get()->PostDelayedTask( | |
| 606 FROM_HERE, | |
| 607 base::Bind(&CompositorImpl::SetBackgroundColor, | |
| 608 weak_factory_.GetWeakPtr(), | |
| 609 transparent ? SK_ColorBLACK : SK_ColorWHITE), | |
| 610 base::TimeDelta::FromMilliseconds(500)); | |
| 611 } | 604 } |
| 612 } | 605 } |
| 613 | 606 |
| 614 void CompositorImpl::SetBackgroundColor(int color) { | 607 void CompositorImpl::SetBackgroundColor(int color) { |
| 615 host_->set_background_color(color); | 608 host_->set_background_color(color); |
| 616 } | 609 } |
| 617 | 610 |
| 618 void CompositorImpl::SetNeedsComposite() { | 611 void CompositorImpl::SetNeedsComposite() { |
| 619 if (!host_->IsVisible()) | 612 if (!host_->IsVisible()) |
| 620 return; | 613 return; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 897 } | 890 } |
| 898 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, | 891 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, |
| 899 frame_sink_id); | 892 frame_sink_id); |
| 900 } | 893 } |
| 901 | 894 |
| 902 bool CompositorImpl::HavePendingReadbacks() { | 895 bool CompositorImpl::HavePendingReadbacks() { |
| 903 return !readback_layer_tree_->children().empty(); | 896 return !readback_layer_tree_->children().empty(); |
| 904 } | 897 } |
| 905 | 898 |
| 906 } // namespace content | 899 } // namespace content |
| OLD | NEW |