| OLD | NEW |
| 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/android/content_view_render_view.h" | 5 #include "content/browser/android/content_view_render_view.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "content/public/browser/android/compositor.h" | 14 #include "content/public/browser/android/compositor.h" |
| 15 #include "content/public/browser/android/content_view_layer_renderer.h" | 15 #include "content/public/browser/android/content_view_layer_renderer.h" |
| 16 #include "content/public/browser/android/draw_delegate.h" | 16 #include "content/public/browser/android/draw_delegate.h" |
| 17 #include "jni/ContentViewRenderView_jni.h" | 17 #include "jni/ContentViewRenderView_jni.h" |
| 18 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" |
| 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorSuppor
t.h" |
| 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" | 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" |
| 19 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
| 20 | 22 |
| 21 #include <android/native_window_jni.h> | 23 #include <android/native_window_jni.h> |
| 22 | 24 |
| 23 using base::android::ScopedJavaLocalRef; | 25 using base::android::ScopedJavaLocalRef; |
| 24 using base::android::ScopedJavaGlobalRef; | 26 using base::android::ScopedJavaGlobalRef; |
| 25 using content::Compositor; | 27 using content::Compositor; |
| 26 using content::DrawDelegate; | 28 using content::DrawDelegate; |
| 27 | 29 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 85 } |
| 84 | 86 |
| 85 void InitCompositor() { | 87 void InitCompositor() { |
| 86 if (GetCompositor()) | 88 if (GetCompositor()) |
| 87 return; | 89 return; |
| 88 | 90 |
| 89 Compositor::Initialize(); | 91 Compositor::Initialize(); |
| 90 g_global_state.Get().compositor.reset( | 92 g_global_state.Get().compositor.reset( |
| 91 Compositor::Create(&g_global_state.Get().client)); | 93 Compositor::Create(&g_global_state.Get().client)); |
| 92 DCHECK(!g_global_state.Get().root_layer.get()); | 94 DCHECK(!g_global_state.Get().root_layer.get()); |
| 93 g_global_state.Get().root_layer.reset(WebKit::WebLayer::create()); | 95 g_global_state.Get().root_layer.reset( |
| 96 WebKit::Platform::current()->compositorSupport()->createLayer()); |
| 94 g_global_state.Get().layer_renderer.reset(new ContentViewLayerRendererImpl()); | 97 g_global_state.Get().layer_renderer.reset(new ContentViewLayerRendererImpl()); |
| 95 } | 98 } |
| 96 | 99 |
| 97 } // anonymous namespace | 100 } // anonymous namespace |
| 98 | 101 |
| 99 namespace content { | 102 namespace content { |
| 100 | 103 |
| 101 // Register native methods | 104 // Register native methods |
| 102 bool RegisterContentViewRenderView(JNIEnv* env) { | 105 bool RegisterContentViewRenderView(JNIEnv* env) { |
| 103 return RegisterNativesImpl(env); | 106 return RegisterNativesImpl(env); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 132 } | 135 } |
| 133 | 136 |
| 134 static void SurfaceSetSize( | 137 static void SurfaceSetSize( |
| 135 JNIEnv* env, jclass clazz, jint width, jint height) { | 138 JNIEnv* env, jclass clazz, jint width, jint height) { |
| 136 gfx::Size size = gfx::Size(width, height); | 139 gfx::Size size = gfx::Size(width, height); |
| 137 DrawDelegate::GetInstance()->SetBounds(size); | 140 DrawDelegate::GetInstance()->SetBounds(size); |
| 138 GetCompositor()->SetWindowBounds(size); | 141 GetCompositor()->SetWindowBounds(size); |
| 139 } | 142 } |
| 140 | 143 |
| 141 } // namespace content | 144 } // namespace content |
| OLD | NEW |