OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/android/compositor/compositor_view.h" | 5 #include "chrome/browser/android/compositor/compositor_view.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 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "cc/layers/solid_color_layer.h" | 22 #include "cc/layers/solid_color_layer.h" |
23 #include "cc/layers/texture_layer.h" | 23 #include "cc/layers/texture_layer.h" |
24 #include "chrome/browser/android/compositor/layer/toolbar_layer.h" | 24 #include "chrome/browser/android/compositor/layer/toolbar_layer.h" |
25 #include "chrome/browser/android/compositor/layer_title_cache.h" | 25 #include "chrome/browser/android/compositor/layer_title_cache.h" |
26 #include "chrome/browser/android/compositor/scene_layer/scene_layer.h" | 26 #include "chrome/browser/android/compositor/scene_layer/scene_layer.h" |
27 #include "chrome/browser/android/compositor/tab_content_manager.h" | 27 #include "chrome/browser/android/compositor/tab_content_manager.h" |
28 #include "content/public/browser/android/compositor.h" | 28 #include "content/public/browser/android/compositor.h" |
29 #include "content/public/browser/android/content_view_core.h" | 29 #include "content/public/browser/android/content_view_core.h" |
30 #include "content/public/browser/child_process_data.h" | 30 #include "content/public/browser/child_process_data.h" |
31 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
| 32 #include "content/public/common/content_features.h" |
32 #include "content/public/common/process_type.h" | 33 #include "content/public/common/process_type.h" |
33 #include "jni/CompositorView_jni.h" | 34 #include "jni/CompositorView_jni.h" |
34 #include "third_party/skia/include/core/SkBitmap.h" | 35 #include "third_party/skia/include/core/SkBitmap.h" |
35 #include "ui/android/resources/resource_manager.h" | 36 #include "ui/android/resources/resource_manager.h" |
36 #include "ui/android/resources/ui_resource_provider.h" | 37 #include "ui/android/resources/ui_resource_provider.h" |
37 #include "ui/android/window_android.h" | 38 #include "ui/android/window_android.h" |
38 #include "ui/gfx/android/java_bitmap.h" | 39 #include "ui/gfx/android/java_bitmap.h" |
39 | 40 |
40 using base::android::JavaParamRef; | 41 using base::android::JavaParamRef; |
41 | 42 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 gfx::Size size(width, height); | 179 gfx::Size size(width, height); |
179 web_contents->GetNativeView()->OnPhysicalBackingSizeChanged(size); | 180 web_contents->GetNativeView()->OnPhysicalBackingSizeChanged(size); |
180 } | 181 } |
181 | 182 |
182 void CompositorView::SetLayoutBounds(JNIEnv* env, | 183 void CompositorView::SetLayoutBounds(JNIEnv* env, |
183 const JavaParamRef<jobject>& object) { | 184 const JavaParamRef<jobject>& object) { |
184 root_layer_->SetBounds(gfx::Size(content_width_, content_height_)); | 185 root_layer_->SetBounds(gfx::Size(content_width_, content_height_)); |
185 } | 186 } |
186 | 187 |
187 void CompositorView::SetBackground(bool visible, SkColor color) { | 188 void CompositorView::SetBackground(bool visible, SkColor color) { |
188 if (overlay_video_mode_) | 189 // TODO(steimel): Remove this feature flag and the hack inside this if block |
| 190 // once we're confident that the fullscreen transition hiding is working |
| 191 // properly. |
| 192 if (!base::FeatureList::IsEnabled(features::kHideFullscreenTransitionJank) && |
| 193 overlay_video_mode_) { |
189 visible = false; | 194 visible = false; |
| 195 } |
190 root_layer_->SetBackgroundColor(color); | 196 root_layer_->SetBackgroundColor(color); |
191 root_layer_->SetIsDrawable(visible); | 197 root_layer_->SetIsDrawable(visible); |
| 198 // TODO(steimel): Remove this feature flag check once we're confident that the |
| 199 // fullscreen transition hiding is working properly. |
| 200 if (base::FeatureList::IsEnabled(features::kHideFullscreenTransitionJank)) { |
| 201 compositor_->SetBackgroundColor(color); |
| 202 compositor_->SetHasTransparentBackground(SkColorGetA(color) == |
| 203 SK_AlphaTRANSPARENT); |
| 204 } |
192 } | 205 } |
193 | 206 |
194 void CompositorView::SetOverlayVideoMode(JNIEnv* env, | 207 void CompositorView::SetOverlayVideoMode(JNIEnv* env, |
195 const JavaParamRef<jobject>& object, | 208 const JavaParamRef<jobject>& object, |
196 bool enabled) { | 209 bool enabled) { |
197 if (overlay_video_mode_ == enabled) | 210 if (overlay_video_mode_ == enabled) |
198 return; | 211 return; |
199 overlay_video_mode_ = enabled; | 212 overlay_video_mode_ = enabled; |
200 compositor_->SetHasTransparentBackground(enabled); | 213 // TODO(steimel): Remove this feature flag and the hack inside this if block |
| 214 // once we're confident that the fullscreen transition hiding is working |
| 215 // properly. |
| 216 if (!base::FeatureList::IsEnabled(features::kHideFullscreenTransitionJank)) { |
| 217 compositor_->SetHasTransparentBackground(enabled); |
| 218 } |
201 SetNeedsComposite(env, object); | 219 SetNeedsComposite(env, object); |
202 } | 220 } |
203 | 221 |
204 void CompositorView::SetSceneLayer(JNIEnv* env, | 222 void CompositorView::SetSceneLayer(JNIEnv* env, |
205 const JavaParamRef<jobject>& object, | 223 const JavaParamRef<jobject>& object, |
206 const JavaParamRef<jobject>& jscene_layer) { | 224 const JavaParamRef<jobject>& jscene_layer) { |
207 SceneLayer* scene_layer = SceneLayer::FromJavaObject(env, jscene_layer); | 225 SceneLayer* scene_layer = SceneLayer::FromJavaObject(env, jscene_layer); |
208 | 226 |
209 if (scene_layer_ != scene_layer) { | 227 if (scene_layer_ != scene_layer) { |
210 // The old tree should be detached only if it is not the cached layer or | 228 // The old tree should be detached only if it is not the cached layer or |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // The Android TERMINATION_STATUS_OOM_PROTECTED hack causes us to never go | 288 // The Android TERMINATION_STATUS_OOM_PROTECTED hack causes us to never go |
271 // through here but through BrowserChildProcessHostDisconnected() instead. | 289 // through here but through BrowserChildProcessHostDisconnected() instead. |
272 } | 290 } |
273 | 291 |
274 // Register native methods | 292 // Register native methods |
275 bool RegisterCompositorView(JNIEnv* env) { | 293 bool RegisterCompositorView(JNIEnv* env) { |
276 return RegisterNativesImpl(env); | 294 return RegisterNativesImpl(env); |
277 } | 295 } |
278 | 296 |
279 } // namespace android | 297 } // namespace android |
OLD | NEW |