Chromium Code Reviews| Index: content/common/gpu/media/avda_surface_tracker.h |
| diff --git a/content/common/gpu/media/avda_surface_tracker.h b/content/common/gpu/media/avda_surface_tracker.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b56f1d6aa8a03b4fea6154ec809ad1b75665b7eb |
| --- /dev/null |
| +++ b/content/common/gpu/media/avda_surface_tracker.h |
| @@ -0,0 +1,46 @@ |
| +// 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 CONTENT_COMMON_GPU_MEDIA_AVDA_SURFACE_TRACKER_H_ |
| +#define CONTENT_COMMON_GPU_MEDIA_AVDA_SURFACE_TRACKER_H_ |
| + |
| +#include "content/common/content_export.h" |
| + |
| +namespace content { |
| + |
| +using OnDestroyingSurfaceCallback = base::Callback<void(int)>; |
| + |
| +// AVDASurfaceTracker provides AndroidVideoDecodeAccelerators a way to register |
|
DaleCurtis
2016/04/22 18:17:14
Kind of feels like we should merge this and the AV
liberato (no reviews please)
2016/04/22 20:31:29
might want to hold off on that until MediaCodecLoo
|
| +// callbacks that will be called when surfaces are destroyed. This is important |
| +// because Android SurfaceView Surfaces can be destroyed by the framework at any |
| +// time and we must stop rendering to them before returning from |
| +// onSurfaceDestroyed(). |
| +// This is not thread safe. All access should be on the gpu main thread. |
| +// Callbacks will be run on the same thread. |
| +class AVDASurfaceTracker { |
| + public: |
| + AVDASurfaceTracker(); |
| + ~AVDASurfaceTracker(); |
| + |
| + static AVDASurfaceTracker* GetInstance(); |
| + |
| + void RegisterOnDestroyingSurfaceCallback( |
| + const OnDestroyingSurfaceCallback& cb); |
| + |
| + // Unregister a callback that was previously registered. |
| + void UnregisterOnDestroyingSurfaceCallback( |
| + const OnDestroyingSurfaceCallback& cb); |
| + |
| + // Called in response to a message from the Browser indicating that the given |
| + // surface is in the process of being destroyed. |
| + void NotifyDestroyingSurface(int surface_id); |
| + |
| + private: |
| + std::vector<OnDestroyingSurfaceCallback> callbacks_; |
| + DISALLOW_COPY_AND_ASSIGN(AVDASurfaceTracker); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_COMMON_GPU_MEDIA_AVDA_SURFACE_TRACKER_H_ |