| 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 #ifndef UI_GL_ANDROID_SCOPED_JAVA_SURFACE_H_ | 5 #ifndef UI_GL_ANDROID_SCOPED_JAVA_SURFACE_H_ |
| 6 #define UI_GL_ANDROID_SCOPED_JAVA_SURFACE_H_ | 6 #define UI_GL_ANDROID_SCOPED_JAVA_SURFACE_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // the latter no longer owns the surface afterwards. | 35 // the latter no longer owns the surface afterwards. |
| 36 ScopedJavaSurface(RValue rvalue); | 36 ScopedJavaSurface(RValue rvalue); |
| 37 ScopedJavaSurface& operator=(RValue rhs); | 37 ScopedJavaSurface& operator=(RValue rhs); |
| 38 | 38 |
| 39 // Creates a ScopedJavaSurface that is owned externally, i.e., | 39 // Creates a ScopedJavaSurface that is owned externally, i.e., |
| 40 // someone else is responsible to call Surface.release(). | 40 // someone else is responsible to call Surface.release(). |
| 41 static ScopedJavaSurface AcquireExternalSurface(jobject surface); | 41 static ScopedJavaSurface AcquireExternalSurface(jobject surface); |
| 42 | 42 |
| 43 ~ScopedJavaSurface(); | 43 ~ScopedJavaSurface(); |
| 44 | 44 |
| 45 // Check whether the surface is an empty one. | 45 // Checks whether the surface is an empty one. |
| 46 bool IsEmpty() const; | 46 bool IsEmpty() const; |
| 47 | 47 |
| 48 // Check whether the surface is hardware protected so that no readback is | 48 // Checks whether the surface is valid. |
| 49 bool IsValid() const; |
| 50 |
| 51 // Checks whether the surface is hardware protected so that no readback is |
| 49 // possible. | 52 // possible. |
| 50 bool is_protected() const { return is_protected_; } | 53 bool is_protected() const { return is_protected_; } |
| 51 | 54 |
| 52 const base::android::JavaRef<jobject>& j_surface() const { | 55 const base::android::JavaRef<jobject>& j_surface() const { |
| 53 return j_surface_; | 56 return j_surface_; |
| 54 } | 57 } |
| 55 | 58 |
| 56 private: | 59 private: |
| 57 // Performs destructive move from |other| to this. | 60 // Performs destructive move from |other| to this. |
| 58 void MoveFrom(ScopedJavaSurface& other); | 61 void MoveFrom(ScopedJavaSurface& other); |
| 59 | 62 |
| 60 bool auto_release_; | 63 bool auto_release_; |
| 61 bool is_protected_; | 64 bool is_protected_; |
| 62 | 65 |
| 63 base::android::ScopedJavaGlobalRef<jobject> j_surface_; | 66 base::android::ScopedJavaGlobalRef<jobject> j_surface_; |
| 64 }; | 67 }; |
| 65 | 68 |
| 66 } // namespace gfx | 69 } // namespace gfx |
| 67 | 70 |
| 68 #endif // UI_GL_ANDROID_SCOPED_JAVA_SURFACE_H_ | 71 #endif // UI_GL_ANDROID_SCOPED_JAVA_SURFACE_H_ |
| OLD | NEW |