| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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->GetLayer()); | 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 compositor_->SetSurface(jsurface); |
| 64 if (!native_window) | |
| 65 return; | |
| 66 | |
| 67 compositor_->SetWindowSurface(native_window); | |
| 68 ANativeWindow_release(native_window); | |
| 69 } | 64 } |
| 70 | 65 |
| 71 void ContentViewRenderView::SurfaceDestroyed(JNIEnv* env, jobject obj) { | 66 void ContentViewRenderView::SurfaceDestroyed(JNIEnv* env, jobject obj) { |
| 72 compositor_->SetWindowSurface(NULL); | 67 compositor_->SetWindowSurface(NULL); |
| 73 } | 68 } |
| 74 | 69 |
| 75 void ContentViewRenderView::SurfaceSetSize( | 70 void ContentViewRenderView::SurfaceSetSize( |
| 76 JNIEnv* env, jobject obj, jint width, jint height) { | 71 JNIEnv* env, jobject obj, jint width, jint height) { |
| 77 compositor_->SetWindowBounds(gfx::Size(width, height)); | 72 compositor_->SetWindowBounds(gfx::Size(width, height)); |
| 78 } | 73 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 95 | 90 |
| 96 void ContentViewRenderView::Composite() { | 91 void ContentViewRenderView::Composite() { |
| 97 if (!compositor_.get()) | 92 if (!compositor_.get()) |
| 98 return; | 93 return; |
| 99 | 94 |
| 100 scheduled_composite_ = false; | 95 scheduled_composite_ = false; |
| 101 compositor_->Composite(); | 96 compositor_->Composite(); |
| 102 } | 97 } |
| 103 | 98 |
| 104 } // namespace content | 99 } // namespace content |
| OLD | NEW |