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

Side by Side Diff: content/common/android/surface_texture_bridge.cc

Issue 11791027: [Android] Fix Java android.view.Surface leak. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | « no previous file | 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 (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/common/android/surface_texture_bridge.h" 5 #include "content/common/android/surface_texture_bridge.h"
6 6
7 #include <android/native_window_jni.h> 7 #include <android/native_window_jni.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 env, j_surface_texture_.obj()); 121 env, j_surface_texture_.obj());
122 } 122 }
123 123
124 ANativeWindow* SurfaceTextureBridge::CreateSurface() { 124 ANativeWindow* SurfaceTextureBridge::CreateSurface() {
125 JNIEnv* env = AttachCurrentThread(); 125 JNIEnv* env = AttachCurrentThread();
126 ScopedJavaLocalRef<jobject> jsurface( 126 ScopedJavaLocalRef<jobject> jsurface(
127 JNI_Surface::Java_Surface_Constructor( 127 JNI_Surface::Java_Surface_Constructor(
128 env, j_surface_texture_.obj())); 128 env, j_surface_texture_.obj()));
129 DCHECK(!jsurface.is_null()); 129 DCHECK(!jsurface.is_null());
130 ANativeWindow* native_window = ANativeWindow_fromSurface(env, jsurface.obj()); 130 ANativeWindow* native_window = ANativeWindow_fromSurface(env, jsurface.obj());
131 JNI_Surface::Java_Surface_release(env, jsurface.obj());
bulach 2013/01/08 15:51:49 rather than .obj() you may want to use .Release()
benm (inactive) 2013/01/08 15:56:39 Well, it's a scopedref that's going out of scope o
131 return native_window; 132 return native_window;
132 } 133 }
133 134
134 } // namespace content 135 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698