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

Side by Side 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, 1 month 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 unified diff | Download patch
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/blink/webmediaplayer_params.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_ 5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_
6 #define MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_ 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "media/base/media_export.h" 10 #include "media/base/media_export.h"
(...skipping 15 matching lines...) Expand all
26 class MediaLog; 26 class MediaLog;
27 class MediaPermission; 27 class MediaPermission;
28 28
29 // Holds parameters for constructing WebMediaPlayerImpl without having 29 // Holds parameters for constructing WebMediaPlayerImpl without having
30 // to plumb arguments through various abstraction layers. 30 // to plumb arguments through various abstraction layers.
31 class MEDIA_EXPORT WebMediaPlayerParams { 31 class MEDIA_EXPORT WebMediaPlayerParams {
32 public: 32 public:
33 typedef base::Callback<void(const base::Closure&)> DeferLoadCB; 33 typedef base::Callback<void(const base::Closure&)> DeferLoadCB;
34 typedef base::Callback<Context3D()> Context3DCB; 34 typedef base::Callback<Context3D()> Context3DCB;
35 35
36 // Callback to tell V8 about the amount of memory used by the WebMediaPlayer
37 // instance. The input parameter is the delta in bytes since the last call to
38 // AdjustAllocatedMemoryCB and the return value is the total number of bytes
39 // used by objects external to V8. Note: this value includes things that are
40 // not the WebMediaPlayer!
41 typedef base::Callback<int64_t(int64_t)> AdjustAllocatedMemoryCB;
42
36 // |defer_load_cb|, |audio_renderer_sink|, |compositor_task_runner|, and 43 // |defer_load_cb|, |audio_renderer_sink|, |compositor_task_runner|, and
37 // |context_3d_cb| may be null. 44 // |context_3d_cb| may be null.
38 WebMediaPlayerParams( 45 WebMediaPlayerParams(
39 const DeferLoadCB& defer_load_cb, 46 const DeferLoadCB& defer_load_cb,
40 const scoped_refptr<AudioRendererSink>& audio_renderer_sink, 47 const scoped_refptr<AudioRendererSink>& audio_renderer_sink,
41 const scoped_refptr<MediaLog>& media_log, 48 const scoped_refptr<MediaLog>& media_log,
42 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, 49 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
43 const scoped_refptr<base::TaskRunner>& worker_task_runner, 50 const scoped_refptr<base::TaskRunner>& worker_task_runner,
44 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, 51 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner,
45 const Context3DCB& context_3d, 52 const Context3DCB& context_3d,
53 const AdjustAllocatedMemoryCB& adjust_allocated_memory_cb,
46 MediaPermission* media_permission, 54 MediaPermission* media_permission,
47 blink::WebContentDecryptionModule* initial_cdm); 55 blink::WebContentDecryptionModule* initial_cdm);
48 56
49 ~WebMediaPlayerParams(); 57 ~WebMediaPlayerParams();
50 58
51 DeferLoadCB defer_load_cb() const { return defer_load_cb_; } 59 DeferLoadCB defer_load_cb() const { return defer_load_cb_; }
52 60
53 const scoped_refptr<AudioRendererSink>& audio_renderer_sink() const { 61 const scoped_refptr<AudioRendererSink>& audio_renderer_sink() const {
54 return audio_renderer_sink_; 62 return audio_renderer_sink_;
55 } 63 }
(...skipping 16 matching lines...) Expand all
72 } 80 }
73 81
74 Context3DCB context_3d_cb() const { return context_3d_cb_; } 82 Context3DCB context_3d_cb() const { return context_3d_cb_; }
75 83
76 MediaPermission* media_permission() const { return media_permission_; } 84 MediaPermission* media_permission() const { return media_permission_; }
77 85
78 blink::WebContentDecryptionModule* initial_cdm() const { 86 blink::WebContentDecryptionModule* initial_cdm() const {
79 return initial_cdm_; 87 return initial_cdm_;
80 } 88 }
81 89
90 AdjustAllocatedMemoryCB adjust_allocated_memory_cb() const {
91 return adjust_allocated_memory_cb_;
92 }
82 93
83 private: 94 private:
84 DeferLoadCB defer_load_cb_; 95 DeferLoadCB defer_load_cb_;
85 scoped_refptr<AudioRendererSink> audio_renderer_sink_; 96 scoped_refptr<AudioRendererSink> audio_renderer_sink_;
86 scoped_refptr<MediaLog> media_log_; 97 scoped_refptr<MediaLog> media_log_;
87 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; 98 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
88 scoped_refptr<base::TaskRunner> worker_task_runner_; 99 scoped_refptr<base::TaskRunner> worker_task_runner_;
89 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; 100 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
90 Context3DCB context_3d_cb_; 101 Context3DCB context_3d_cb_;
102 AdjustAllocatedMemoryCB adjust_allocated_memory_cb_;
91 103
92 // TODO(xhwang): Remove after prefixed EME API support is removed. 104 // TODO(xhwang): Remove after prefixed EME API support is removed.
93 MediaPermission* media_permission_; 105 MediaPermission* media_permission_;
94 blink::WebContentDecryptionModule* initial_cdm_; 106 blink::WebContentDecryptionModule* initial_cdm_;
95 107
96 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerParams); 108 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerParams);
97 }; 109 };
98 110
99 } // namespace media 111 } // namespace media
100 112
101 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_ 113 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_
OLDNEW
« 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