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

Side by Side Diff: content/renderer/media/webmediaplayer_ms.h

Issue 2640573002: Remove WebMediaPlayerDelegate null checks (Closed)
Patch Set: Undo accidental delete of WMPI::delegate_ Created 3 years, 11 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 CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_
6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ 6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // 61 //
62 // blink::WebMediaPlayerClient 62 // blink::WebMediaPlayerClient
63 // WebKit client of this media player object. 63 // WebKit client of this media player object.
64 class CONTENT_EXPORT WebMediaPlayerMS 64 class CONTENT_EXPORT WebMediaPlayerMS
65 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), 65 : public NON_EXPORTED_BASE(blink::WebMediaPlayer),
66 public NON_EXPORTED_BASE(media::WebMediaPlayerDelegate::Observer), 66 public NON_EXPORTED_BASE(media::WebMediaPlayerDelegate::Observer),
67 public NON_EXPORTED_BASE(base::SupportsWeakPtr<WebMediaPlayerMS>) { 67 public NON_EXPORTED_BASE(base::SupportsWeakPtr<WebMediaPlayerMS>) {
68 public: 68 public:
69 // Construct a WebMediaPlayerMS with reference to the client, and 69 // Construct a WebMediaPlayerMS with reference to the client, and
70 // a MediaStreamClient which provides MediaStreamVideoRenderer. 70 // a MediaStreamClient which provides MediaStreamVideoRenderer.
71 // |delegate| must not be null.
71 WebMediaPlayerMS( 72 WebMediaPlayerMS(
72 blink::WebFrame* frame, 73 blink::WebFrame* frame,
73 blink::WebMediaPlayerClient* client, 74 blink::WebMediaPlayerClient* client,
74 base::WeakPtr<media::WebMediaPlayerDelegate> delegate, 75 media::WebMediaPlayerDelegate* delegate,
75 media::MediaLog* media_log, 76 media::MediaLog* media_log,
76 std::unique_ptr<MediaStreamRendererFactory> factory, 77 std::unique_ptr<MediaStreamRendererFactory> factory,
77 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_, 78 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_,
78 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner, 79 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner,
79 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, 80 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner,
80 scoped_refptr<base::TaskRunner> worker_task_runner, 81 scoped_refptr<base::TaskRunner> worker_task_runner,
81 media::GpuVideoAcceleratorFactories* gpu_factories, 82 media::GpuVideoAcceleratorFactories* gpu_factories,
82 const blink::WebString& sink_id, 83 const blink::WebString& sink_id,
83 const blink::WebSecurityOrigin& security_origin); 84 const blink::WebSecurityOrigin& security_origin);
84 85
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 blink::WebMediaPlayer::ReadyState ready_state_; 198 blink::WebMediaPlayer::ReadyState ready_state_;
198 199
199 const blink::WebTimeRanges buffered_; 200 const blink::WebTimeRanges buffered_;
200 201
201 blink::WebMediaPlayerClient* const client_; 202 blink::WebMediaPlayerClient* const client_;
202 203
203 // WebMediaPlayer notifies the |delegate_| of playback state changes using 204 // WebMediaPlayer notifies the |delegate_| of playback state changes using
204 // |delegate_id_|; an id provided after registering with the delegate. The 205 // |delegate_id_|; an id provided after registering with the delegate. The
205 // WebMediaPlayer may also receive directives (play, pause) from the delegate 206 // WebMediaPlayer may also receive directives (play, pause) from the delegate
206 // via the WebMediaPlayerDelegate::Observer interface after registration. 207 // via the WebMediaPlayerDelegate::Observer interface after registration.
207 const base::WeakPtr<media::WebMediaPlayerDelegate> delegate_; 208 //
209 // NOTE: HTMLMediaElement is a Blink::SuspendableObject, and will receive a
210 // call to contextDestroyed() when Blink::Document::shutdown() is called.
211 // Document::shutdown() is called before the frame detaches (and before the
212 // frame is destroyed). RenderFrameImpl owns of |delegate_|, and is guaranteed
213 // to outlive |this|. It is therefore safe use a raw pointer directly.
214 media::WebMediaPlayerDelegate* delegate_;
208 int delegate_id_; 215 int delegate_id_;
209 216
210 // Inner class used for transfering frames on compositor thread to 217 // Inner class used for transfering frames on compositor thread to
211 // |compositor_|. 218 // |compositor_|.
212 class FrameDeliverer; 219 class FrameDeliverer;
213 std::unique_ptr<FrameDeliverer> frame_deliverer_; 220 std::unique_ptr<FrameDeliverer> frame_deliverer_;
214 221
215 scoped_refptr<MediaStreamVideoRenderer> video_frame_provider_; // Weak 222 scoped_refptr<MediaStreamVideoRenderer> video_frame_provider_; // Weak
216 223
217 std::unique_ptr<cc_blink::WebLayerImpl> video_weblayer_; 224 std::unique_ptr<cc_blink::WebLayerImpl> video_weblayer_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // True if playback should be started upon the next call to OnShown(). Only 257 // True if playback should be started upon the next call to OnShown(). Only
251 // used on Android. 258 // used on Android.
252 bool should_play_upon_shown_; 259 bool should_play_upon_shown_;
253 260
254 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); 261 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS);
255 }; 262 };
256 263
257 } // namespace content 264 } // namespace content
258 265
259 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ 266 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_
OLDNEW
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.cc ('k') | content/renderer/media/webmediaplayer_ms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698