| 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" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 reinterpret_cast<gfx::NativeWindow>(native_root_window); | 49 reinterpret_cast<gfx::NativeWindow>(native_root_window); |
| 50 ContentViewRenderView* content_view_render_view = | 50 ContentViewRenderView* content_view_render_view = |
| 51 new ContentViewRenderView(env, obj, root_window); | 51 new ContentViewRenderView(env, obj, root_window); |
| 52 return reinterpret_cast<intptr_t>(content_view_render_view); | 52 return reinterpret_cast<intptr_t>(content_view_render_view); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void ContentViewRenderView::Destroy(JNIEnv* env, jobject obj) { | 55 void ContentViewRenderView::Destroy(JNIEnv* env, jobject obj) { |
| 56 delete this; | 56 delete this; |
| 57 } | 57 } |
| 58 | 58 |
| 59 void ContentViewRenderView::SetCurrentContentView( | 59 void ContentViewRenderView::SetCurrentContentViewCore( |
| 60 JNIEnv* env, jobject obj, jlong native_content_view) { | 60 JNIEnv* env, jobject obj, jlong native_content_view_core) { |
| 61 InitCompositor(); | 61 InitCompositor(); |
| 62 ContentViewCoreImpl* content_view = | 62 ContentViewCoreImpl* content_view_core = |
| 63 reinterpret_cast<ContentViewCoreImpl*>(native_content_view); | 63 reinterpret_cast<ContentViewCoreImpl*>(native_content_view_core); |
| 64 if (content_view) | 64 if (content_view_core) |
| 65 compositor_->SetRootLayer(content_view->GetLayer()); | 65 compositor_->SetRootLayer(content_view_core->GetLayer()); |
| 66 else | 66 else |
| 67 compositor_->SetRootLayer(cc::Layer::Create()); | 67 compositor_->SetRootLayer(cc::Layer::Create()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void ContentViewRenderView::SurfaceCreated( | 70 void ContentViewRenderView::SurfaceCreated( |
| 71 JNIEnv* env, jobject obj) { | 71 JNIEnv* env, jobject obj) { |
| 72 InitCompositor(); | 72 InitCompositor(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void ContentViewRenderView::SurfaceDestroyed(JNIEnv* env, jobject obj) { | 75 void ContentViewRenderView::SurfaceDestroyed(JNIEnv* env, jobject obj) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 JNIEnv* env = base::android::AttachCurrentThread(); | 123 JNIEnv* env = base::android::AttachCurrentThread(); |
| 124 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); | 124 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void ContentViewRenderView::InitCompositor() { | 127 void ContentViewRenderView::InitCompositor() { |
| 128 if (!compositor_) | 128 if (!compositor_) |
| 129 compositor_.reset(Compositor::Create(this, root_window_)); | 129 compositor_.reset(Compositor::Create(this, root_window_)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace content | 132 } // namespace content |
| OLD | NEW |