| Index: content/shell/android/shell_manager.cc
|
| diff --git a/content/shell/android/shell_manager.cc b/content/shell/android/shell_manager.cc
|
| index 26c2240778ec4c646dbc8e0714a21555fc6cdf50..117c679f82ecbb5a59b465ff72fa7f4da207aa54 100644
|
| --- a/content/shell/android/shell_manager.cc
|
| +++ b/content/shell/android/shell_manager.cc
|
| @@ -12,41 +12,28 @@
|
| #include "content/shell/shell.h"
|
| #include "content/shell/shell_browser_context.h"
|
| #include "content/shell/shell_content_browser_client.h"
|
| -#include "content/public/browser/android/draw_delegate.h"
|
| -#include "content/public/browser/render_widget_host_view.h"
|
| +#include "content/public/browser/android/compositor.h"
|
| #include "content/public/browser/web_contents.h"
|
| -#include "content/shell/android/draw_context.h"
|
| #include "content/shell/shell.h"
|
| #include "googleurl/src/gurl.h"
|
| #include "jni/ShellManager_jni.h"
|
| +#include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h"
|
| #include "ui/gfx/size.h"
|
|
|
| #include <android/native_window_jni.h>
|
|
|
| using base::android::ScopedJavaLocalRef;
|
| -using content::DrawContext;
|
| -using content::DrawDelegate;
|
| +using content::Compositor;
|
|
|
| namespace {
|
|
|
| struct GlobalState {
|
| - GlobalState()
|
| - : context(NULL) {
|
| - }
|
| base::android::ScopedJavaGlobalRef<jobject> j_obj;
|
| - DrawContext* context;
|
| + WebKit::WebLayer root_layer;
|
| };
|
|
|
| base::LazyInstance<GlobalState> g_global_state = LAZY_INSTANCE_INITIALIZER;
|
|
|
| -static void SurfaceUpdated(
|
| - uint64 texture,
|
| - content::RenderWidgetHostView* view,
|
| - const DrawDelegate::SurfacePresentedCallback& callback) {
|
| - uint32 sync_point = g_global_state.Get().context->Draw(texture);
|
| - callback.Run(sync_point);
|
| -}
|
| -
|
| } // anonymous namespace
|
|
|
| namespace content {
|
| @@ -65,34 +52,28 @@ bool RegisterShellManager(JNIEnv* env) {
|
| static void Init(JNIEnv* env, jclass clazz, jobject obj) {
|
| g_global_state.Get().j_obj.Reset(
|
| base::android::ScopedJavaLocalRef<jobject>(env, obj));
|
| - DrawDelegate::SurfaceUpdatedCallback cb = base::Bind(
|
| - &SurfaceUpdated);
|
| - DrawDelegate::GetInstance()->SetUpdateCallback(cb);
|
| }
|
|
|
| static void SurfaceCreated(
|
| JNIEnv* env, jclass clazz, jobject jsurface) {
|
| ANativeWindow* native_window = ANativeWindow_fromSurface(env, jsurface);
|
| if (native_window) {
|
| - if (g_global_state.Get().context)
|
| - delete g_global_state.Get().context;
|
| -
|
| - g_global_state.Get().context = new DrawContext(native_window);
|
| + Compositor::GetInstance()->SetWindowSurface(native_window);
|
| ANativeWindow_release(native_window);
|
| + if (g_global_state.Get().root_layer.isNull())
|
| + g_global_state.Get().root_layer = WebKit::WebLayer::create();
|
| + Compositor::GetInstance()->SetRootLayer(g_global_state.Get().root_layer);
|
| }
|
| }
|
|
|
| static void SurfaceDestroyed(JNIEnv* env, jclass clazz) {
|
| - if (g_global_state.Get().context)
|
| - delete g_global_state.Get().context;
|
| + Compositor::GetInstance()->SetWindowSurface(NULL);
|
| }
|
|
|
| static void SurfaceSetSize(
|
| JNIEnv* env, jclass clazz, jint width, jint height) {
|
| gfx::Size size = gfx::Size(width, height);
|
| - DrawDelegate::GetInstance()->SetBounds(size);
|
| - DCHECK(g_global_state.Get().context);
|
| - g_global_state.Get().context->Reshape(width, height);
|
| + Compositor::GetInstance()->SetWindowBounds(size);
|
| }
|
|
|
| void LaunchShell(JNIEnv* env, jclass clazz, jstring jurl) {
|
| @@ -107,4 +88,13 @@ void LaunchShell(JNIEnv* env, jclass clazz, jstring jurl) {
|
| NULL);
|
| }
|
|
|
| +void ShellAttachLayer(WebKit::WebLayer& layer) {
|
| + g_global_state.Get().root_layer.addChild(layer);
|
| +}
|
| +
|
| +
|
| +void ShellRemoveLayer(WebKit::WebLayer& layer) {
|
| + layer.removeFromParent();
|
| +}
|
| +
|
| } // namespace content
|
|
|