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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 static jlong Init(JNIEnv* env, | 45 static jlong Init(JNIEnv* env, |
46 const JavaParamRef<jobject>& obj, | 46 const JavaParamRef<jobject>& obj, |
47 jlong native_root_window) { | 47 jlong native_root_window) { |
48 gfx::NativeWindow root_window = | 48 gfx::NativeWindow root_window = |
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, | |
56 const JavaParamRef<jobject>& obj) { | |
57 delete this; | |
58 } | |
59 | |
60 void ContentViewRenderView::SetCurrentContentViewCore( | 55 void ContentViewRenderView::SetCurrentContentViewCore( |
61 JNIEnv* env, | 56 JNIEnv* env, |
62 const JavaParamRef<jobject>& obj, | 57 const JavaParamRef<jobject>& obj, |
63 jlong native_content_view_core) { | 58 jlong native_content_view_core) { |
64 InitCompositor(); | 59 InitCompositor(); |
65 ContentViewCoreImpl* content_view_core = | 60 ContentViewCoreImpl* content_view_core = |
66 reinterpret_cast<ContentViewCoreImpl*>(native_content_view_core); | 61 reinterpret_cast<ContentViewCoreImpl*>(native_content_view_core); |
67 compositor_->SetRootLayer(content_view_core ? content_view_core->GetLayer() | 62 compositor_->SetRootLayer(content_view_core ? content_view_core->GetLayer() |
68 : scoped_refptr<cc::Layer>()); | 63 : scoped_refptr<cc::Layer>()); |
69 } | 64 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 void ContentViewRenderView::OnSwapBuffersCompleted(int pending_swap_buffers) { | 112 void ContentViewRenderView::OnSwapBuffersCompleted(int pending_swap_buffers) { |
118 JNIEnv* env = base::android::AttachCurrentThread(); | 113 JNIEnv* env = base::android::AttachCurrentThread(); |
119 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); | 114 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); |
120 } | 115 } |
121 | 116 |
122 void ContentViewRenderView::InitCompositor() { | 117 void ContentViewRenderView::InitCompositor() { |
123 if (!compositor_) | 118 if (!compositor_) |
124 compositor_.reset(Compositor::Create(this, root_window_)); | 119 compositor_.reset(Compositor::Create(this, root_window_)); |
125 } | 120 } |
126 | 121 |
127 jlong ContentViewRenderView::GetUIResourceProvider( | |
128 JNIEnv* env, | |
129 const JavaParamRef<jobject>& obj) { | |
130 if (!compositor_) | |
131 return 0; | |
132 return reinterpret_cast<intptr_t>(&compositor_->GetUIResourceProvider()); | |
133 } | |
134 } // namespace content | 122 } // namespace content |
OLD | NEW |