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

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

Issue 10546079: Added sandboxed process service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Init Created 8 years, 6 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
Index: content/common/android/surface_callback.h
diff --git a/content/common/android/surface_callback.h b/content/common/android/surface_callback.h
new file mode 100644
index 0000000000000000000000000000000000000000..e8354e190c582b340a72780b55e3726d70288b2f
--- /dev/null
+++ b/content/common/android/surface_callback.h
@@ -0,0 +1,58 @@
+// Copyright (c) 2012 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_SURFACE_CALLBACK_H_
+#define CONTENT_COMMON_ANDROID_SURFACE_CALLBACK_H_
+#pragma once
+
+#include <jni.h>
+
+#include "base/callback.h"
+#include "content/common/android/surface_texture_peer.h"
+
+struct ANativeWindow;
+
+namespace base {
+class MessageLoopProxy;
+class WaitableEvent;
+}
+
+namespace content {
+// This file implements support for passing surface handles from Java
jam 2012/06/11 20:13:17 nit: usually there's a blank line after the namesp
michaelbai 2012/06/11 20:30:16 Done.
+// to the correct thread on the native side. On Android, these surface
+// handles can only be passed across processes through Java IPC (Binder),
+// which means calls from Java come in on arbitrary threads. Hence the
+// static nature and the need for the client to register a callback with
+// the corresponding message loop.
+
+// Asynchronously sets the Surface. This can be called from any thread.
+// The Surface will be set to the proper thread based on the type. The
+// nature of primary_id and secondary_id depend on the type of surface
+// and are used to route the surface to the correct client.
+// This method will call release() on the jsurface object to release
+// all the resources. So after calling this method, the caller should
+// not use the jsurface object again.
+void SetSurfaceAsync(JNIEnv* env,
+ jobject jsurface,
+ content::SurfaceTexturePeer::SurfaceTextureTarget type,
jam 2012/06/11 20:13:17 nit: no need for content::
michaelbai 2012/06/11 20:30:16 Done.
+ int primary_id,
+ int secondary_id,
+ base::WaitableEvent* completion);
+
+void ReleaseSurface(jobject surface);
+
+typedef base::Callback<void(int, int, ANativeWindow*, base::WaitableEvent*)>
+ NativeWindowCallback;
+void RegisterNativeWindowCallback(base::MessageLoopProxy* loop,
+ NativeWindowCallback& callback);
+
+typedef base::Callback<void(int, int, jobject surface)> VideoSurfaceCallback;
+void RegisterVideoSurfaceCallback(base::MessageLoopProxy* loop,
+ VideoSurfaceCallback& callback);
+
+bool RegisterSurfaceCallback(JNIEnv* env);
+
+} // namespace content
+
+#endif // CONTENT_COMMON_ANDROID_SURFACE_CALLBACK_H_

Powered by Google App Engine
This is Rietveld 408576698