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 CONTENT_COMMON_GPU_MEDIA_AVDA_SURFACE_TRACKER_H_ | |
| 6 #define CONTENT_COMMON_GPU_MEDIA_AVDA_SURFACE_TRACKER_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "content/common/content_export.h" | |
| 12 | |
| 13 namespace content { | |
| 14 | |
| 15 using OnDestroyingSurfaceCallback = base::Callback<void(int)>; | |
| 16 | |
| 17 // AVDASurfaceTracker provides AndroidVideoDecodeAccelerators a way to register | |
| 18 // callbacks that will be called when surfaces are destroyed. This is important | |
| 19 // because Android SurfaceView Surfaces can be destroyed by the framework at any | |
| 20 // time and we must stop rendering to them before returning from | |
| 21 // onSurfaceDestroyed(). | |
| 22 // This is not thread safe. All access should be on the gpu main thread. | |
|
Will Harris
2016/04/22 23:31:09
nit: if this is not thread safe it would be nice t
watk
2016/04/23 00:48:58
Sounds good. Done with a ThreadChecker.
| |
| 23 // Callbacks will be run on the same thread. | |
| 24 class AVDASurfaceTracker { | |
| 25 public: | |
| 26 AVDASurfaceTracker(); | |
| 27 ~AVDASurfaceTracker(); | |
| 28 | |
| 29 static AVDASurfaceTracker* GetInstance(); | |
| 30 | |
| 31 void RegisterOnDestroyingSurfaceCallback( | |
| 32 const OnDestroyingSurfaceCallback& cb); | |
| 33 | |
| 34 // Unregister a callback that was previously registered. | |
| 35 void UnregisterOnDestroyingSurfaceCallback( | |
| 36 const OnDestroyingSurfaceCallback& cb); | |
| 37 | |
| 38 // Called in response to a message from the Browser indicating that the given | |
| 39 // surface is in the process of being destroyed. | |
| 40 void NotifyDestroyingSurface(int surface_id); | |
| 41 | |
| 42 private: | |
| 43 std::vector<OnDestroyingSurfaceCallback> callbacks_; | |
| 44 DISALLOW_COPY_AND_ASSIGN(AVDASurfaceTracker); | |
| 45 }; | |
| 46 | |
| 47 } // namespace content | |
| 48 | |
| 49 #endif // CONTENT_COMMON_GPU_MEDIA_AVDA_SURFACE_TRACKER_H_ | |
| OLD | NEW |