<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[175112] branches/safari-600.3-branch/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/175112">175112</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2014-10-23 02:30:47 -0700 (Thu, 23 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/173694">r173694</a>.  rdar://problem/18428706</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6003branchSourceWebCoreChangeLog">branches/safari-600.3-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6003branchSourceWebCorebindingsjsJSPluginElementFunctionscpp">branches/safari-600.3-branch/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp</a></li>
<li><a href="#branchessafari6003branchSourceWebCorehtmlHTMLPlugInElementcpp">branches/safari-600.3-branch/Source/WebCore/html/HTMLPlugInElement.cpp</a></li>
<li><a href="#branchessafari6003branchSourceWebCorehtmlHTMLPlugInElementh">branches/safari-600.3-branch/Source/WebCore/html/HTMLPlugInElement.h</a></li>
<li><a href="#branchessafari6003branchSourceWebCorepageDOMTimercpp">branches/safari-600.3-branch/Source/WebCore/page/DOMTimer.cpp</a></li>
<li><a href="#branchessafari6003branchSourceWebCorepageDOMTimerh">branches/safari-600.3-branch/Source/WebCore/page/DOMTimer.h</a></li>
<li><a href="#branchessafari6003branchSourceWebCorepluginsPluginViewBaseh">branches/safari-600.3-branch/Source/WebCore/plugins/PluginViewBase.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2ChangeLog">branches/safari-600.3-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2PluginProcessWebProcessConnectioncpp">branches/safari-600.3-branch/Source/WebKit2/PluginProcess/WebProcessConnection.cpp</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2WebProcessPluginsNetscapeNPRuntimeObjectMapcpp">branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2WebProcessPluginsPluginViewcpp">branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2WebProcessPluginsPluginViewh">branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/PluginView.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6003branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/ChangeLog (175111 => 175112)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/ChangeLog        2014-10-23 09:29:10 UTC (rev 175111)
+++ branches/safari-600.3-branch/Source/WebCore/ChangeLog        2014-10-23 09:30:47 UTC (rev 175112)
</span><span class="lines">@@ -1,5 +1,54 @@
</span><span class="cx"> 2014-10-23  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r173694.
+
+    2014-09-17  Gavin Barraclough  &lt;barraclough@apple.com&gt;
+
+            DOM timer throttling for hidden plugins
+            https://bugs.webkit.org/show_bug.cgi?id=136197
+
+            Reviewed by Geoff Garen &amp; Andreas Kling.
+
+            For non-visible web pages we slow timers (since they can't be driving animations, etc).
+            We should do the same for plugins.
+
+            There are a few steps to this:
+                - JSPluginElementFunctions notifies DOMTimer when script interacts with a plugin.
+                - DOMTimerFireState keeps a record of events that occur while a timer is firing.
+                - DOMTimer::fired detects timers that interact with invisible/inaudible plugins, and flags itself for throtting.
+                - DOMTimer::intervalClampedToMinimum sets timer intervals appropriately.
+
+            * bindings/js/JSPluginElementFunctions.cpp:
+            (WebCore::pluginScriptObject):
+                - notify DOMTimer when script interacts with a plugin.
+            * html/HTMLPlugInElement.cpp:
+            (WebCore::HTMLPlugInElement::isDetectable):
+            * html/HTMLPlugInElement.h:
+                - added isDetectable, to check for visible / audible plugins.
+            * page/DOMTimer.cpp:
+            (WebCore::DOMTimerFireState::DOMTimerFireState):
+            (WebCore::DOMTimerFireState::~DOMTimerFireState):
+                - track current DOMTimerFireState.
+            (WebCore::DOMTimer::DOMTimer):
+                - initialize m_throttleState.
+            (WebCore::DOMTimer::scriptDidInteractWithPlugin):
+                - if interaction with a plugin occurs while a timer is firing, record on the DOMTimerFireState.
+            (WebCore::DOMTimer::fired):
+                - set DOMTimerFireState, and update m_throttleState accordingly.
+            (WebCore::DOMTimer::updateTimerIntervalIfNecessary):
+                - remove redundant check of maxTimerNestingLevel (covered by intervalClampedToMinimum).
+            (WebCore::DOMTimer::intervalClampedToMinimum):
+                - Also take m_throttleState into account when throttling.
+            * page/DOMTimer.h:
+                - added scriptDidInteractWithPlugin, m_throttleState.
+            * platform/audio/AudioHardwareListener.h:
+                - enum -&gt; enum class.
+            * plugins/PluginViewBase.h:
+            (WebCore::PluginViewBase::audioHardwareActivity):
+                - expose audioHardwareActivity on PluginViewBase (previously available in subclass).
+
+2014-10-23  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
</ins><span class="cx">         Merge r173208.
</span><span class="cx"> 
</span><span class="cx">     2014-08-29  Gavin Barraclough  &lt;barraclough@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCorebindingsjsJSPluginElementFunctionscpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp (175111 => 175112)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp        2014-10-23 09:29:10 UTC (rev 175111)
+++ branches/safari-600.3-branch/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp        2014-10-23 09:30:47 UTC (rev 175112)
</span><span class="lines">@@ -82,6 +82,9 @@
</span><span class="cx"> 
</span><span class="cx">     HTMLPlugInElement&amp; pluginElement = toHTMLPlugInElement(element);
</span><span class="cx"> 
</span><ins>+    // Choke point for script/plugin interaction; notify DOMTimer of the event.
+    DOMTimer::scriptDidInteractWithPlugin(pluginElement);
+
</ins><span class="cx">     // First, see if the element has a plug-in replacement with a script.
</span><span class="cx">     if (JSObject* scriptObject = pluginElement.scriptObjectForPluginReplacement())
</span><span class="cx">         return scriptObject;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCorehtmlHTMLPlugInElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/html/HTMLPlugInElement.cpp (175111 => 175112)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/html/HTMLPlugInElement.cpp        2014-10-23 09:29:10 UTC (rev 175111)
+++ branches/safari-600.3-branch/Source/WebCore/html/HTMLPlugInElement.cpp        2014-10-23 09:30:47 UTC (rev 175112)
</span><span class="lines">@@ -253,6 +253,23 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool HTMLPlugInElement::isUserObservable() const
+{
+    // No widget - can't be anything to see or hear here.
+    Widget* widget = pluginWidget();
+    if (!widget || !widget-&gt;isPluginViewBase())
+        return false;
+
+    PluginViewBase* pluginView = toPluginViewBase(widget);
+
+    // If audio is playing (or might be) then the plugin is detectable.
+    if (pluginView-&gt;audioHardwareActivity() != AudioHardwareActivityType::IsInactive)
+        return true;
+
+    // If the plugin is visible and not vanishingly small in either dimension it is detectable.
+    return pluginView-&gt;isVisible() &amp;&amp; widget-&gt;width() &gt; 2 &amp;&amp; widget-&gt;height() &gt; 2;
+}
+
</ins><span class="cx"> bool HTMLPlugInElement::supportsFocus() const
</span><span class="cx"> {
</span><span class="cx">     if (HTMLFrameOwnerElement::supportsFocus())
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCorehtmlHTMLPlugInElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/html/HTMLPlugInElement.h (175111 => 175112)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/html/HTMLPlugInElement.h        2014-10-23 09:29:10 UTC (rev 175111)
+++ branches/safari-600.3-branch/Source/WebCore/html/HTMLPlugInElement.h        2014-10-23 09:30:47 UTC (rev 175112)
</span><span class="lines">@@ -88,6 +88,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool isPlugInImageElement() const { return false; }
</span><span class="cx"> 
</span><ins>+    bool isUserObservable() const;
+    
</ins><span class="cx"> protected:
</span><span class="cx">     HTMLPlugInElement(const QualifiedName&amp; tagName, Document&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCorepageDOMTimercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/page/DOMTimer.cpp (175111 => 175112)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/page/DOMTimer.cpp        2014-10-23 09:29:10 UTC (rev 175111)
+++ branches/safari-600.3-branch/Source/WebCore/page/DOMTimer.cpp        2014-10-23 09:30:47 UTC (rev 175112)
</span><span class="lines">@@ -27,7 +27,9 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;DOMTimer.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;HTMLPlugInElement.h&quot;
</ins><span class="cx"> #include &quot;InspectorInstrumentation.h&quot;
</span><ins>+#include &quot;PluginViewBase.h&quot;
</ins><span class="cx"> #include &quot;ScheduledAction.h&quot;
</span><span class="cx"> #include &quot;ScriptExecutionContext.h&quot;
</span><span class="cx"> #include &quot;UserGestureIndicator.h&quot;
</span><span class="lines">@@ -46,9 +48,42 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> static const int maxIntervalForUserGestureForwarding = 1000; // One second matches Gecko.
</span><ins>+static const int minIntervalForNonUserObservablePluginScriptTimers = 1000; // Empirically determined to maximize battery life.
</ins><span class="cx"> static const int maxTimerNestingLevel = 5;
</span><span class="cx"> static const double oneMillisecond = 0.001;
</span><span class="cx"> 
</span><ins>+struct DOMTimerFireState {
+    DOMTimerFireState(ScriptExecutionContext* context)
+        : scriptDidInteractWithNonUserObservablePlugin(false)
+        , scriptDidInteractWithUserObservablePlugin(false)
+        , shouldSetCurrent(context-&gt;isDocument())
+    {
+        // For worker threads, don't update the current DOMTimerFireState.
+        // Setting this from workers would not be thread-safe, and its not relevant to current uses.
+        if (shouldSetCurrent) {
+            previous = current;
+            current = this;
+        }
+    }
+
+    ~DOMTimerFireState()
+    {
+        if (shouldSetCurrent)
+            current = previous;
+    }
+
+    static DOMTimerFireState* current;
+
+    bool scriptDidInteractWithNonUserObservablePlugin;
+    bool scriptDidInteractWithUserObservablePlugin;
+
+private:
+    bool shouldSetCurrent;
+    DOMTimerFireState* previous;
+};
+
+DOMTimerFireState* DOMTimerFireState::current = nullptr;
+
</ins><span class="cx"> static inline bool shouldForwardUserGesture(int interval, int nestingLevel)
</span><span class="cx"> {
</span><span class="cx">     return UserGestureIndicator::processingUserGesture()
</span><span class="lines">@@ -61,6 +96,7 @@
</span><span class="cx">     , m_nestingLevel(context-&gt;timerNestingLevel())
</span><span class="cx">     , m_action(WTF::move(action))
</span><span class="cx">     , m_originalInterval(interval)
</span><ins>+    , m_throttleState(Undetermined)
</ins><span class="cx">     , m_currentTimerInterval(intervalClampedToMinimum())
</span><span class="cx">     , m_shouldForwardUserGesture(shouldForwardUserGesture(interval, m_nestingLevel))
</span><span class="cx"> {
</span><span class="lines">@@ -112,6 +148,17 @@
</span><span class="cx">     context-&gt;removeTimeout(timeoutId);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void DOMTimer::scriptDidInteractWithPlugin(HTMLPlugInElement&amp; pluginElement)
+{
+    if (!DOMTimerFireState::current)
+        return;
+
+    if (pluginElement.isUserObservable())
+        DOMTimerFireState::current-&gt;scriptDidInteractWithUserObservablePlugin = true;
+    else
+        DOMTimerFireState::current-&gt;scriptDidInteractWithNonUserObservablePlugin = true;
+}
+
</ins><span class="cx"> void DOMTimer::fired()
</span><span class="cx"> {
</span><span class="cx">     // Retain this - if the timer is cancelled while this function is on the stack (implicitly and always
</span><span class="lines">@@ -121,6 +168,9 @@
</span><span class="cx"> 
</span><span class="cx">     ScriptExecutionContext* context = scriptExecutionContext();
</span><span class="cx">     ASSERT(context);
</span><ins>+
+    DOMTimerFireState fireState(context);
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     Document* document = nullptr;
</span><span class="cx">     if (context-&gt;isDocument()) {
</span><span class="lines">@@ -149,6 +199,14 @@
</span><span class="cx"> 
</span><span class="cx">         InspectorInstrumentation::didFireTimer(cookie);
</span><span class="cx"> 
</span><ins>+        if (fireState.scriptDidInteractWithUserObservablePlugin &amp;&amp; m_throttleState != ShouldNotThrottle) {
+            m_throttleState = ShouldNotThrottle;
+            updateTimerIntervalIfNecessary();
+        } else if (fireState.scriptDidInteractWithNonUserObservablePlugin &amp;&amp; m_throttleState == Undetermined) {
+            m_throttleState = ShouldThrottle;
+            updateTimerIntervalIfNecessary();
+        }
+
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -199,8 +257,6 @@
</span><span class="cx"> void DOMTimer::updateTimerIntervalIfNecessary()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_nestingLevel &lt;= maxTimerNestingLevel);
</span><del>-    if (m_nestingLevel &lt; maxTimerNestingLevel)
-        return;
</del><span class="cx"> 
</span><span class="cx">     double previousInterval = m_currentTimerInterval;
</span><span class="cx">     m_currentTimerInterval = intervalClampedToMinimum();
</span><span class="lines">@@ -220,12 +276,17 @@
</span><span class="cx">     ASSERT(scriptExecutionContext());
</span><span class="cx">     ASSERT(m_nestingLevel &lt;= maxTimerNestingLevel);
</span><span class="cx"> 
</span><del>-    double minimumTimerInterval = scriptExecutionContext()-&gt;minimumTimerInterval();
-    double intervalMilliseconds = std::max(oneMillisecond, m_originalInterval * oneMillisecond);
</del><ins>+    double intervalInSeconds = std::max(oneMillisecond, m_originalInterval * oneMillisecond);
</ins><span class="cx"> 
</span><del>-    if (intervalMilliseconds &lt; minimumTimerInterval &amp;&amp; m_nestingLevel == maxTimerNestingLevel)
-        intervalMilliseconds = minimumTimerInterval;
-    return intervalMilliseconds;
</del><ins>+    // Only apply throttling to repeating timers.
+    if (m_nestingLevel &lt; maxTimerNestingLevel)
+        return intervalInSeconds;
+
+    // Apply two throttles - the global (per Page) minimum, and also a per-timer throttle.
+    intervalInSeconds = std::max(intervalInSeconds, scriptExecutionContext()-&gt;minimumTimerInterval());
+    if (m_throttleState == ShouldThrottle)
+        intervalInSeconds = std::max(intervalInSeconds, minIntervalForNonUserObservablePluginScriptTimers * oneMillisecond);
+    return intervalInSeconds;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> double DOMTimer::alignedFireTime(double fireTime) const
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCorepageDOMTimerh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/page/DOMTimer.h (175111 => 175112)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/page/DOMTimer.h        2014-10-23 09:29:10 UTC (rev 175111)
+++ branches/safari-600.3-branch/Source/WebCore/page/DOMTimer.h        2014-10-23 09:30:47 UTC (rev 175112)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+    class HTMLPlugInElement;
</ins><span class="cx">     class ScheduledAction;
</span><span class="cx"> 
</span><span class="cx">     class DOMTimer final : public RefCounted&lt;DOMTimer&gt;, public SuspendableTimer {
</span><span class="lines">@@ -48,6 +49,8 @@
</span><span class="cx">         // setting for the context has changed).
</span><span class="cx">         void updateTimerIntervalIfNecessary();
</span><span class="cx"> 
</span><ins>+        static void scriptDidInteractWithPlugin(HTMLPlugInElement&amp;);
+
</ins><span class="cx">     private:
</span><span class="cx">         DOMTimer(ScriptExecutionContext*, std::unique_ptr&lt;ScheduledAction&gt;, int interval, bool singleShot);
</span><span class="cx">         double intervalClampedToMinimum() const;
</span><span class="lines">@@ -57,10 +60,17 @@
</span><span class="cx">         virtual void didStop() override;
</span><span class="cx">         virtual double alignedFireTime(double) const override;
</span><span class="cx"> 
</span><ins>+        enum TimerThrottleState {
+            Undetermined,
+            ShouldThrottle,
+            ShouldNotThrottle
+        };
+
</ins><span class="cx">         int m_timeoutId;
</span><span class="cx">         int m_nestingLevel;
</span><span class="cx">         std::unique_ptr&lt;ScheduledAction&gt; m_action;
</span><span class="cx">         int m_originalInterval;
</span><ins>+        TimerThrottleState m_throttleState;
</ins><span class="cx">         double m_currentTimerInterval;
</span><span class="cx">         bool m_shouldForwardUserGesture;
</span><span class="cx">     };
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCorepluginsPluginViewBaseh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/plugins/PluginViewBase.h (175111 => 175112)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/plugins/PluginViewBase.h        2014-10-23 09:29:10 UTC (rev 175111)
+++ branches/safari-600.3-branch/Source/WebCore/plugins/PluginViewBase.h        2014-10-23 09:30:47 UTC (rev 175112)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> #ifndef PluginWidget_h
</span><span class="cx"> #define PluginWidget_h
</span><span class="cx"> 
</span><ins>+#include &quot;AudioHardwareListener.h&quot;
</ins><span class="cx"> #include &quot;PlatformLayer.h&quot;
</span><span class="cx"> #include &quot;ScrollTypes.h&quot;
</span><span class="cx"> #include &quot;Widget.h&quot;
</span><span class="lines">@@ -74,6 +75,8 @@
</span><span class="cx">     virtual bool isPluginViewBase() const { return true; }
</span><span class="cx">     virtual bool shouldNotAddLayer() const { return false; }
</span><span class="cx"> 
</span><ins>+    virtual AudioHardwareActivityType audioHardwareActivity() const { return AudioHardwareActivityType::Unknown; }
+
</ins><span class="cx"> protected:
</span><span class="cx">     explicit PluginViewBase(PlatformWidget widget = 0) : Widget(widget) { }
</span><span class="cx"> };
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (175111 => 175112)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog        2014-10-23 09:29:10 UTC (rev 175111)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog        2014-10-23 09:30:47 UTC (rev 175112)
</span><span class="lines">@@ -1,5 +1,25 @@
</span><span class="cx"> 2014-10-23  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r173694.
+
+    2014-09-17  Gavin Barraclough  &lt;barraclough@apple.com&gt;
+
+            DOM timer throttling for hidden plugins
+            https://bugs.webkit.org/show_bug.cgi?id=136197
+
+            Reviewed by Geoff Garen &amp; Andreas Kling.
+
+            For non-visible web pages we slow timers (since they can't be driving animations, etc).
+            We should do the same for plugins.
+
+            * PluginProcess/WebProcessConnection.cpp:
+            * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
+                - remove now redundant includes.
+            * WebProcess/Plugins/PluginView.h:
+                - audioHardwareActivity is now virtual, override.
+
+2014-10-23  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
</ins><span class="cx">         Merge r172653.
</span><span class="cx"> 
</span><span class="cx">     2014-08-15  Gavin Barraclough  &lt;barraclough@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2PluginProcessWebProcessConnectioncpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/PluginProcess/WebProcessConnection.cpp (175111 => 175112)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/PluginProcess/WebProcessConnection.cpp        2014-10-23 09:29:10 UTC (rev 175111)
+++ branches/safari-600.3-branch/Source/WebKit2/PluginProcess/WebProcessConnection.cpp        2014-10-23 09:30:47 UTC (rev 175112)
</span><span class="lines">@@ -39,7 +39,6 @@
</span><span class="cx"> #include &quot;PluginProcessConnectionMessages.h&quot;
</span><span class="cx"> #include &quot;PluginProxyMessages.h&quot;
</span><span class="cx"> #include &quot;WebProcessConnectionMessages.h&quot;
</span><del>-#include &lt;WebCore/AudioHardwareListener.h&gt;
</del><span class="cx"> #include &lt;unistd.h&gt;
</span><span class="cx"> #include &lt;wtf/RunLoop.h&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2WebProcessPluginsNetscapeNPRuntimeObjectMapcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp (175111 => 175112)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp        2014-10-23 09:29:10 UTC (rev 175111)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp        2014-10-23 09:30:47 UTC (rev 175112)
</span><span class="lines">@@ -39,7 +39,6 @@
</span><span class="cx"> #include &lt;JavaScriptCore/SourceCode.h&gt;
</span><span class="cx"> #include &lt;JavaScriptCore/Strong.h&gt;
</span><span class="cx"> #include &lt;JavaScriptCore/StrongInlines.h&gt;
</span><del>-#include &lt;WebCore/AudioHardwareListener.h&gt;
</del><span class="cx"> #include &lt;WebCore/DOMWrapperWorld.h&gt;
</span><span class="cx"> #include &lt;WebCore/Frame.h&gt;
</span><span class="cx"> #include &lt;WebCore/Page.h&gt;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2WebProcessPluginsPluginViewcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (175111 => 175112)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp        2014-10-23 09:29:10 UTC (rev 175111)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp        2014-10-23 09:30:47 UTC (rev 175112)
</span><span class="lines">@@ -514,7 +514,19 @@
</span><span class="cx">         m_plugin-&gt;windowFocusChanged(m_webPage-&gt;windowIsFocused());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+WebCore::AudioHardwareActivityType PluginView::audioHardwareActivity() const
+{
+    if (!m_isInitialized || !m_plugin)
+        return AudioHardwareActivityType::IsInactive;
+    
</ins><span class="cx"> #if PLATFORM(COCOA)
</span><ins>+    return m_plugin-&gt;audioHardwareActivity();
+#else
+    return AudioHardwareActivityType::Unknown;
+#endif
+}
+    
+#if PLATFORM(COCOA)
</ins><span class="cx"> void PluginView::setDeviceScaleFactor(float scaleFactor)
</span><span class="cx"> {
</span><span class="cx">     if (!m_isInitialized || !m_plugin)
</span><span class="lines">@@ -543,11 +555,6 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-WebCore::AudioHardwareActivityType PluginView::audioHardwareActivity() const
-{
-    return m_plugin-&gt;audioHardwareActivity();
-}
-    
</del><span class="cx"> NSObject *PluginView::accessibilityObject() const
</span><span class="cx"> {
</span><span class="cx">     if (!m_isInitialized || !m_plugin)
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2WebProcessPluginsPluginViewh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/PluginView.h (175111 => 175112)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/PluginView.h        2014-10-23 09:29:10 UTC (rev 175111)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/PluginView.h        2014-10-23 09:30:47 UTC (rev 175112)
</span><span class="lines">@@ -109,7 +109,7 @@
</span><span class="cx"> 
</span><span class="cx">     PassRefPtr&lt;WebCore::SharedBuffer&gt; liveResourceData() const;
</span><span class="cx">     bool performDictionaryLookupAtLocation(const WebCore::FloatPoint&amp;);
</span><del>-    WebCore::AudioHardwareActivityType audioHardwareActivity() const;
</del><ins>+    virtual WebCore::AudioHardwareActivityType audioHardwareActivity() const override;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     PluginView(PassRefPtr&lt;WebCore::HTMLPlugInElement&gt;, PassRefPtr&lt;Plugin&gt;, const Plugin::Parameters&amp; parameters);
</span></span></pre>
</div>
</div>

</body>
</html>