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

Unified Diff: media/blink/webmediaplayer_impl.h

Issue 2568303002: Report WMPI components memory usage to UMA (Closed)
Patch Set: Remove ReportMemoryUsageOnTimer 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..5906f34887666f62c0f33410b719040635da9fc5 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"
@@ -343,11 +345,16 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
void SetSuspendState(bool is_suspended);
// Called at low frequency to tell external observers how much memory we're
- // using for video playback. Called by |memory_usage_reporting_timer_|.
+ // using for video playback. Called by |memory_usage_reporting_timer_| and
+ // when we get notified about memory pressure via MemoryPressureListener.
// 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);
+ using OptionalMemoryPressureLevel =
+ base::Optional<base::MemoryPressureListener::MemoryPressureLevel>;
+ void ReportMemoryUsage(OptionalMemoryPressureLevel memory_pressure_level);
+ void FinishMemoryUsageReport(
+ OptionalMemoryPressureLevel memory_pressure_level,
+ int64_t demuxer_memory_usage);
// 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);
watk 2016/12/14 00:34:05 name doesn't match cc.
servolk 2016/12/14 02:34:34 Done.
+
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> memory_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