Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: mojo/services/native_viewport/native_viewport_android.cc

Issue 225283008: base: Add ScopedJavaLocalFrame class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Set kDefaultLocalFrameCapacity to 16. 512 is much higher than necessary and might fail. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "mojo/services/native_viewport/native_viewport_android.h" 5 #include "mojo/services/native_viewport/native_viewport_android.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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 54
55 void NativeViewportAndroid::Destroy(JNIEnv* env, jobject obj) { 55 void NativeViewportAndroid::Destroy(JNIEnv* env, jobject obj) {
56 delegate_->OnDestroyed(); 56 delegate_->OnDestroyed();
57 } 57 }
58 58
59 void NativeViewportAndroid::SurfaceCreated(JNIEnv* env, 59 void NativeViewportAndroid::SurfaceCreated(JNIEnv* env,
60 jobject obj, 60 jobject obj,
61 jobject jsurface) { 61 jobject jsurface) {
62 base::android::ScopedJavaLocalRef<jobject> protector(env, jsurface); 62 base::android::ScopedJavaLocalRef<jobject> protector(env, jsurface);
63 window_ = ANativeWindow_fromSurface(env, jsurface); 63 // Note: This ensures that any local references used by
64 // ANativeWindow_fromSurface are released immediately. This is needed as a
65 // workaround for https://code.google.com/p/android/issues/detail?id=68174
66 {
67 base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env);
68 window_ = ANativeWindow_fromSurface(env, jsurface);
69 }
64 delegate_->OnAcceleratedWidgetAvailable(window_); 70 delegate_->OnAcceleratedWidgetAvailable(window_);
65 } 71 }
66 72
67 void NativeViewportAndroid::SurfaceDestroyed(JNIEnv* env, jobject obj) { 73 void NativeViewportAndroid::SurfaceDestroyed(JNIEnv* env, jobject obj) {
68 DCHECK(window_); 74 DCHECK(window_);
69 ReleaseWindow(); 75 ReleaseWindow();
70 } 76 }
71 77
72 void NativeViewportAndroid::SurfaceSetSize(JNIEnv* env, jobject obj, 78 void NativeViewportAndroid::SurfaceSetSize(JNIEnv* env, jobject obj,
73 jint width, jint height) { 79 jint width, jint height) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // static 152 // static
147 scoped_ptr<NativeViewport> NativeViewport::Create( 153 scoped_ptr<NativeViewport> NativeViewport::Create(
148 shell::Context* context, 154 shell::Context* context,
149 NativeViewportDelegate* delegate) { 155 NativeViewportDelegate* delegate) {
150 return scoped_ptr<NativeViewport>( 156 return scoped_ptr<NativeViewport>(
151 new NativeViewportAndroid(context, delegate)).Pass(); 157 new NativeViewportAndroid(context, delegate)).Pass();
152 } 158 }
153 159
154 } // namespace services 160 } // namespace services
155 } // namespace mojo 161 } // namespace mojo
OLDNEW
« no previous file with comments | « content/browser/renderer_host/compositor_impl_android.cc ('k') | ui/gl/android/surface_texture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698