| 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 <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 namespace content { | 30 namespace content { |
| 31 | 31 |
| 32 // static | 32 // static |
| 33 bool ContentViewRenderView::RegisterContentViewRenderView(JNIEnv* env) { | 33 bool ContentViewRenderView::RegisterContentViewRenderView(JNIEnv* env) { |
| 34 return RegisterNativesImpl(env); | 34 return RegisterNativesImpl(env); |
| 35 } | 35 } |
| 36 | 36 |
| 37 ContentViewRenderView::ContentViewRenderView(JNIEnv* env, | 37 ContentViewRenderView::ContentViewRenderView(JNIEnv* env, |
| 38 jobject obj, | 38 jobject obj, |
| 39 gfx::NativeWindow root_window) | 39 ui::ViewRoot* view_root) |
| 40 : root_window_(root_window), current_surface_format_(0) { | 40 : view_root_(view_root), current_surface_format_(0) { |
| 41 java_obj_.Reset(env, obj); | 41 java_obj_.Reset(env, obj); |
| 42 } | 42 } |
| 43 | 43 |
| 44 ContentViewRenderView::~ContentViewRenderView() { | 44 ContentViewRenderView::~ContentViewRenderView() { |
| 45 } | 45 } |
| 46 | 46 |
| 47 // static | 47 // static |
| 48 static jlong Init(JNIEnv* env, | 48 static jlong Init(JNIEnv* env, |
| 49 const JavaParamRef<jobject>& obj, | 49 const JavaParamRef<jobject>& obj, |
| 50 jlong native_root_window) { | 50 jlong native_view_root) { |
| 51 gfx::NativeWindow root_window = | 51 ui::ViewRoot* view_root = |
| 52 reinterpret_cast<gfx::NativeWindow>(native_root_window); | 52 reinterpret_cast<ui::ViewRoot*>(native_view_root); |
| 53 ContentViewRenderView* content_view_render_view = | 53 ContentViewRenderView* content_view_render_view = |
| 54 new ContentViewRenderView(env, obj, root_window); | 54 new ContentViewRenderView(env, obj, view_root); |
| 55 return reinterpret_cast<intptr_t>(content_view_render_view); | 55 return reinterpret_cast<intptr_t>(content_view_render_view); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void ContentViewRenderView::Destroy(JNIEnv* env, | 58 void ContentViewRenderView::Destroy(JNIEnv* env, |
| 59 const JavaParamRef<jobject>& obj) { | 59 const JavaParamRef<jobject>& obj) { |
| 60 delete this; | 60 delete this; |
| 61 } | 61 } |
| 62 | 62 |
| 63 void ContentViewRenderView::SetCurrentWebContents( | 63 void ContentViewRenderView::SetCurrentWebContents( |
| 64 JNIEnv* env, | 64 JNIEnv* env, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // Compositor related classes. | 110 // Compositor related classes. |
| 111 } | 111 } |
| 112 | 112 |
| 113 void ContentViewRenderView::OnSwapBuffersCompleted(int pending_swap_buffers) { | 113 void ContentViewRenderView::OnSwapBuffersCompleted(int pending_swap_buffers) { |
| 114 JNIEnv* env = base::android::AttachCurrentThread(); | 114 JNIEnv* env = base::android::AttachCurrentThread(); |
| 115 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_); | 115 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void ContentViewRenderView::InitCompositor() { | 118 void ContentViewRenderView::InitCompositor() { |
| 119 if (!compositor_) | 119 if (!compositor_) |
| 120 compositor_.reset(Compositor::Create(this, root_window_)); | 120 compositor_.reset(Compositor::Create(this, view_root_)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace content | 123 } // namespace content |
| OLD | NEW |