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

Unified Diff: media/blink/webmediaplayer_impl.h

Issue 2568303002: Report WMPI components memory usage to UMA (Closed)
Patch Set: Call ReportMemoryUsage from WMPI::OnMemoryPressure 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 | media/blink/webmediaplayer_impl.cc » ('j') | media/blink/webmediaplayer_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webmediaplayer_impl.h
diff --git a/media/blink/webmediaplayer_impl.h b/media/blink/webmediaplayer_impl.h
index 6e01840d71c6e0e05129c139d91354fd04f2f4d9..078f79e94683b3cab4833d7091f69e4a756c826b 100644
--- a/media/blink/webmediaplayer_impl.h
+++ b/media/blink/webmediaplayer_impl.h
@@ -15,8 +15,10 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
+#include "base/memory/memory_pressure_listener.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
+#include "base/optional.h"
#include "base/threading/thread.h"
#include "base/time/default_tick_clock.h"
#include "base/timer/elapsed_timer.h"
@@ -345,9 +347,14 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// Called at low frequency to tell external observers how much memory we're
// using for video playback. Called by |memory_usage_reporting_timer_|.
// Memory usage reporting is done in two steps, because |demuxer_| must be
- // accessed on the media thread.
- void ReportMemoryUsage();
- void FinishMemoryUsageReport(int64_t demuxer_memory_usage);
+ // accessed on the media thread. Also called when we get notified about memory
watk 2016/12/13 23:34:31 nit: merge the "Also called when" sentence with th
servolk 2016/12/14 00:07:23 Done.
+ // pressure level changes.
+ void ReportMemoryUsageOnTimer();
+ using MaybeMemPressureLvl =
watk 2016/12/13 23:34:31 nit: It's probably more obvious if you call this O
servolk 2016/12/14 00:07:23 Done.
+ base::Optional<base::MemoryPressureListener::MemoryPressureLevel>;
+ void ReportMemoryUsage(MaybeMemPressureLvl maybe_mem_pressure_lvl);
+ void FinishMemoryUsageReport(MaybeMemPressureLvl maybe_mem_pressure_lvl,
+ int64_t demuxer_memory_usage);
watk 2016/12/13 23:34:31 nit: This is minor but I'd s/lvl/level and s/mem/m
servolk 2016/12/14 00:07:23 Done.
// Called during OnHidden() when we want a suspended player to enter the
// paused state after some idle timeout.
@@ -358,6 +365,8 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// Returns true if the player is hidden.
bool IsHidden() const;
+ void OnMemoryPressure(base::MemoryPressureListener::MemoryPressureLevel lvl);
+
blink::WebLocalFrame* frame_;
// The playback state last reported to |delegate_|, to avoid setting duplicate
@@ -579,6 +588,8 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// Whether the player is currently in autoplay muted state.
bool autoplay_muted_ = false;
+ std::unique_ptr<base::MemoryPressureListener> mem_pressure_listener_;
+
DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
};
« no previous file with comments | « no previous file | media/blink/webmediaplayer_impl.cc » ('j') | media/blink/webmediaplayer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698