Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_COMMON_ANDROID_SCOPED_JAVA_SURFACE_H_ | |
| 6 #define CONTENT_COMMON_ANDROID_SCOPED_JAVA_SURFACE_H_ | |
| 7 | |
| 8 #include <jni.h> | |
| 9 | |
| 10 #include "base/android/scoped_java_ref.h" | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 class SurfaceTextureBridge; | |
| 15 | |
| 16 // A helper class for holding a scoped reference to a Java Surface instance. | |
| 17 // When going out of scope, release() is called on the Java object to make | |
| 18 // sure server-side references (esp. wrt graphics memory) are released. | |
| 19 class ScopedJavaSurface { | |
| 20 public: | |
| 21 ScopedJavaSurface(); | |
| 22 | |
| 23 // Wraps an existing Java Surface object in a ScopedJavaSurface. | |
| 24 ScopedJavaSurface(const base::android::JavaRef<jobject>& surface); | |
|
piman
2013/03/04 22:56:29
nit: explicit
no sievers
2013/03/04 22:59:16
Done.
| |
| 25 | |
| 26 // Creates a Java Surface from a SurfaceTexture and wraps it in a | |
| 27 // ScopedJavaSurface. | |
| 28 ScopedJavaSurface(const SurfaceTextureBridge* surface_texture); | |
|
piman
2013/03/04 22:56:29
nit:explicit
no sievers
2013/03/04 22:59:16
Done.
| |
| 29 | |
| 30 ~ScopedJavaSurface(); | |
| 31 | |
| 32 const base::android::JavaRef<jobject>& j_surface() const { | |
| 33 return j_surface_; | |
| 34 } | |
| 35 | |
| 36 private: | |
| 37 base::android::ScopedJavaGlobalRef<jobject> j_surface_; | |
| 38 }; | |
| 39 | |
| 40 } // namespace content | |
| 41 | |
| 42 #endif // CONTENT_COMMON_ANDROID_SCOPED_JAVA_SURFACE_H_ | |
| OLD | NEW |