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

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: Fixed compile for EmptyClients.cpp 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>
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 v8::Isolate* isolate = v8::Isolate::GetCurrent();
482 ScriptState* scriptState = ScriptState::from(isolate->GetCurrentContext());
haraken 2016/11/08 23:50:40 You shouldn't use isolate->GetCurrentContext() unl
whywhat 2016/11/09 00:22:02 Tests actually crash because context seems to be e
483 m_remotePlaybackClient =
484 frame->loader().client()->createWebRemotePlaybackClient(scriptState,
485 *this);
486 }
487
478 setHasCustomStyleCallbacks(); 488 setHasCustomStyleCallbacks();
479 addElementToDocumentMap(this, &document); 489 addElementToDocumentMap(this, &document);
480 490
481 UseCounter::count(document, UseCounter::HTMLMediaElement); 491 UseCounter::count(document, UseCounter::HTMLMediaElement);
482 } 492 }
483 493
484 HTMLMediaElement::~HTMLMediaElement() { 494 HTMLMediaElement::~HTMLMediaElement() {
485 BLINK_MEDIA_LOG << "~HTMLMediaElement(" << (void*)this << ")"; 495 BLINK_MEDIA_LOG << "~HTMLMediaElement(" << (void*)this << ")";
486 496
487 // m_audioSourceNode is explicitly cleared by AudioNode::dispose(). 497 // m_audioSourceNode is explicitly cleared by AudioNode::dispose().
(...skipping 3444 matching lines...) Expand 10 before | Expand all | Expand 10 after
3932 3942
3933 void HTMLMediaElement::notifyPositionMayHaveChanged( 3943 void HTMLMediaElement::notifyPositionMayHaveChanged(
3934 const IntRect& visibleRect) { 3944 const IntRect& visibleRect) {
3935 m_autoplayHelper->positionChanged(visibleRect); 3945 m_autoplayHelper->positionChanged(visibleRect);
3936 } 3946 }
3937 3947
3938 void HTMLMediaElement::updatePositionNotificationRegistration() { 3948 void HTMLMediaElement::updatePositionNotificationRegistration() {
3939 m_autoplayHelper->updatePositionNotificationRegistration(); 3949 m_autoplayHelper->updatePositionNotificationRegistration();
3940 } 3950 }
3941 3951
3942 void HTMLMediaElement::setRemotePlaybackClient(
3943 WebRemotePlaybackClient* client) {
3944 m_remotePlaybackClient = client;
3945 }
3946
3947 // TODO(liberato): remove once autoplay gesture override experiment concludes. 3952 // TODO(liberato): remove once autoplay gesture override experiment concludes.
3948 void HTMLMediaElement::triggerAutoplayViewportCheckForTesting() { 3953 void HTMLMediaElement::triggerAutoplayViewportCheckForTesting() {
3949 if (FrameView* view = document().view()) 3954 if (FrameView* view = document().view())
3950 m_autoplayHelper->positionChanged( 3955 m_autoplayHelper->positionChanged(
3951 view->rootFrameToContents(view->computeVisibleArea())); 3956 view->rootFrameToContents(view->computeVisibleArea()));
3952 m_autoplayHelper->triggerAutoplayViewportCheckForTesting(); 3957 m_autoplayHelper->triggerAutoplayViewportCheckForTesting();
3953 } 3958 }
3954 3959
3955 void HTMLMediaElement::scheduleResolvePlayPromises() { 3960 void HTMLMediaElement::scheduleResolvePlayPromises() {
3956 // TODO(mlamouri): per spec, we should create a new task but we can't create 3961 // 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 4183
4179 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() 4184 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect()
4180 const { 4185 const {
4181 IntRect result; 4186 IntRect result;
4182 if (LayoutObject* object = m_element->layoutObject()) 4187 if (LayoutObject* object = m_element->layoutObject())
4183 result = object->absoluteBoundingBoxRect(); 4188 result = object->absoluteBoundingBoxRect();
4184 return result; 4189 return result;
4185 } 4190 }
4186 4191
4187 } // namespace blink 4192 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698