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

Side by Side Diff: media/blink/webmediaplayer_impl.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
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | media/blink/webmediaplayer_impl.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_IMPL_H_ 5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // The canonical implementation of blink::WebMediaPlayer that's backed by 83 // The canonical implementation of blink::WebMediaPlayer that's backed by
84 // Pipeline. Handles normal resource loading, Media Source, and 84 // Pipeline. Handles normal resource loading, Media Source, and
85 // Encrypted Media. 85 // Encrypted Media.
86 class MEDIA_BLINK_EXPORT WebMediaPlayerImpl 86 class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
87 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), 87 : public NON_EXPORTED_BASE(blink::WebMediaPlayer),
88 public NON_EXPORTED_BASE(WebMediaPlayerDelegate::Observer), 88 public NON_EXPORTED_BASE(WebMediaPlayerDelegate::Observer),
89 public NON_EXPORTED_BASE(Pipeline::Client), 89 public NON_EXPORTED_BASE(Pipeline::Client),
90 public base::SupportsWeakPtr<WebMediaPlayerImpl> { 90 public base::SupportsWeakPtr<WebMediaPlayerImpl> {
91 public: 91 public:
92 // Constructs a WebMediaPlayer implementation using Chromium's media stack. 92 // Constructs a WebMediaPlayer implementation using Chromium's media stack.
93 // |delegate| may be null. |renderer_factory| must not be null. 93 // |delegate| and |renderer_factory| must not be null.
94 WebMediaPlayerImpl( 94 WebMediaPlayerImpl(
95 blink::WebLocalFrame* frame, 95 blink::WebLocalFrame* frame,
96 blink::WebMediaPlayerClient* client, 96 blink::WebMediaPlayerClient* client,
97 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, 97 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
98 base::WeakPtr<WebMediaPlayerDelegate> delegate, 98 WebMediaPlayerDelegate* delegate,
99 std::unique_ptr<RendererFactory> renderer_factory, 99 std::unique_ptr<RendererFactory> renderer_factory,
100 linked_ptr<UrlIndex> url_index, 100 linked_ptr<UrlIndex> url_index,
101 const WebMediaPlayerParams& params); 101 const WebMediaPlayerParams& params);
102 ~WebMediaPlayerImpl() override; 102 ~WebMediaPlayerImpl() override;
103 103
104 void load(LoadType load_type, 104 void load(LoadType load_type,
105 const blink::WebMediaPlayerSource& source, 105 const blink::WebMediaPlayerSource& source,
106 CORSMode cors_mode) override; 106 CORSMode cors_mode) override;
107 107
108 // Playback controls. 108 // Playback controls.
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // Whether the current decoder requires a restart on overlay transitions. 511 // Whether the current decoder requires a restart on overlay transitions.
512 bool decoder_requires_restart_for_overlay_; 512 bool decoder_requires_restart_for_overlay_;
513 513
514 blink::WebMediaPlayerClient* client_; 514 blink::WebMediaPlayerClient* client_;
515 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client_; 515 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client_;
516 516
517 // WebMediaPlayer notifies the |delegate_| of playback state changes using 517 // WebMediaPlayer notifies the |delegate_| of playback state changes using
518 // |delegate_id_|; an id provided after registering with the delegate. The 518 // |delegate_id_|; an id provided after registering with the delegate. The
519 // WebMediaPlayer may also receive directives (play, pause) from the delegate 519 // WebMediaPlayer may also receive directives (play, pause) from the delegate
520 // via the WebMediaPlayerDelegate::Observer interface after registration. 520 // via the WebMediaPlayerDelegate::Observer interface after registration.
521 base::WeakPtr<WebMediaPlayerDelegate> delegate_; 521 //
522 // NOTE: HTMLMediaElement is a Blink::SuspendableObject, and will receive a
523 // call to contextDestroyed() when Blink::Document::shutdown() is called.
524 // Document::shutdown() is called before the frame detaches (and before the
525 // frame is destroyed). RenderFrameImpl owns |delegate_| and is guaranteed
526 // to outlive |this|; thus it is safe to store |delegate_| as a raw pointer.
527 media::WebMediaPlayerDelegate* delegate_;
522 int delegate_id_; 528 int delegate_id_;
523 529
524 WebMediaPlayerParams::DeferLoadCB defer_load_cb_; 530 WebMediaPlayerParams::DeferLoadCB defer_load_cb_;
525 WebMediaPlayerParams::Context3DCB context_3d_cb_; 531 WebMediaPlayerParams::Context3DCB context_3d_cb_;
526 532
527 // Members for notifying upstream clients about internal memory usage. The 533 // Members for notifying upstream clients about internal memory usage. The
528 // |adjust_allocated_memory_cb_| must only be called on |main_task_runner_|. 534 // |adjust_allocated_memory_cb_| must only be called on |main_task_runner_|.
529 base::RepeatingTimer memory_usage_reporting_timer_; 535 base::RepeatingTimer memory_usage_reporting_timer_;
530 WebMediaPlayerParams::AdjustAllocatedMemoryCB adjust_allocated_memory_cb_; 536 WebMediaPlayerParams::AdjustAllocatedMemoryCB adjust_allocated_memory_cb_;
531 int64_t last_reported_memory_usage_; 537 int64_t last_reported_memory_usage_;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 671
666 // Pipeline media duration overridden by tests. 672 // Pipeline media duration overridden by tests.
667 base::Optional<base::TimeDelta> pipeline_media_duration_for_test_; 673 base::Optional<base::TimeDelta> pipeline_media_duration_for_test_;
668 674
669 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 675 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
670 }; 676 };
671 677
672 } // namespace media 678 } // namespace media
673 679
674 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 680 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698