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

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

Issue 2810813004: Hide fullscreen rotation jank (Closed)
Patch Set: Re-add feature flag Created 3 years, 5 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "components/viz/service/display_compositor/host_shared_bitmap_manager.h " 52 #include "components/viz/service/display_compositor/host_shared_bitmap_manager.h "
53 #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" 53 #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h"
54 #include "content/browser/compositor/surface_utils.h" 54 #include "content/browser/compositor/surface_utils.h"
55 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 55 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
56 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 56 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
57 #include "content/browser/gpu/compositor_util.h" 57 #include "content/browser/gpu/compositor_util.h"
58 #include "content/browser/renderer_host/render_widget_host_impl.h" 58 #include "content/browser/renderer_host/render_widget_host_impl.h"
59 #include "content/common/gpu_stream_constants.h" 59 #include "content/common/gpu_stream_constants.h"
60 #include "content/public/browser/android/compositor.h" 60 #include "content/public/browser/android/compositor.h"
61 #include "content/public/browser/android/compositor_client.h" 61 #include "content/public/browser/android/compositor_client.h"
62 #include "content/public/common/content_features.h"
62 #include "content/public/common/content_switches.h" 63 #include "content/public/common/content_switches.h"
63 #include "gpu/command_buffer/client/context_support.h" 64 #include "gpu/command_buffer/client/context_support.h"
64 #include "gpu/command_buffer/client/gles2_interface.h" 65 #include "gpu/command_buffer/client/gles2_interface.h"
65 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 66 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
66 #include "gpu/ipc/client/gpu_channel_host.h" 67 #include "gpu/ipc/client/gpu_channel_host.h"
67 #include "gpu/ipc/common/gpu_surface_tracker.h" 68 #include "gpu/ipc/common/gpu_surface_tracker.h"
68 #include "gpu/vulkan/features.h" 69 #include "gpu/vulkan/features.h"
69 #include "gpu/vulkan/vulkan_surface.h" 70 #include "gpu/vulkan/vulkan_surface.h"
70 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" 71 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h"
71 #include "third_party/khronos/GLES2/gl2.h" 72 #include "third_party/khronos/GLES2/gl2.h"
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 if (display_) 596 if (display_)
596 display_->Resize(size); 597 display_->Resize(size);
597 root_window_->GetLayer()->SetBounds(size); 598 root_window_->GetLayer()->SetBounds(size);
598 } 599 }
599 600
600 void CompositorImpl::SetHasTransparentBackground(bool transparent) { 601 void CompositorImpl::SetHasTransparentBackground(bool transparent) {
601 has_transparent_background_ = transparent; 602 has_transparent_background_ = transparent;
602 if (host_) { 603 if (host_) {
603 host_->set_has_transparent_background(transparent); 604 host_->set_has_transparent_background(transparent);
604 605
605 // Give a delay in setting the background color to avoid the color for 606 // TODO(steimel): Remove this feature flag and the hack inside this if block
606 // the normal mode (white) affecting the UI transition. 607 // once we're confident that the fullscreen transition hiding is working
607 base::ThreadTaskRunnerHandle::Get().get()->PostDelayedTask( 608 // properly.
608 FROM_HERE, 609 if (!base::FeatureList::IsEnabled(
609 base::Bind(&CompositorImpl::SetBackgroundColor, 610 features::kHideFullscreenTransitionJank)) {
610 weak_factory_.GetWeakPtr(), 611 base::ThreadTaskRunnerHandle::Get().get()->PostDelayedTask(
611 transparent ? SK_ColorBLACK : SK_ColorWHITE), 612 FROM_HERE,
612 base::TimeDelta::FromMilliseconds(500)); 613 base::Bind(&CompositorImpl::SetBackgroundColor,
614 weak_factory_.GetWeakPtr(),
615 transparent ? SK_ColorBLACK : SK_ColorWHITE),
616 base::TimeDelta::FromMilliseconds(500));
617 }
613 } 618 }
614 } 619 }
615 620
616 void CompositorImpl::SetBackgroundColor(int color) { 621 void CompositorImpl::SetBackgroundColor(int color) {
617 host_->set_background_color(color); 622 host_->set_background_color(color);
618 } 623 }
619 624
620 void CompositorImpl::SetNeedsComposite() { 625 void CompositorImpl::SetNeedsComposite() {
621 if (!host_->IsVisible()) 626 if (!host_->IsVisible())
622 return; 627 return;
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 } 911 }
907 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, 912 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_,
908 frame_sink_id); 913 frame_sink_id);
909 } 914 }
910 915
911 bool CompositorImpl::HavePendingReadbacks() { 916 bool CompositorImpl::HavePendingReadbacks() {
912 return !readback_layer_tree_->children().empty(); 917 return !readback_layer_tree_->children().empty();
913 } 918 }
914 919
915 } // namespace content 920 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698