Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 GPU_IPC_COMMON_ANDROID_SCOPED_SURFACE_REQUEST_MANAGER_H_ | |
| 6 #define GPU_IPC_COMMON_ANDROID_SCOPED_SURFACE_REQUEST_MANAGER_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include "base/callback_forward.h" | |
| 11 #include "gpu/gpu_export.h" | |
| 12 | |
| 13 namespace gl { | |
| 14 class SurfaceTexture; | |
| 15 class ScopedJavaSurface; | |
| 16 } | |
| 17 | |
| 18 namespace gpu { | |
| 19 | |
| 20 // Defines an interface that allows the registration of gl::ScopedJavaSurface | |
| 21 // requests in the browser process, and the forwarding of SurfaceTextures from | |
| 22 // the GPU or the browser process to fulfill those requests at a later time. | |
| 23 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!
| |
| 24 public: | |
| 25 static ScopedSurfaceRequestManager* GetInstance(); | |
| 26 static void SetInstance(ScopedSurfaceRequestManager* instance); | |
| 27 | |
| 28 using ScopedSurfaceRequestCB = base::Callback<void(gl::ScopedJavaSurface)>; | |
| 29 | |
| 30 // Registers |request_cb| for later retrieval. | |
| 31 // N.B: Should only be called in the browser process. | |
| 32 virtual void RegisterScopedSurfaceRequest( | |
| 33 uint64_t request_id, | |
| 34 ScopedSurfaceRequestCB request_cb) = 0; | |
| 35 | |
| 36 // Unregisters and returns a ScopedSurfaceRequestCB previously registered | |
| 37 // using |request_id|. | |
| 38 // Returns a default ScopedSurfaceRequestCB() if there is no callback | |
| 39 // associated with |request_id|. | |
| 40 // N.B: Should only be called in the browser process. | |
| 41 virtual ScopedSurfaceRequestCB GetAndUnregisterScopedSurfaceRequest( | |
| 42 uint64_t request_id) = 0; | |
| 43 | |
| 44 // Gets and unregisters the callback under |request_id|, and runs the callback | |
| 45 // with a gl:ScopedJavaSurface built from |surface_texture|. | |
| 46 // If |request_id| does not map to a request, nothing happens. | |
| 47 // N.B: Can be called from the GPU or the browser process. | |
| 48 virtual void FulfillScopedSurfaceRequest( | |
| 49 uint64_t request_id, | |
| 50 gl::SurfaceTexture* surface_texture) = 0; | |
| 51 | |
| 52 protected: | |
| 53 virtual ~ScopedSurfaceRequestManager() {} | |
| 54 }; | |
| 55 | |
| 56 } // namespace gpu | |
| 57 | |
| 58 #endif // GPU_IPC_COMMON_ANDROID_SCOPED_SURFACE_REQUEST_MANAGER_H_ | |
| OLD | NEW |