Commit e8d81b35 authored by yusufo's avatar yusufo Committed by Commit bot

Add API to get the UIResourceProvider from ContentViewRenderView

To be able to use thumbnail store related code, we need to be able to
use UIResourceProviders in ContentViewRenderView. This add the necessary
API and pipes it to java.

BUG=404500
CQ_TRYBOTS=tryserver.chromium.linux:android_aosp,android_clang_dbg,android_dbg.

Review URL: https://codereview.chromium.org/493853005

Cr-Commit-Position: refs/heads/master@{#292184}
parent d7de03c4
......@@ -16,6 +16,7 @@
#include "content/public/browser/android/compositor.h"
#include "content/public/browser/android/content_view_layer_renderer.h"
#include "content/public/browser/android/layer_tree_build_helper.h"
#include "content/public/browser/android/ui_resource_provider.h"
#include "jni/ContentViewRenderView_jni.h"
#include "ui/gfx/android/java_bitmap.h"
#include "ui/gfx/size.h"
......@@ -70,6 +71,7 @@ void ContentViewRenderView::SetLayerTreeBuildHelper(JNIEnv* env,
LayerTreeBuildHelper* build_helper =
reinterpret_cast<LayerTreeBuildHelper*>(native_build_helper);
layer_tree_build_helper_.reset(build_helper);
InitCompositor();
}
// static
static jlong Init(JNIEnv* env,
......@@ -142,4 +144,11 @@ void ContentViewRenderView::InitCompositor() {
if (!compositor_)
compositor_.reset(Compositor::Create(this, root_window_));
}
jlong ContentViewRenderView::GetUIResourceProvider(JNIEnv* env,
jobject obj) {
if (!compositor_)
return 0;
return reinterpret_cast<intptr_t>(&compositor_->GetUIResourceProvider());
}
} // namespace content
......@@ -19,6 +19,7 @@ class Layer;
namespace content {
class Compositor;
class LayerTreeBuildHelper;
class UIResourceProvider;
class ContentViewRenderView : public CompositorClient {
public:
......@@ -43,6 +44,10 @@ class ContentViewRenderView : public CompositorClient {
void SetOverlayVideoMode(JNIEnv* env, jobject obj, bool enabled);
void SetNeedsComposite(JNIEnv* env, jobject obj);
// TODO(yusufo): Remove this once the compositor code is
// refactored to use a unified system.
jlong GetUIResourceProvider(JNIEnv* env, jobject obj);
// CompositorClient implementation
virtual void Layout() OVERRIDE;
virtual void OnSwapBuffersCompleted(int pending_swap_buffers) OVERRIDE;
......
......@@ -213,7 +213,15 @@ public class ContentViewRenderView extends FrameLayout {
}
}
/**
* @return Native pointer for the UI resource provider taken from the compositor.
*/
public long getUIResourceProvider() {
return nativeGetUIResourceProvider(mNativeContentViewRenderView);
}
private native long nativeInit(long rootWindowNativePointer);
private native long nativeGetUIResourceProvider(long nativeContentViewRenderView);
private native void nativeDestroy(long nativeContentViewRenderView);
private native void nativeSetCurrentContentViewCore(long nativeContentViewRenderView,
long nativeContentViewCore);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment