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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 ContentViewCoreImpl* content_view = | 62 ContentViewCoreImpl* content_view = |
63 reinterpret_cast<ContentViewCoreImpl*>(native_content_view); | 63 reinterpret_cast<ContentViewCoreImpl*>(native_content_view); |
64 if (content_view) | 64 if (content_view) |
65 compositor_->SetRootLayer(content_view->GetLayer()); | 65 compositor_->SetRootLayer(content_view->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 current_surface_format_ = 0; |
72 InitCompositor(); | 73 InitCompositor(); |
73 } | 74 } |
74 | 75 |
75 void ContentViewRenderView::SurfaceDestroyed(JNIEnv* env, jobject obj) { | 76 void ContentViewRenderView::SurfaceDestroyed(JNIEnv* env, jobject obj) { |
76 compositor_->SetSurface(NULL); | 77 compositor_->SetSurface(NULL); |
77 current_surface_format_ = 0; | 78 current_surface_format_ = 0; |
78 } | 79 } |
79 | 80 |
80 void ContentViewRenderView::SurfaceChanged(JNIEnv* env, jobject obj, | 81 void ContentViewRenderView::SurfaceChanged(JNIEnv* env, jobject obj, |
81 jint format, jint width, jint height, jobject surface) { | 82 jint format, jint width, jint height, jobject surface) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 JNIEnv* env = base::android::AttachCurrentThread(); | 124 JNIEnv* env = base::android::AttachCurrentThread(); |
124 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); | 125 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); |
125 } | 126 } |
126 | 127 |
127 void ContentViewRenderView::InitCompositor() { | 128 void ContentViewRenderView::InitCompositor() { |
128 if (!compositor_) | 129 if (!compositor_) |
129 compositor_.reset(Compositor::Create(this, root_window_)); | 130 compositor_.reset(Compositor::Create(this, root_window_)); |
130 } | 131 } |
131 | 132 |
132 } // namespace content | 133 } // namespace content |
OLD | NEW |