Persist the page's muted state across web process crashes.
authoradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Nov 2014 18:36:57 +0000 (18:36 +0000)
committeradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Nov 2014 18:36:57 +0000 (18:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=138195

Reviewed by Anders Carlsson.

Store the Page's muted state in WebPageCreationParameters so that state can be properly
restored after recovering from a crash in the web process.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
Initialize m_muted.
(WebKit::WebPageProxy::setMuted):
Update m_muted.
(WebKit::WebPageProxy::creationParameters):
Set the muted data member in WebPageCreationParameters.
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
Initialize the page's muted state with the muted value from WebPageCreationParameters.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175473 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPageCreationParameters.cpp
Source/WebKit2/Shared/WebPageCreationParameters.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 9c762e2..5fae36a 100644 (file)
@@ -1,3 +1,29 @@
+2014-11-03  Ada Chan  <adachan@apple.com>
+
+        Persist the page's muted state across web process crashes.
+        https://bugs.webkit.org/show_bug.cgi?id=138195
+
+        Reviewed by Anders Carlsson.
+
+        Store the Page's muted state in WebPageCreationParameters so that state can be properly
+        restored after recovering from a crash in the web process.
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode):
+        (WebKit::WebPageCreationParameters::decode):
+        * Shared/WebPageCreationParameters.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+        Initialize m_muted.
+        (WebKit::WebPageProxy::setMuted):
+        Update m_muted.
+        (WebKit::WebPageProxy::creationParameters):
+        Set the muted data member in WebPageCreationParameters.
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+        Initialize the page's muted state with the muted value from WebPageCreationParameters.
+
 2014-11-03  Ryuan Choi  <ryuan.choi@gmail.com>
 
         [EFL] Remove dependency of PageViewportController from PageViewportControllerClient
index ac28c70..59ef82a 100644 (file)
@@ -58,6 +58,7 @@ void WebPageCreationParameters::encode(IPC::ArgumentEncoder& encoder) const
     encoder << deviceScaleFactor;
     encoder << topContentInset;
     encoder << mediaVolume;
+    encoder << muted;
     encoder << mayStartMediaWhenInWindow;
     encoder << minimumLayoutSize;
     encoder << autoSizingShouldExpandToViewHeight;
@@ -131,6 +132,8 @@ bool WebPageCreationParameters::decode(IPC::ArgumentDecoder& decoder, WebPageCre
         return false;
     if (!decoder.decode(parameters.mediaVolume))
         return false;
+    if (!decoder.decode(parameters.muted))
+        return false;
     if (!decoder.decode(parameters.mayStartMediaWhenInWindow))
         return false;
     if (!decoder.decode(parameters.minimumLayoutSize))
index d52ce3a..1023b36 100644 (file)
@@ -95,6 +95,7 @@ struct WebPageCreationParameters {
     float topContentInset;
     
     float mediaVolume;
+    bool muted;
     bool mayStartMediaWhenInWindow;
 
     WebCore::IntSize minimumLayoutSize;
index bcfe364..5e01a0d 100644 (file)
@@ -363,6 +363,7 @@ WebPageProxy::WebPageProxy(PageClient& pageClient, WebProcessProxy& process, uin
     , m_suppressVisibilityUpdates(false)
     , m_autoSizingShouldExpandToViewHeight(false)
     , m_mediaVolume(1)
+    , m_muted(false)
     , m_mayStartMediaWhenInWindow(true)
     , m_scrollPinningBehavior(DoNotPin)
     , m_navigationID(0)
@@ -3385,6 +3386,11 @@ void WebPageProxy::setMediaVolume(float volume)
 
 void WebPageProxy::setMuted(bool muted)
 {
+    if (m_muted == muted)
+        return;
+
+    m_muted = muted;
+
     if (!isValid())
         return;
 
@@ -4572,6 +4578,7 @@ WebPageCreationParameters WebPageProxy::creationParameters()
     parameters.deviceScaleFactor = deviceScaleFactor();
     parameters.topContentInset = m_topContentInset;
     parameters.mediaVolume = m_mediaVolume;
+    parameters.muted = m_muted;
     parameters.mayStartMediaWhenInWindow = m_mayStartMediaWhenInWindow;
     parameters.minimumLayoutSize = m_minimumLayoutSize;
     parameters.autoSizingShouldExpandToViewHeight = m_autoSizingShouldExpandToViewHeight;
index bfe7b31..e198653 100644 (file)
@@ -1554,6 +1554,7 @@ private:
     WebCore::IntSize m_minimumLayoutSize;
 
     float m_mediaVolume;
+    bool m_muted;
     bool m_mayStartMediaWhenInWindow;
 
     bool m_waitingForDidUpdateViewState;
index d40249a..cf00e18 100644 (file)
@@ -446,6 +446,8 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
     
     setMediaVolume(parameters.mediaVolume);
 
+    setMuted(parameters.muted);
+
     // We use the DidFirstVisuallyNonEmptyLayout milestone to determine when to unfreeze the layer tree.
     m_page->addLayoutMilestones(DidFirstLayout | DidFirstVisuallyNonEmptyLayout);