diff options
author | powei@chromium.org <powei@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-24 05:22:58 +0000 |
---|---|---|
committer | powei@chromium.org <powei@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-24 05:22:58 +0000 |
commit | df792f11766f5e680044eea48da04a774f177c5b (patch) | |
tree | 671270b1a33f120acad6a1e98ba7bbc202b79208 /ui/base | |
parent | 798c6c50c2b70b11576060f22499061f4e154bc8 (diff) | |
download | chromium_src-df792f11766f5e680044eea48da04a774f177c5b.zip chromium_src-df792f11766f5e680044eea48da04a774f177c5b.tar.gz chromium_src-df792f11766f5e680044eea48da04a774f177c5b.tar.bz2 |
Merge 258167 "android: Readback using delegated rendering layer"
> android: Readback using delegated rendering layer
>
> Using a separate delegated rendering layer for readback allows us to keep the
> readback layer from being displayed. This in turn allows us to clip the content
> layer associated with RWHVAndroid when necessary.
>
> android= https://chrome-internal-review.googlesource.com/157016
> BUG=344720
>
> Review URL: https://codereview.chromium.org/197913002
TBR=powei@chromium.org
BUG=344720
Review URL: https://codereview.chromium.org/208653007
git-svn-id: svn://svn.chromium.org/chrome/branches/1847/src@258878 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base')
-rw-r--r-- | ui/base/android/window_android.cc | 11 | ||||
-rw-r--r-- | ui/base/android/window_android.h | 6 | ||||
-rw-r--r-- | ui/base/android/window_android_compositor.h | 26 |
3 files changed, 40 insertions, 3 deletions
diff --git a/ui/base/android/window_android.cc b/ui/base/android/window_android.cc index bacf023..916e821 100644 --- a/ui/base/android/window_android.cc +++ b/ui/base/android/window_android.cc @@ -9,6 +9,7 @@ #include "base/android/jni_helper.h" #include "base/android/scoped_java_ref.h" #include "jni/WindowAndroid_jni.h" +#include "ui/base/android/window_android_compositor.h" #include "ui/base/android/window_android_observer.h" namespace ui { @@ -17,7 +18,8 @@ using base::android::AttachCurrentThread; using base::android::ScopedJavaLocalRef; WindowAndroid::WindowAndroid(JNIEnv* env, jobject obj) - : weak_java_window_(env, obj) { + : weak_java_window_(env, obj), + compositor_(NULL) { } void WindowAndroid::Destroy(JNIEnv* env, jobject obj) { @@ -66,13 +68,18 @@ void WindowAndroid::RemoveObserver(WindowAndroidObserver* observer) { observer_list_.RemoveObserver(observer); } -void WindowAndroid::AttachCompositor() { +void WindowAndroid::AttachCompositor(WindowAndroidCompositor* compositor) { + if (compositor_ && compositor != compositor_) + DetachCompositor(); + + compositor_ = compositor; FOR_EACH_OBSERVER(WindowAndroidObserver, observer_list_, OnAttachCompositor()); } void WindowAndroid::DetachCompositor() { + compositor_ = NULL; FOR_EACH_OBSERVER(WindowAndroidObserver, observer_list_, OnDetachCompositor()); diff --git a/ui/base/android/window_android.h b/ui/base/android/window_android.h index 5e6532e..2563679 100644 --- a/ui/base/android/window_android.h +++ b/ui/base/android/window_android.h @@ -15,6 +15,7 @@ namespace ui { +class WindowAndroidCompositor; class WindowAndroidObserver; // Android implementation of the activity window. @@ -40,17 +41,20 @@ class UI_BASE_EXPORT WindowAndroid { // Compositor callback relay. void OnCompositingDidCommit(); - void AttachCompositor(); + void AttachCompositor(WindowAndroidCompositor* compositor); void DetachCompositor(); void AddObserver(WindowAndroidObserver* observer); void RemoveObserver(WindowAndroidObserver* observer); + WindowAndroidCompositor* GetCompositor() { return compositor_; } + private: ~WindowAndroid(); JavaObjectWeakGlobalRef weak_java_window_; gfx::Vector2dF content_offset_; + WindowAndroidCompositor* compositor_; ObserverList<WindowAndroidObserver> observer_list_; diff --git a/ui/base/android/window_android_compositor.h b/ui/base/android/window_android_compositor.h new file mode 100644 index 0000000..8f219fa --- /dev/null +++ b/ui/base/android/window_android_compositor.h @@ -0,0 +1,26 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_BASE_ANDROID_WINDOW_ANDROID_COMPOSITOR_H_ +#define UI_BASE_ANDROID_WINDOW_ANDROID_COMPOSITOR_H_ + +#include "ui/base/ui_base_export.h" + +namespace cc { +class Layer; +} + +namespace ui { + +// Android interface for compositor-related tasks. +class UI_BASE_EXPORT WindowAndroidCompositor { + public: + virtual ~WindowAndroidCompositor() {} + + virtual void AttachLayerForReadback(scoped_refptr<cc::Layer> layer) = 0; +}; + +} // namespace ui + +#endif // UI_BASE_ANDROID_WINDOW_ANDROID_COMPOSITOR_H_ |