Changeset 135819 in webkit
- Timestamp:
- Nov 26, 2012 10:34:35 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r135818 r135819 1 2012-11-26 Dan Bernstein <mitz@apple.com> 2 3 <rdar://problem/11931191> Entering Tab View after a bunch of YouTube pages were opened in background tabs makes all of them start playing simultaneously 4 https://bugs.webkit.org/show_bug.cgi?id=103358 5 6 Reviewed by Adele Peterson. 7 8 To fix this, this patch adds WKPageSetMayStartMediaWhenInWindow(), which allows the client to 9 prevent media from starting automatically when the view is put in a window. 10 11 * Shared/WebPageCreationParameters.cpp: 12 (WebKit::WebPageCreationParameters::encode): Encode mayStartMediaWhenInWindow. 13 (WebKit::WebPageCreationParameters::decode): Decode mayStartMediaWhenInWindow. 14 * Shared/WebPageCreationParameters.h: 15 (WebPageCreationParameters): Added boolean member mayStartMediaWhenInWindow. 16 * UIProcess/API/C/WKPage.cpp: 17 (WKPageSetMayStartMediaWhenInWindow): Added. Calls through to WebPageProxy. 18 * UIProcess/API/C/WKPagePrivate.h: Declared WKPageSetMayStartMediaWhenInWindow. 19 * UIProcess/WebPageProxy.cpp: 20 (WebKit::WebPageProxy::WebPageProxy): Added initializiation of m_mayStartMediaWhenInWindow 21 to true, the value matching the current behavior. 22 (WebKit::WebPageProxy::setMayStartMediaWhenInWindow): Added. Updates 23 m_mayStartMediaWhenInWindow and sends a message to the Web process to do the same. 24 (WebKit::WebPageProxy::creationParameters): Changed to set mayStartMediaWhenInWindow in the 25 process creation parameters. 26 * UIProcess/WebPageProxy.h: 27 (WebPageProxy): Declared setMayStartMediaWhenInWindow() and added member variable 28 m_mayStartMediaWhenInWindow. 29 * WebProcess/WebPage/WebPage.cpp: 30 (WebKit::WebPage::WebPage): Initialized m_mayStartMediaWhenInWindow from the creation 31 parameters. 32 (WebKit::WebPage::setIsInWindow): Made starting of media upon being added to a window 33 conditional on m_mayStartMediaWhenInWindow. 34 (WebKit::WebPage::setMayStartMediaWhenInWindow): Added. Sets m_mayStartMediaWhenInWindow. If 35 already in a window when changing from false to true, starts m_setCanStartMediaTimer. 36 * WebProcess/WebPage/WebPage.h: 37 (WebPage): Declared setMayStartMediaWhenInWindow() and added member variable m_mayStartMediaWhenInWindow. 38 * WebProcess/WebPage/WebPage.messages.in: Added SetMayStartMediaWhenInWindow. 39 1 40 2012-11-26 Huang Dongsung <luxtella@company100.net> 2 41 -
trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp
r132926 r135819 58 58 encoder << deviceScaleFactor; 59 59 encoder << mediaVolume; 60 encoder << mayStartMediaWhenInWindow; 60 61 61 62 #if PLATFORM(MAC) … … 120 121 if (!decoder->decode(parameters.mediaVolume)) 121 122 return false; 123 if (!decoder->decode(parameters.mayStartMediaWhenInWindow)) 124 return false; 122 125 123 126 #if PLATFORM(MAC) -
trunk/Source/WebKit2/Shared/WebPageCreationParameters.h
r132361 r135819 86 86 87 87 float mediaVolume; 88 bool mayStartMediaWhenInWindow; 88 89 89 90 #if PLATFORM(MAC) -
trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp
r133828 r135819 765 765 return toAPI(toImpl(pageRef)->relatedPages().leakRef()); 766 766 } 767 768 void WKPageSetMayStartMediaWhenInWindow(WKPageRef pageRef, bool mayStartMedia) 769 { 770 toImpl(pageRef)->setMayStartMediaWhenInWindow(mayStartMedia); 771 } -
trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
r130214 r135819 94 94 95 95 WK_EXPORT void WKPageSetMediaVolume(WKPageRef page, float volume); 96 WK_EXPORT void WKPageSetMayStartMediaWhenInWindow(WKPageRef page, bool mayStartMedia); 96 97 97 98 WK_EXPORT WKArrayRef WKPageCopyRelatedPages(WKPageRef page); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r135066 r135819 235 235 , m_suppressVisibilityUpdates(false) 236 236 , m_mediaVolume(1) 237 , m_mayStartMediaWhenInWindow(true) 237 238 #if ENABLE(PAGE_VISIBILITY_API) 238 239 , m_visibilityState(PageVisibilityStateVisible) … … 2781 2782 2782 2783 m_process->send(Messages::WebPage::SetMediaVolume(volume), m_pageID); 2784 } 2785 2786 void WebPageProxy::setMayStartMediaWhenInWindow(bool mayStartMedia) 2787 { 2788 if (mayStartMedia == m_mayStartMediaWhenInWindow) 2789 return; 2790 2791 m_mayStartMediaWhenInWindow = mayStartMedia; 2792 2793 if (!isValid()) 2794 return; 2795 2796 process()->send(Messages::WebPage::SetMayStartMediaWhenInWindow(mayStartMedia), m_pageID); 2783 2797 } 2784 2798 … … 3764 3778 parameters.deviceScaleFactor = m_intrinsicDeviceScaleFactor; 3765 3779 parameters.mediaVolume = m_mediaVolume; 3780 parameters.mayStartMediaWhenInWindow = m_mayStartMediaWhenInWindow; 3766 3781 3767 3782 #if PLATFORM(MAC) -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r134820 r135819 737 737 738 738 void setMediaVolume(float); 739 void setMayStartMediaWhenInWindow(bool); 739 740 740 741 // WebPopupMenuProxy::Client … … 1239 1240 1240 1241 float m_mediaVolume; 1242 bool m_mayStartMediaWhenInWindow; 1241 1243 1242 1244 #if PLATFORM(QT) -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r135803 r135819 365 365 366 366 setMediaVolume(parameters.mediaVolume); 367 m_mayStartMediaWhenInWindow = parameters.mayStartMediaWhenInWindow; 367 368 368 369 WebProcess::shared().addMessageReceiver(Messages::WebPage::messageReceiverName(), m_pageID, this); … … 1893 1894 // in order to get plug-in connections, and the UI process will be waiting for the Web process to update the backing 1894 1895 // store after moving the view into a window, until it times out and paints white. See <rdar://problem/9242771>. 1895 m_setCanStartMediaTimer.startOneShot(0); 1896 if (m_mayStartMediaWhenInWindow) 1897 m_setCanStartMediaTimer.startOneShot(0); 1898 1896 1899 m_page->didMoveOnscreen(); 1897 1900 } … … 3318 3321 } 3319 3322 3323 void WebPage::setMayStartMediaWhenInWindow(bool mayStartMedia) 3324 { 3325 if (mayStartMedia == m_mayStartMediaWhenInWindow) 3326 return; 3327 3328 m_mayStartMediaWhenInWindow = mayStartMedia; 3329 if (m_mayStartMediaWhenInWindow && m_page->isOnscreen()) 3330 m_setCanStartMediaTimer.startOneShot(0); 3331 } 3332 3320 3333 void WebPage::runModal() 3321 3334 { -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r134953 r135819 526 526 527 527 void setMediaVolume(float); 528 void setMayStartMediaWhenInWindow(bool); 528 529 529 530 bool mainFrameHasCustomRepresentation() const; … … 852 853 853 854 WebCore::RunLoop::Timer<WebPage> m_setCanStartMediaTimer; 855 bool m_mayStartMediaWhenInWindow; 854 856 855 857 HashMap<uint64_t, RefPtr<WebUndoStep> > m_undoStepMap; -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r133935 r135819 227 227 # Media 228 228 SetMediaVolume(float volume) 229 SetMayStartMediaWhenInWindow(bool mayStartMedia) 229 230 230 231 SetMemoryCacheMessagesEnabled(bool memoryCacheMessagesEnabled)
Note: See TracChangeset
for help on using the changeset viewer.