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

Unified Diff: media/blink/webmediaplayer_params.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/webmediaplayer_impl.cc ('k') | media/blink/webmediaplayer_params.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webmediaplayer_params.h
diff --git a/media/blink/webmediaplayer_params.h b/media/blink/webmediaplayer_params.h
index 0811902a9ba57bd781b39a9696ea50678ccc499b..7be212a38c8fa120050b09efa74e47265ac39faa 100644
--- a/media/blink/webmediaplayer_params.h
+++ b/media/blink/webmediaplayer_params.h
@@ -33,6 +33,13 @@ class MEDIA_EXPORT WebMediaPlayerParams {
typedef base::Callback<void(const base::Closure&)> DeferLoadCB;
typedef base::Callback<Context3D()> Context3DCB;
+ // Callback to tell V8 about the amount of memory used by the WebMediaPlayer
+ // instance. The input parameter is the delta in bytes since the last call to
+ // AdjustAllocatedMemoryCB and the return value is the total number of bytes
+ // used by objects external to V8. Note: this value includes things that are
+ // not the WebMediaPlayer!
+ typedef base::Callback<int64_t(int64_t)> AdjustAllocatedMemoryCB;
+
// |defer_load_cb|, |audio_renderer_sink|, |compositor_task_runner|, and
// |context_3d_cb| may be null.
WebMediaPlayerParams(
@@ -43,6 +50,7 @@ class MEDIA_EXPORT WebMediaPlayerParams {
const scoped_refptr<base::TaskRunner>& worker_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner,
const Context3DCB& context_3d,
+ const AdjustAllocatedMemoryCB& adjust_allocated_memory_cb,
MediaPermission* media_permission,
blink::WebContentDecryptionModule* initial_cdm);
@@ -79,6 +87,9 @@ class MEDIA_EXPORT WebMediaPlayerParams {
return initial_cdm_;
}
+ AdjustAllocatedMemoryCB adjust_allocated_memory_cb() const {
+ return adjust_allocated_memory_cb_;
+ }
private:
DeferLoadCB defer_load_cb_;
@@ -88,6 +99,7 @@ class MEDIA_EXPORT WebMediaPlayerParams {
scoped_refptr<base::TaskRunner> worker_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
Context3DCB context_3d_cb_;
+ AdjustAllocatedMemoryCB adjust_allocated_memory_cb_;
// TODO(xhwang): Remove after prefixed EME API support is removed.
MediaPermission* media_permission_;
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/blink/webmediaplayer_params.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698