OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "sky/shell/platform_view.h" | 5 #include "sky/shell/platform_view.h" |
6 | 6 |
7 #include <android/input.h> | 7 #include <android/input.h> |
8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 void PlatformView::SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface) { | 53 void PlatformView::SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface) { |
54 base::android::ScopedJavaLocalRef<jobject> protector(env, jsurface); | 54 base::android::ScopedJavaLocalRef<jobject> protector(env, jsurface); |
55 // Note: This ensures that any local references used by | 55 // Note: This ensures that any local references used by |
56 // ANativeWindow_fromSurface are released immediately. This is needed as a | 56 // ANativeWindow_fromSurface are released immediately. This is needed as a |
57 // workaround for https://code.google.com/p/android/issues/detail?id=68174 | 57 // workaround for https://code.google.com/p/android/issues/detail?id=68174 |
58 { | 58 { |
59 base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); | 59 base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); |
60 window_ = ANativeWindow_fromSurface(env, jsurface); | 60 window_ = ANativeWindow_fromSurface(env, jsurface); |
61 } | 61 } |
62 config_.gpu_task_runner->PostTask( | 62 config_.ui_task_runner->PostTask( |
63 FROM_HERE, base::Bind(&GPUDelegate::OnAcceleratedWidgetAvailable, | 63 FROM_HERE, base::Bind(&UIDelegate::OnAcceleratedWidgetAvailable, |
64 config_.gpu_delegate, window_)); | 64 config_.ui_delegate, window_)); |
65 } | 65 } |
66 | 66 |
67 void PlatformView::SurfaceDestroyed(JNIEnv* env, jobject obj) { | 67 void PlatformView::SurfaceDestroyed(JNIEnv* env, jobject obj) { |
68 DCHECK(window_); | 68 DCHECK(window_); |
69 config_.gpu_task_runner->PostTask( | 69 config_.ui_task_runner->PostTask( |
70 FROM_HERE, | 70 FROM_HERE, |
71 base::Bind(&GPUDelegate::OnOutputSurfaceDestroyed, config_.gpu_delegate)); | 71 base::Bind(&UIDelegate::OnOutputSurfaceDestroyed, config_.ui_delegate)); |
72 ReleaseWindow(); | 72 ReleaseWindow(); |
73 } | 73 } |
74 | 74 |
75 void PlatformView::ReleaseWindow() { | 75 void PlatformView::ReleaseWindow() { |
76 ANativeWindow_release(window_); | 76 ANativeWindow_release(window_); |
77 window_ = nullptr; | 77 window_ = nullptr; |
78 } | 78 } |
79 | 79 |
80 } // namespace shell | 80 } // namespace shell |
81 } // namespace sky | 81 } // namespace sky |
OLD | NEW |