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

Unified Diff: content/browser/web_contents/web_contents_impl.h

Issue 478543003: Use AudioStreamMonitor to control power save blocking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move it with style! Created 6 years, 4 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
Index: content/browser/web_contents/web_contents_impl.h
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 922829cfb74239d69953ad80bc5301ab5154648e..2e3bc9655051a83335292c6310c1525dcc5f4137 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -329,6 +329,7 @@ class CONTENT_EXPORT WebContentsImpl
const blink::WebFindOptions& options) OVERRIDE;
virtual void StopFinding(StopFindAction action) OVERRIDE;
virtual void InsertCSS(const std::string& css) OVERRIDE;
+ virtual bool WasRecentlyAudible() OVERRIDE;
#if defined(OS_ANDROID)
virtual base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents()
OVERRIDE;
@@ -902,12 +903,17 @@ class CONTENT_EXPORT WebContentsImpl
// Removes browser plugin embedder if there is one.
void RemoveBrowserPluginEmbedder();
- // Clear |render_frame_host|'s PowerSaveBlockers.
+ // Clear |render_frame_host|'s tracking entry for |power_save_blocker_|.
void ClearPowerSaveBlockers(RenderFrameHost* render_frame_host);
- // Clear all PowerSaveBlockers, leave |power_save_blocker_| empty.
+ // Clear tracking entries for all RenderFrameHosts, clears
+ // |power_save_blocker_|.
void ClearAllPowerSaveBlockers();
+ // Creates |power_save_blocker_|; must only be called if |power_save_blocker_|
+ // is NULL and |active_media_players_| is non-empty.
+ void CreatePowerSaveBlocker();
+
// Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView().
gfx::Size GetSizeForNewRenderView();
@@ -973,16 +979,9 @@ class CONTENT_EXPORT WebContentsImpl
// Helper classes ------------------------------------------------------------
#if !defined(OS_CHROMEOS)
- // Maps the RenderFrameHost to its media_player_cookie and PowerSaveBlocker
- // pairs. Key is the RenderFrameHost, value is the map which maps
- // player_cookie on to PowerSaveBlocker.
- //
- // ChromeOS does its own detection of audio and video.
- typedef base::ScopedPtrHashMap<int64, PowerSaveBlocker>
- PowerSaveBlockerMapEntry;
- typedef base::ScopedPtrHashMap<uintptr_t, PowerSaveBlockerMapEntry>
- PowerSaveBlockerMap;
- PowerSaveBlockerMap power_save_blockers_;
+ typedef std::map<uintptr_t, int> ActiveMediaPlayerMap;
+ ActiveMediaPlayerMap active_media_players_;
+ scoped_ptr<content::PowerSaveBlocker> power_save_blocker_;
jam 2014/09/02 19:50:33 no "content::" in content namespace
DaleCurtis 2014/09/04 21:59:06 Done.
#endif
// Manages the frame tree of the page and process swaps in each node.

Powered by Google App Engine
This is Rietveld 408576698