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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2484973005: [Blink, RemotePlaybackAPI] Create WebRemotePlaybackClient in HTMLMediaElement ctor to avoid lazy in… (Closed)
Patch Set: Removed m_scriptState from RemotePlayback Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 #include "public/platform/WebInbandTextTrack.h" 89 #include "public/platform/WebInbandTextTrack.h"
90 #include "public/platform/WebMediaPlayerSource.h" 90 #include "public/platform/WebMediaPlayerSource.h"
91 #include "public/platform/WebMediaStream.h" 91 #include "public/platform/WebMediaStream.h"
92 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" 92 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h"
93 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" 93 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h"
94 #include "wtf/CurrentTime.h" 94 #include "wtf/CurrentTime.h"
95 #include "wtf/MathExtras.h" 95 #include "wtf/MathExtras.h"
96 #include "wtf/PtrUtil.h" 96 #include "wtf/PtrUtil.h"
97 #include "wtf/text/CString.h" 97 #include "wtf/text/CString.h"
98 #include <limits> 98 #include <limits>
99 #include <v8.h>
haraken 2016/11/09 02:46:41 Remove this.
whywhat 2016/11/09 03:06:37 Done.
99 100
100 #ifndef BLINK_MEDIA_LOG 101 #ifndef BLINK_MEDIA_LOG
101 #define BLINK_MEDIA_LOG DVLOG(3) 102 #define BLINK_MEDIA_LOG DVLOG(3)
102 #endif 103 #endif
103 104
104 #ifndef LOG_MEDIA_EVENTS 105 #ifndef LOG_MEDIA_EVENTS
105 // Default to not logging events because so many are generated they can 106 // Default to not logging events because so many are generated they can
106 // overwhelm the rest of the logging. 107 // overwhelm the rest of the logging.
107 #define LOG_MEDIA_EVENTS 0 108 #define LOG_MEDIA_EVENTS 0
108 #endif 109 #endif
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 BLINK_MEDIA_LOG << "HTMLMediaElement(" << (void*)this << ")"; 469 BLINK_MEDIA_LOG << "HTMLMediaElement(" << (void*)this << ")";
469 470
470 // If any experiment is enabled, then we want to enable a user gesture by 471 // If any experiment is enabled, then we want to enable a user gesture by
471 // default, otherwise the experiment does nothing. 472 // default, otherwise the experiment does nothing.
472 if ((document.settings() && 473 if ((document.settings() &&
473 document.settings()->mediaPlaybackRequiresUserGesture()) || 474 document.settings()->mediaPlaybackRequiresUserGesture()) ||
474 m_autoplayHelper->isExperimentEnabled()) { 475 m_autoplayHelper->isExperimentEnabled()) {
475 m_lockedPendingUserGesture = true; 476 m_lockedPendingUserGesture = true;
476 } 477 }
477 478
479 LocalFrame* frame = document.frame();
480 if (frame) {
481 m_remotePlaybackClient =
482 frame->loader().client()->createWebRemotePlaybackClient(*this);
483 }
484
478 setHasCustomStyleCallbacks(); 485 setHasCustomStyleCallbacks();
479 addElementToDocumentMap(this, &document); 486 addElementToDocumentMap(this, &document);
480 487
481 UseCounter::count(document, UseCounter::HTMLMediaElement); 488 UseCounter::count(document, UseCounter::HTMLMediaElement);
482 } 489 }
483 490
484 HTMLMediaElement::~HTMLMediaElement() { 491 HTMLMediaElement::~HTMLMediaElement() {
485 BLINK_MEDIA_LOG << "~HTMLMediaElement(" << (void*)this << ")"; 492 BLINK_MEDIA_LOG << "~HTMLMediaElement(" << (void*)this << ")";
486 493
487 // m_audioSourceNode is explicitly cleared by AudioNode::dispose(). 494 // m_audioSourceNode is explicitly cleared by AudioNode::dispose().
(...skipping 3444 matching lines...) Expand 10 before | Expand all | Expand 10 after
3932 3939
3933 void HTMLMediaElement::notifyPositionMayHaveChanged( 3940 void HTMLMediaElement::notifyPositionMayHaveChanged(
3934 const IntRect& visibleRect) { 3941 const IntRect& visibleRect) {
3935 m_autoplayHelper->positionChanged(visibleRect); 3942 m_autoplayHelper->positionChanged(visibleRect);
3936 } 3943 }
3937 3944
3938 void HTMLMediaElement::updatePositionNotificationRegistration() { 3945 void HTMLMediaElement::updatePositionNotificationRegistration() {
3939 m_autoplayHelper->updatePositionNotificationRegistration(); 3946 m_autoplayHelper->updatePositionNotificationRegistration();
3940 } 3947 }
3941 3948
3942 void HTMLMediaElement::setRemotePlaybackClient(
3943 WebRemotePlaybackClient* client) {
3944 m_remotePlaybackClient = client;
3945 }
3946
3947 // TODO(liberato): remove once autoplay gesture override experiment concludes. 3949 // TODO(liberato): remove once autoplay gesture override experiment concludes.
3948 void HTMLMediaElement::triggerAutoplayViewportCheckForTesting() { 3950 void HTMLMediaElement::triggerAutoplayViewportCheckForTesting() {
3949 if (FrameView* view = document().view()) 3951 if (FrameView* view = document().view())
3950 m_autoplayHelper->positionChanged( 3952 m_autoplayHelper->positionChanged(
3951 view->rootFrameToContents(view->computeVisibleArea())); 3953 view->rootFrameToContents(view->computeVisibleArea()));
3952 m_autoplayHelper->triggerAutoplayViewportCheckForTesting(); 3954 m_autoplayHelper->triggerAutoplayViewportCheckForTesting();
3953 } 3955 }
3954 3956
3955 void HTMLMediaElement::scheduleResolvePlayPromises() { 3957 void HTMLMediaElement::scheduleResolvePlayPromises() {
3956 // TODO(mlamouri): per spec, we should create a new task but we can't create 3958 // TODO(mlamouri): per spec, we should create a new task but we can't create
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
4178 4180
4179 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() 4181 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect()
4180 const { 4182 const {
4181 IntRect result; 4183 IntRect result;
4182 if (LayoutObject* object = m_element->layoutObject()) 4184 if (LayoutObject* object = m_element->layoutObject())
4183 result = object->absoluteBoundingBoxRect(); 4185 result = object->absoluteBoundingBoxRect();
4184 return result; 4186 return result;
4185 } 4187 }
4186 4188
4187 } // namespace blink 4189 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698