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

Side by Side Diff: media/blink/webmediaplayer_params.h

Issue 2815303006: Convert MediaLog from being ref counted to owned by WebMediaPlayer. (Closed)
Patch Set: Actually fix fuzzers. Created 3 years, 8 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 unified diff | Download patch
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "media/base/media_log.h"
15 #include "media/base/media_observer.h" 16 #include "media/base/media_observer.h"
16 #include "media/blink/media_blink_export.h" 17 #include "media/blink/media_blink_export.h"
17 #include "media/filters/context_3d.h" 18 #include "media/filters/context_3d.h"
18 19
19 namespace base { 20 namespace base {
20 class SingleThreadTaskRunner; 21 class SingleThreadTaskRunner;
21 class TaskRunner; 22 class TaskRunner;
22 } 23 }
23 24
24 namespace blink { 25 namespace blink {
25 class WebContentDecryptionModule; 26 class WebContentDecryptionModule;
26 } 27 }
27 28
28 namespace media { 29 namespace media {
29 30
30 class SwitchableAudioRendererSink; 31 class SwitchableAudioRendererSink;
31 class MediaLog;
32 class SurfaceManager; 32 class SurfaceManager;
33 33
34 // Holds parameters for constructing WebMediaPlayerImpl without having 34 // Holds parameters for constructing WebMediaPlayerImpl without having
35 // to plumb arguments through various abstraction layers. 35 // to plumb arguments through various abstraction layers.
36 class MEDIA_BLINK_EXPORT WebMediaPlayerParams { 36 class MEDIA_BLINK_EXPORT WebMediaPlayerParams {
37 public: 37 public:
38 typedef base::Callback<void(const base::Closure&)> DeferLoadCB; 38 typedef base::Callback<void(const base::Closure&)> DeferLoadCB;
39 typedef base::Callback<Context3D()> Context3DCB; 39 typedef base::Callback<Context3D()> Context3DCB;
40 40
41 // Callback to tell V8 about the amount of memory used by the WebMediaPlayer 41 // Callback to tell V8 about the amount of memory used by the WebMediaPlayer
42 // instance. The input parameter is the delta in bytes since the last call to 42 // instance. The input parameter is the delta in bytes since the last call to
43 // AdjustAllocatedMemoryCB and the return value is the total number of bytes 43 // AdjustAllocatedMemoryCB and the return value is the total number of bytes
44 // used by objects external to V8. Note: this value includes things that are 44 // used by objects external to V8. Note: this value includes things that are
45 // not the WebMediaPlayer! 45 // not the WebMediaPlayer!
46 typedef base::Callback<int64_t(int64_t)> AdjustAllocatedMemoryCB; 46 typedef base::Callback<int64_t(int64_t)> AdjustAllocatedMemoryCB;
47 47
48 // |defer_load_cb|, |audio_renderer_sink|, |compositor_task_runner|, and 48 // |defer_load_cb|, |audio_renderer_sink|, |compositor_task_runner|, and
49 // |context_3d_cb| may be null. 49 // |context_3d_cb| may be null.
50 WebMediaPlayerParams( 50 WebMediaPlayerParams(
51 std::unique_ptr<MediaLog> media_log,
51 const DeferLoadCB& defer_load_cb, 52 const DeferLoadCB& defer_load_cb,
52 const scoped_refptr<SwitchableAudioRendererSink>& audio_renderer_sink, 53 const scoped_refptr<SwitchableAudioRendererSink>& audio_renderer_sink,
53 const scoped_refptr<MediaLog>& media_log,
54 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, 54 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
55 const scoped_refptr<base::TaskRunner>& worker_task_runner, 55 const scoped_refptr<base::TaskRunner>& worker_task_runner,
56 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, 56 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner,
57 const Context3DCB& context_3d, 57 const Context3DCB& context_3d,
58 const AdjustAllocatedMemoryCB& adjust_allocated_memory_cb, 58 const AdjustAllocatedMemoryCB& adjust_allocated_memory_cb,
59 blink::WebContentDecryptionModule* initial_cdm, 59 blink::WebContentDecryptionModule* initial_cdm,
60 SurfaceManager* surface_manager, 60 SurfaceManager* surface_manager,
61 base::WeakPtr<MediaObserver> media_observer, 61 base::WeakPtr<MediaObserver> media_observer,
62 base::TimeDelta max_keyframe_distance_to_disable_background_video, 62 base::TimeDelta max_keyframe_distance_to_disable_background_video,
63 base::TimeDelta max_keyframe_distance_to_disable_background_video_mse, 63 base::TimeDelta max_keyframe_distance_to_disable_background_video_mse,
64 bool enable_instant_source_buffer_gc, 64 bool enable_instant_source_buffer_gc,
65 bool allow_suspend, 65 bool allow_suspend,
66 bool embedded_media_experience_enabled); 66 bool embedded_media_experience_enabled);
67 67
68 ~WebMediaPlayerParams(); 68 ~WebMediaPlayerParams();
69 69
70 DeferLoadCB defer_load_cb() const { return defer_load_cb_; } 70 DeferLoadCB defer_load_cb() const { return defer_load_cb_; }
71 71
72 const scoped_refptr<SwitchableAudioRendererSink>& audio_renderer_sink() 72 const scoped_refptr<SwitchableAudioRendererSink>& audio_renderer_sink()
73 const { 73 const {
74 return audio_renderer_sink_; 74 return audio_renderer_sink_;
75 } 75 }
76 76
77 const scoped_refptr<MediaLog>& media_log() const { 77 std::unique_ptr<MediaLog> media_log() { return std::move(media_log_); }
chcunningham 2017/04/18 23:29:12 The sideeffects are a little subtle for anyone not
DaleCurtis 2017/04/18 23:55:45 Done, but I don't think it matters. It's only used
78 return media_log_;
79 }
80 78
81 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner() const { 79 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner() const {
82 return media_task_runner_; 80 return media_task_runner_;
83 } 81 }
84 82
85 const scoped_refptr<base::TaskRunner> worker_task_runner() const { 83 const scoped_refptr<base::TaskRunner> worker_task_runner() const {
86 return worker_task_runner_; 84 return worker_task_runner_;
87 } 85 }
88 86
89 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner() 87 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner()
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 120
123 bool allow_suspend() const { return allow_suspend_; } 121 bool allow_suspend() const { return allow_suspend_; }
124 122
125 bool embedded_media_experience_enabled() const { 123 bool embedded_media_experience_enabled() const {
126 return embedded_media_experience_enabled_; 124 return embedded_media_experience_enabled_;
127 } 125 }
128 126
129 private: 127 private:
130 DeferLoadCB defer_load_cb_; 128 DeferLoadCB defer_load_cb_;
131 scoped_refptr<SwitchableAudioRendererSink> audio_renderer_sink_; 129 scoped_refptr<SwitchableAudioRendererSink> audio_renderer_sink_;
132 scoped_refptr<MediaLog> media_log_; 130 std::unique_ptr<MediaLog> media_log_;
133 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; 131 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
134 scoped_refptr<base::TaskRunner> worker_task_runner_; 132 scoped_refptr<base::TaskRunner> worker_task_runner_;
135 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; 133 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
136 Context3DCB context_3d_cb_; 134 Context3DCB context_3d_cb_;
137 AdjustAllocatedMemoryCB adjust_allocated_memory_cb_; 135 AdjustAllocatedMemoryCB adjust_allocated_memory_cb_;
138 136
139 blink::WebContentDecryptionModule* initial_cdm_; 137 blink::WebContentDecryptionModule* initial_cdm_;
140 SurfaceManager* surface_manager_; 138 SurfaceManager* surface_manager_;
141 base::WeakPtr<MediaObserver> media_observer_; 139 base::WeakPtr<MediaObserver> media_observer_;
142 base::TimeDelta max_keyframe_distance_to_disable_background_video_; 140 base::TimeDelta max_keyframe_distance_to_disable_background_video_;
143 base::TimeDelta max_keyframe_distance_to_disable_background_video_mse_; 141 base::TimeDelta max_keyframe_distance_to_disable_background_video_mse_;
144 bool enable_instant_source_buffer_gc_; 142 bool enable_instant_source_buffer_gc_;
145 const bool allow_suspend_; 143 const bool allow_suspend_;
146 const bool embedded_media_experience_enabled_; 144 const bool embedded_media_experience_enabled_;
147 145
148 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerParams); 146 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerParams);
149 }; 147 };
150 148
151 } // namespace media 149 } // namespace media
152 150
153 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_ 151 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698