Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: media/base/android/android_overlay.h

Issue 2883913003: Add multiple destruction callbacks to AndroidOverlay. (Closed)
Patch Set: rebased Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/base/android/android_overlay.cc » ('j') | media/base/android/android_overlay.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/android_overlay.h
diff --git a/media/base/android/android_overlay.h b/media/base/android/android_overlay.h
index 8b500a85d04a9961034ee43e3234489e55db6c89..4c1cad64869107a2b4ae93d83da95340f1bb8289 100644
--- a/media/base/android/android_overlay.h
+++ b/media/base/android/android_overlay.h
@@ -5,9 +5,12 @@
#ifndef MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_
#define MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_
+#include <list>
+
#include "base/android/scoped_java_ref.h"
#include "base/callback.h"
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "media/base/android_overlay_config.h"
#include "media/base/media_export.h"
#include "ui/gfx/geometry/rect.h"
@@ -37,7 +40,7 @@ namespace media {
// AndroidOverlay isn't technically supposed to do that.
class MEDIA_EXPORT AndroidOverlay {
public:
- virtual ~AndroidOverlay() {}
+ virtual ~AndroidOverlay();
// Schedules a relayout of this overlay. If called before the client is
// notified that the surface is created, then the call will be ignored.
@@ -46,8 +49,18 @@ class MEDIA_EXPORT AndroidOverlay {
// May be called during / after ReadyCB and before DestroyedCB.
virtual const base::android::JavaRef<jobject>& GetJavaSurface() const = 0;
+ // Add a destruction callback that will be called if the surface is destroyed.
+ // These will be called in the same order that they're added.
+ void AddDestructionCallback(AndroidOverlayConfig::DestroyedCB cb);
watk 2017/05/16 19:10:29 Destruction makes it sound a lot like you're regis
tguilbert 2017/05/16 19:11:51 Can you document the guarantees of the contract? I
liberato (no reviews please) 2017/05/16 20:04:02 there is a guarantee that it won't be called if |t
liberato (no reviews please) 2017/05/16 20:04:02 AddSurfaceDestroyedCb()?
+
protected:
- AndroidOverlay() {}
+ AndroidOverlay();
+
+ void RunDestructionCallbacks();
+
+ std::list<AndroidOverlayConfig::DestroyedCB> destruction_cbs_;
+
+ base::WeakPtrFactory<AndroidOverlay> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(AndroidOverlay);
};
« no previous file with comments | « no previous file | media/base/android/android_overlay.cc » ('j') | media/base/android/android_overlay.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698