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

Unified Diff: content/common/android/scoped_java_surface.h

Issue 12388038: Android: Remove Surface cruft (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/android/common_jni_registrar.cc ('k') | content/common/android/scoped_java_surface.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/android/scoped_java_surface.h
diff --git a/content/common/android/scoped_java_surface.h b/content/common/android/scoped_java_surface.h
new file mode 100644
index 0000000000000000000000000000000000000000..de0b67335a0d49d040cc01575a39e9b7c8044554
--- /dev/null
+++ b/content/common/android/scoped_java_surface.h
@@ -0,0 +1,42 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_COMMON_ANDROID_SCOPED_JAVA_SURFACE_H_
+#define CONTENT_COMMON_ANDROID_SCOPED_JAVA_SURFACE_H_
+
+#include <jni.h>
+
+#include "base/android/scoped_java_ref.h"
+
+namespace content {
+
+class SurfaceTextureBridge;
+
+// A helper class for holding a scoped reference to a Java Surface instance.
+// When going out of scope, Surface.release() is called on the Java object to
+// make sure server-side references (esp. wrt graphics memory) are released.
+class ScopedJavaSurface {
+ public:
+ ScopedJavaSurface();
+
+ // Wraps an existing Java Surface object in a ScopedJavaSurface.
+ explicit ScopedJavaSurface(const base::android::JavaRef<jobject>& surface);
+
+ // Creates a Java Surface from a SurfaceTexture and wraps it in a
+ // ScopedJavaSurface.
+ explicit ScopedJavaSurface(const SurfaceTextureBridge* surface_texture);
+
+ ~ScopedJavaSurface();
+
+ const base::android::JavaRef<jobject>& j_surface() const {
+ return j_surface_;
+ }
+
+ private:
+ base::android::ScopedJavaGlobalRef<jobject> j_surface_;
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_ANDROID_SCOPED_JAVA_SURFACE_H_
« no previous file with comments | « content/common/android/common_jni_registrar.cc ('k') | content/common/android/scoped_java_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698