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

Unified Diff: media/blink/webmediaplayer_impl.h

Issue 1409123005: Add methods for telling V8 how much memory audio/video is using. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix html viewer. Created 5 years, 2 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 | « media/blink/buffered_resource_loader_unittest.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »
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 75e538afa3260f73e47ebfe8ce72297b8258545b..e839268d81b54e334669cadf9c2fb444e793e917 100644
--- a/media/blink/webmediaplayer_impl.h
+++ b/media/blink/webmediaplayer_impl.h
@@ -234,6 +234,10 @@ class MEDIA_EXPORT WebMediaPlayerImpl
// |ended_| state by clamping current time to duration upon |ended_|.
void UpdatePausedTime();
+ // Called at low frequency to tell external observers how much memory we're
+ // using for video playback. Called by |memory_usage_reporting_timer_|.
+ void ReportMemoryUsage();
+
blink::WebLocalFrame* frame_;
// TODO(hclam): get rid of these members and read from the pipeline directly.
@@ -301,6 +305,12 @@ class MEDIA_EXPORT WebMediaPlayerImpl
WebMediaPlayerParams::DeferLoadCB defer_load_cb_;
WebMediaPlayerParams::Context3DCB context_3d_cb_;
+ // Members for notifying upstream clients about internal memory usage. The
+ // |adjust_allocated_memory_cb_| must only be called on |main_task_runner_|.
+ base::RepeatingTimer memory_usage_reporting_timer_;
+ WebMediaPlayerParams::AdjustAllocatedMemoryCB adjust_allocated_memory_cb_;
+ int64_t last_reported_memory_usage_;
+
// Routes audio playback to either AudioRendererSink or WebAudio.
scoped_refptr<WebAudioSourceProviderImpl> audio_source_provider_;
« no previous file with comments | « media/blink/buffered_resource_loader_unittest.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698