| 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 "cc/layer.h" |
| 14 #include "content/browser/android/content_view_core_impl.h" | 15 #include "content/browser/android/content_view_core_impl.h" |
| 15 #include "content/public/browser/android/compositor.h" | 16 #include "content/public/browser/android/compositor.h" |
| 16 #include "content/public/browser/android/content_view_layer_renderer.h" | 17 #include "content/public/browser/android/content_view_layer_renderer.h" |
| 17 #include "jni/ContentViewRenderView_jni.h" | 18 #include "jni/ContentViewRenderView_jni.h" |
| 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" | |
| 19 #include "ui/gfx/size.h" | 19 #include "ui/gfx/size.h" |
| 20 | 20 |
| 21 #include <android/native_window_jni.h> | 21 #include <android/native_window_jni.h> |
| 22 | 22 |
| 23 using base::android::ScopedJavaLocalRef; | 23 using base::android::ScopedJavaLocalRef; |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 | 26 |
| 27 // static | 27 // static |
| 28 bool ContentViewRenderView::RegisterContentViewRenderView(JNIEnv* env) { | 28 bool ContentViewRenderView::RegisterContentViewRenderView(JNIEnv* env) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 47 void ContentViewRenderView::Destroy(JNIEnv* env, jobject obj) { | 47 void ContentViewRenderView::Destroy(JNIEnv* env, jobject obj) { |
| 48 delete this; | 48 delete this; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void ContentViewRenderView::SetCurrentContentView( | 51 void ContentViewRenderView::SetCurrentContentView( |
| 52 JNIEnv* env, jobject obj, int native_content_view) { | 52 JNIEnv* env, jobject obj, int native_content_view) { |
| 53 InitCompositor(); | 53 InitCompositor(); |
| 54 ContentViewCoreImpl* content_view = | 54 ContentViewCoreImpl* content_view = |
| 55 reinterpret_cast<ContentViewCoreImpl*>(native_content_view); | 55 reinterpret_cast<ContentViewCoreImpl*>(native_content_view); |
| 56 if (content_view) | 56 if (content_view) |
| 57 compositor_->SetRootLayer(content_view->GetWebLayer()); | 57 compositor_->SetRootLayer(content_view->GetLayer()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void ContentViewRenderView::SurfaceCreated( | 60 void ContentViewRenderView::SurfaceCreated( |
| 61 JNIEnv* env, jobject obj, jobject jsurface) { | 61 JNIEnv* env, jobject obj, jobject jsurface) { |
| 62 InitCompositor(); | 62 InitCompositor(); |
| 63 ANativeWindow* native_window = ANativeWindow_fromSurface(env, jsurface); | 63 ANativeWindow* native_window = ANativeWindow_fromSurface(env, jsurface); |
| 64 if (!native_window) | 64 if (!native_window) |
| 65 return; | 65 return; |
| 66 | 66 |
| 67 compositor_->SetWindowSurface(native_window); | 67 compositor_->SetWindowSurface(native_window); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 95 | 95 |
| 96 void ContentViewRenderView::Composite() { | 96 void ContentViewRenderView::Composite() { |
| 97 if (!compositor_.get()) | 97 if (!compositor_.get()) |
| 98 return; | 98 return; |
| 99 | 99 |
| 100 scheduled_composite_ = false; | 100 scheduled_composite_ = false; |
| 101 compositor_->Composite(); | 101 compositor_->Composite(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace content | 104 } // namespace content |
| OLD | NEW |