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..89c6ba2658d416b2d527b4c830d689e5ff0e6546 |
| --- /dev/null |
| +++ b/content/common/gpu/media/avda_surface_tracker.h |
| @@ -0,0 +1,49 @@ |
| +// 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_MANAGER_H_ |
| +#define CONTENT_COMMON_GPU_MEDIA_AVDA_SURFACE_MANAGER_H_ |
| + |
| +#include "base/observer_list.h" |
| +#include "content/common/content_export.h" |
| + |
| +namespace content { |
| + |
| +class SurfaceDestructionObserver { |
|
no sievers
2016/04/19 23:30:17
nit: This only has one method so could be a base::
watk
2016/04/22 02:48:55
Done.
|
| + public: |
| + // The given surface is being destroyed. If the observer owns the surface |
| + // it should quickly release it before returning from this because this will |
| + // be called while blocking the Browser UI thread. |
| + virtual void OnDestroyingSurface(int surface_id) = 0; |
| + |
| + protected: |
| + ~SurfaceDestructionObserver() {} |
| +}; |
| + |
| +// AVDASurfaceTracker provides AndroidVideoDecodeAccelerators a way to register |
| +// as observers of surface destruction. 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(). |
| +class AVDASurfaceTracker { |
| + public: |
| + static AVDASurfaceTracker* GetInstance(); |
| + |
| + AVDASurfaceTracker(); |
| + ~AVDASurfaceTracker(); |
| + |
| + void AddSurfaceDestructionObserver(SurfaceDestructionObserver* observer); |
|
no sievers
2016/04/18 23:41:25
I don't see any call sites to this.
I'm asking al
watk
2016/04/19 21:15:08
I forgot to mention that I was going to do the AVD
|
| + void RemoveSurfaceDestructionObserver(SurfaceDestructionObserver* observer); |
| + |
| + // 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: |
| + base::ObserverList<SurfaceDestructionObserver> observers_; |
| + DISALLOW_COPY_AND_ASSIGN(AVDASurfaceTracker); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_COMMON_GPU_MEDIA_AVDA_SURFACE_MANAGER_H_ |