OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/scoped_java_surface.h" | 5 #include "ui/gl/android/scoped_java_surface.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "jni/Surface_jni.h" | 8 #include "jni/Surface_jni.h" |
9 #include "ui/gl/android/surface_texture.h" | 9 #include "ui/gl/android/surface_texture.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... | |
25 | 25 |
26 ScopedJavaSurface::ScopedJavaSurface() { | 26 ScopedJavaSurface::ScopedJavaSurface() { |
27 } | 27 } |
28 | 28 |
29 ScopedJavaSurface::ScopedJavaSurface( | 29 ScopedJavaSurface::ScopedJavaSurface( |
30 const base::android::JavaRef<jobject>& surface) | 30 const base::android::JavaRef<jobject>& surface) |
31 : auto_release_(true), | 31 : auto_release_(true), |
32 is_protected_(false) { | 32 is_protected_(false) { |
33 JNIEnv* env = base::android::AttachCurrentThread(); | 33 JNIEnv* env = base::android::AttachCurrentThread(); |
34 RegisterNativesIfNeeded(env); | 34 RegisterNativesIfNeeded(env); |
35 DCHECK(env->IsInstanceOf(surface.obj(), g_Surface_clazz)); | |
mkosiba (inactive)
2014/08/15 16:53:50
I was thinking of making this a method (g_Sufrace_
mkosiba (inactive)
2014/08/18 11:01:21
Should be now fixed
| |
36 j_surface_.Reset(surface); | 35 j_surface_.Reset(surface); |
37 } | 36 } |
38 | 37 |
39 ScopedJavaSurface::ScopedJavaSurface( | 38 ScopedJavaSurface::ScopedJavaSurface( |
40 const SurfaceTexture* surface_texture) | 39 const SurfaceTexture* surface_texture) |
41 : auto_release_(true), | 40 : auto_release_(true), |
42 is_protected_(false) { | 41 is_protected_(false) { |
43 JNIEnv* env = base::android::AttachCurrentThread(); | 42 JNIEnv* env = base::android::AttachCurrentThread(); |
44 RegisterNativesIfNeeded(env); | 43 RegisterNativesIfNeeded(env); |
45 ScopedJavaLocalRef<jobject> tmp(JNI_Surface::Java_Surface_Constructor( | 44 ScopedJavaLocalRef<jobject> tmp(JNI_Surface::Java_Surface_Constructor( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 JNIEnv* env = base::android::AttachCurrentThread(); | 79 JNIEnv* env = base::android::AttachCurrentThread(); |
81 ScopedJavaLocalRef<jobject> surface_ref; | 80 ScopedJavaLocalRef<jobject> surface_ref; |
82 surface_ref.Reset(env, surface); | 81 surface_ref.Reset(env, surface); |
83 gfx::ScopedJavaSurface scoped_surface(surface_ref); | 82 gfx::ScopedJavaSurface scoped_surface(surface_ref); |
84 scoped_surface.auto_release_ = false; | 83 scoped_surface.auto_release_ = false; |
85 scoped_surface.is_protected_ = true; | 84 scoped_surface.is_protected_ = true; |
86 return scoped_surface; | 85 return scoped_surface; |
87 } | 86 } |
88 | 87 |
89 } // namespace gfx | 88 } // namespace gfx |
OLD | NEW |