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

Side by Side Diff: ui/gl/android/surface_texture.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
« no previous file with comments | « mojo/services/native_viewport/native_viewport_android.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/gl/android/surface_texture.h" 5 #include "ui/gl/android/surface_texture.h"
6 6
7 #include <android/native_window_jni.h> 7 #include <android/native_window_jni.h>
8 8
9 // TODO(boliu): Remove this include when we move off ICS. 9 // TODO(boliu): Remove this include when we move off ICS.
10 #include "base/android/build_info.h" 10 #include "base/android/build_info.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 if (GlContextMethodsAvailable()) { 116 if (GlContextMethodsAvailable()) {
117 JNIEnv* env = base::android::AttachCurrentThread(); 117 JNIEnv* env = base::android::AttachCurrentThread();
118 Java_SurfaceTexturePlatformWrapper_detachFromGLContext( 118 Java_SurfaceTexturePlatformWrapper_detachFromGLContext(
119 env, j_surface_texture_.obj()); 119 env, j_surface_texture_.obj());
120 } 120 }
121 } 121 }
122 122
123 ANativeWindow* SurfaceTexture::CreateSurface() { 123 ANativeWindow* SurfaceTexture::CreateSurface() {
124 JNIEnv* env = base::android::AttachCurrentThread(); 124 JNIEnv* env = base::android::AttachCurrentThread();
125 ScopedJavaSurface surface(this); 125 ScopedJavaSurface surface(this);
126 // Note: This ensures that any local references used by
127 // ANativeWindow_fromSurface are released immediately. This is needed as a
128 // workaround for https://code.google.com/p/android/issues/detail?id=68174
129 base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env);
126 ANativeWindow* native_window = ANativeWindow_fromSurface( 130 ANativeWindow* native_window = ANativeWindow_fromSurface(
127 env, surface.j_surface().obj()); 131 env, surface.j_surface().obj());
128 return native_window; 132 return native_window;
129 } 133 }
130 134
131 // static 135 // static
132 bool SurfaceTexture::IsSingleBufferModeSupported() { 136 bool SurfaceTexture::IsSingleBufferModeSupported() {
133 return base::android::BuildInfo::GetInstance()->sdk_int() >= 19; 137 return base::android::BuildInfo::GetInstance()->sdk_int() >= 19;
134 } 138 }
135 139
136 bool SurfaceTexture::RegisterSurfaceTexture(JNIEnv* env) { 140 bool SurfaceTexture::RegisterSurfaceTexture(JNIEnv* env) {
137 return RegisterNativesImpl(env); 141 return RegisterNativesImpl(env);
138 } 142 }
139 143
140 } // namespace gfx 144 } // namespace gfx
OLDNEW
« no previous file with comments | « mojo/services/native_viewport/native_viewport_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698