Chromium Code Reviews| Index: gpu/ipc/common/android/scoped_surface_request_manager.h |
| diff --git a/gpu/ipc/common/android/scoped_surface_request_manager.h b/gpu/ipc/common/android/scoped_surface_request_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..096537ee93ae737a02e5171fed624f990c32f9b7 |
| --- /dev/null |
| +++ b/gpu/ipc/common/android/scoped_surface_request_manager.h |
| @@ -0,0 +1,58 @@ |
| +// Copyright 2016 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 GPU_IPC_COMMON_ANDROID_SCOPED_SURFACE_REQUEST_MANAGER_H_ |
| +#define GPU_IPC_COMMON_ANDROID_SCOPED_SURFACE_REQUEST_MANAGER_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include "base/callback_forward.h" |
| +#include "gpu/gpu_export.h" |
| + |
| +namespace gl { |
| +class SurfaceTexture; |
| +class ScopedJavaSurface; |
| +} |
| + |
| +namespace gpu { |
| + |
| +// Defines an interface that allows the registration of gl::ScopedJavaSurface |
| +// requests in the browser process, and the forwarding of SurfaceTextures from |
| +// the GPU or the browser process to fulfill those requests at a later time. |
| +class GPU_EXPORT ScopedSurfaceRequestManager { |
|
watk
2016/08/26 22:01:32
I think it might be more understandable if you avo
tguilbert
2016/08/29 18:30:46
Updated. LMK if this is closer to what you had in
watk
2016/08/29 19:42:25
I like it!
|
| + public: |
| + static ScopedSurfaceRequestManager* GetInstance(); |
| + static void SetInstance(ScopedSurfaceRequestManager* instance); |
| + |
| + using ScopedSurfaceRequestCB = base::Callback<void(gl::ScopedJavaSurface)>; |
| + |
| + // Registers |request_cb| for later retrieval. |
| + // N.B: Should only be called in the browser process. |
| + virtual void RegisterScopedSurfaceRequest( |
| + uint64_t request_id, |
| + ScopedSurfaceRequestCB request_cb) = 0; |
| + |
| + // Unregisters and returns a ScopedSurfaceRequestCB previously registered |
| + // using |request_id|. |
| + // Returns a default ScopedSurfaceRequestCB() if there is no callback |
| + // associated with |request_id|. |
| + // N.B: Should only be called in the browser process. |
| + virtual ScopedSurfaceRequestCB GetAndUnregisterScopedSurfaceRequest( |
| + uint64_t request_id) = 0; |
| + |
| + // Gets and unregisters the callback under |request_id|, and runs the callback |
| + // with a gl:ScopedJavaSurface built from |surface_texture|. |
| + // If |request_id| does not map to a request, nothing happens. |
| + // N.B: Can be called from the GPU or the browser process. |
| + virtual void FulfillScopedSurfaceRequest( |
| + uint64_t request_id, |
| + gl::SurfaceTexture* surface_texture) = 0; |
| + |
| + protected: |
| + virtual ~ScopedSurfaceRequestManager() {} |
| +}; |
| + |
| +} // namespace gpu |
| + |
| +#endif // GPU_IPC_COMMON_ANDROID_SCOPED_SURFACE_REQUEST_MANAGER_H_ |