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

Unified Diff: content/browser/media/session/pepper_playback_observer.h

Issue 2551093002: Route Pepper MediaSession messages to frames (Closed)
Patch Set: fixed Android build Created 4 years 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 | content/browser/media/session/pepper_playback_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/session/pepper_playback_observer.h
diff --git a/content/browser/media/session/pepper_playback_observer.h b/content/browser/media/session/pepper_playback_observer.h
index 9aacf007dbfbf084dbb8c5e91349e3318a882c57..7641918d2fd30652d2bd981142d08cdd921871a2 100644
--- a/content/browser/media/session/pepper_playback_observer.h
+++ b/content/browser/media/session/pepper_playback_observer.h
@@ -8,43 +8,55 @@
#include <stdint.h>
#include <map>
#include <memory>
+#include <utility>
#include "base/macros.h"
namespace content {
class PepperPlayerDelegate;
-class WebContentsImpl;
+class RenderFrameHost;
+class WebContents;
// Class observing Pepper playback changes from WebContents, and update
-// MediaSession accordingly. Can only be a member of WebContentsImpl and must be
-// destroyed in ~WebContentsImpl().
+// MediaSession accordingly. Can only be a member of WebContents and must be
+// destroyed in ~WebContents().
class PepperPlaybackObserver {
public:
- explicit PepperPlaybackObserver(WebContentsImpl* contents);
+ explicit PepperPlaybackObserver(WebContents* contents);
virtual ~PepperPlaybackObserver();
- void PepperInstanceCreated(int32_t pp_instance);
- void PepperInstanceDeleted(int32_t pp_instance);
+ void RenderFrameDeleted(RenderFrameHost* render_frame_host);
+
+ void PepperInstanceCreated(RenderFrameHost* render_frame_host,
+ int32_t pp_instance);
+ void PepperInstanceDeleted(RenderFrameHost* render_frame_host,
+ int32_t pp_instance);
// This method is called when a Pepper instance starts making sound.
- void PepperStartsPlayback(int32_t pp_instance);
+ void PepperStartsPlayback(RenderFrameHost* render_frame_host,
+ int32_t pp_instance);
// This method is called when a Pepper instance stops making sound.
- void PepperStopsPlayback(int32_t pp_instance);
+ void PepperStopsPlayback(RenderFrameHost* render_frame_host,
+ int32_t pp_instance);
private:
+ using PlayerId = std::pair<RenderFrameHost*, int32_t>;
+
// Owning PepperPlayerDelegates.
- using PlayersMap =
- std::map<int32_t, std::unique_ptr<PepperPlayerDelegate>>;
+ using PlayersMap = std::map<PlayerId, std::unique_ptr<PepperPlayerDelegate>>;
PlayersMap players_map_;
// Map for whether Pepper players have ever played sound.
// Used for recording UMA.
- using PlayersPlayedSoundMap =
- std::map<int32_t, bool>;
+ //
+ // The mapped player ids must be a super-set of player ids in |players_map_|,
+ // and the map is also used for cleaning up when RenderFrame is deleted or
+ // WebContents is destructed.
+ using PlayersPlayedSoundMap = std::map<PlayerId, bool>;
PlayersPlayedSoundMap players_played_sound_map_;
// Weak reference to WebContents.
- WebContentsImpl* contents_;
+ WebContents* contents_;
DISALLOW_COPY_AND_ASSIGN(PepperPlaybackObserver);
};
« no previous file with comments | « no previous file | content/browser/media/session/pepper_playback_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698