<!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>[210753] trunk/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/210753">210753</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2017-01-13 17:05:32 -0800 (Fri, 13 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WK2] Add diagnostic logging to measure WebGL usage
https://bugs.webkit.org/show_bug.cgi?id=166730
&lt;rdar://problem/29883469&gt;

Reviewed by Alex Christensen.

Add diagnostic logging to measure high performance WebGL usage. We report
at regular intervals in which WebGL state Safari is:
- Inactive
- ActiveInForegroundTab
- ActiveInBackgroundTabOnly

This should give us an estimate of:
- What % of the time is Safari using high performance graphics
- What % of this time is only due to background tabs

Source/WebCore:

No new tests, no Web-facing behavior change.

* WebCore.xcodeproj/project.pbxproj:
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::create):
(WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
(WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
* html/canvas/WebGLRenderingContextBase.h:
* page/DiagnosticLoggingKeys.cpp:
(WebCore::DiagnosticLoggingKeys::inactiveKey):
(WebCore::DiagnosticLoggingKeys::activeInForegroundTabKey):
(WebCore::DiagnosticLoggingKeys::activeInBackgroundTabOnlyKey):
(WebCore::DiagnosticLoggingKeys::stateKey):
(WebCore::WebCore::DiagnosticLoggingKeys::webGLKey):
* page/DiagnosticLoggingKeys.h:
* page/Page.cpp:
(WebCore::Page::Page):
* page/Page.h:
(WebCore::Page::webGLStateTracker):
* page/PageConfiguration.cpp:
* page/PageConfiguration.h:
* platform/WebGLStateTracker.cpp: Copied from Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h.
(WebCore::WebGLStateTracker::WebGLStateTracker):
(WebCore::m_stateChangeHandler):
(WebCore::WebGLStateTracker::updateWebGLState):
* platform/WebGLStateTracker.h: Copied from Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h.
* platform/graphics/GraphicsContext3DAttributes.h:

Source/WebKit2:

* UIProcess/HighPerformanceGraphicsUsageSampler.cpp: Added.
(WebKit::HighPerformanceGraphicsUsageSampler::HighPerformanceGraphicsUsageSampler):
(WebKit::HighPerformanceGraphicsUsageSampler::timerFired):
* UIProcess/HighPerformanceGraphicsUsageSampler.h: Copied from Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::setIsUsingHighPerformanceWebGL):
(WebKit::WebPageProxy::isUsingHighPerformanceWebGL):
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebProcessPool.cpp:
(WebKit::m_highPerformanceGraphicsUsageSampler):
* UIProcess/WebProcessPool.h:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_userInterfaceLayoutDirection):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContextBasecpp">trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContextBaseh">trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h</a></li>
<li><a href="#trunkSourceWebCorepageDiagnosticLoggingKeyscpp">trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDiagnosticLoggingKeysh">trunk/Source/WebCore/page/DiagnosticLoggingKeys.h</a></li>
<li><a href="#trunkSourceWebCorepagePagecpp">trunk/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageh">trunk/Source/WebCore/page/Page.h</a></li>
<li><a href="#trunkSourceWebCorepagePageConfigurationcpp">trunk/Source/WebCore/page/PageConfiguration.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageConfigurationh">trunk/Source/WebCore/page/PageConfiguration.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsContext3DAttributesh">trunk/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessPoolcpp">trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessPoolh">trunk/Source/WebKit2/UIProcess/WebProcessPool.h</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformWebGLStateTrackercpp">trunk/Source/WebCore/platform/WebGLStateTracker.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformWebGLStateTrackerh">trunk/Source/WebCore/platform/WebGLStateTracker.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessHighPerformanceGraphicsUsageSamplercpp">trunk/Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessHighPerformanceGraphicsUsageSamplerh">trunk/Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebCore/CMakeLists.txt        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -2107,6 +2107,7 @@
</span><span class="cx">     platform/UUID.cpp
</span><span class="cx">     platform/UserActivity.cpp
</span><span class="cx">     platform/WebCoreCrossThreadCopier.cpp
</span><ins>+    platform/WebGLStateTracker.cpp
</ins><span class="cx">     platform/Widget.cpp
</span><span class="cx"> 
</span><span class="cx">     platform/animation/Animation.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebCore/ChangeLog        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -1,3 +1,49 @@
</span><ins>+2017-01-13  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [WK2] Add diagnostic logging to measure WebGL usage
+        https://bugs.webkit.org/show_bug.cgi?id=166730
+        &lt;rdar://problem/29883469&gt;
+
+        Reviewed by Alex Christensen.
+
+        Add diagnostic logging to measure high performance WebGL usage. We report
+        at regular intervals in which WebGL state Safari is:
+        - Inactive
+        - ActiveInForegroundTab
+        - ActiveInBackgroundTabOnly
+
+        This should give us an estimate of:
+        - What % of the time is Safari using high performance graphics
+        - What % of this time is only due to background tabs
+
+        No new tests, no Web-facing behavior change.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::create):
+        (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
+        (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
+        * html/canvas/WebGLRenderingContextBase.h:
+        * page/DiagnosticLoggingKeys.cpp:
+        (WebCore::DiagnosticLoggingKeys::inactiveKey):
+        (WebCore::DiagnosticLoggingKeys::activeInForegroundTabKey):
+        (WebCore::DiagnosticLoggingKeys::activeInBackgroundTabOnlyKey):
+        (WebCore::DiagnosticLoggingKeys::stateKey):
+        (WebCore::WebCore::DiagnosticLoggingKeys::webGLKey):
+        * page/DiagnosticLoggingKeys.h:
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        * page/Page.h:
+        (WebCore::Page::webGLStateTracker):
+        * page/PageConfiguration.cpp:
+        * page/PageConfiguration.h:
+        * platform/WebGLStateTracker.cpp: Copied from Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h.
+        (WebCore::WebGLStateTracker::WebGLStateTracker):
+        (WebCore::m_stateChangeHandler):
+        (WebCore::WebGLStateTracker::updateWebGLState):
+        * platform/WebGLStateTracker.h: Copied from Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h.
+        * platform/graphics/GraphicsContext3DAttributes.h:
+
</ins><span class="cx"> 2017-01-13  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Avoid nullptr frame dereference when scrollTo is called on a disconnected DOMWindow
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -3024,6 +3024,8 @@
</span><span class="cx">                 838EF5381DC149E2008F0C39 /* IDBTransactionMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 838EF5361DC149DA008F0C39 /* IDBTransactionMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 838EF53B1DC14A7C008F0C39 /* JSIDBTransactionMode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 838EF5391DC14A75008F0C39 /* JSIDBTransactionMode.cpp */; };
</span><span class="cx">                 838EF53C1DC14A7C008F0C39 /* JSIDBTransactionMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 838EF53A1DC14A75008F0C39 /* JSIDBTransactionMode.h */; };
</span><ins>+                839A2F2D1E204A710039057E /* WebGLStateTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839A2F2B1E204A6D0039057E /* WebGLStateTracker.cpp */; };
+                839A2F2E1E204A710039057E /* WebGLStateTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 839A2F2C1E204A6D0039057E /* WebGLStateTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 839AAFEC1A0C0C8D00605F99 /* HTMLWBRElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */; };
</span><span class="cx">                 839AAFED1A0C0C8D00605F99 /* HTMLWBRElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */; };
</span><span class="cx">                 83A4A9F91CE7FD8100709B00 /* JSXMLDocumentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */; };
</span><span class="lines">@@ -10540,6 +10542,8 @@
</span><span class="cx">                 838EF5371DC149DA008F0C39 /* IDBTransactionMode.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBTransactionMode.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 838EF5391DC14A75008F0C39 /* JSIDBTransactionMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBTransactionMode.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 838EF53A1DC14A75008F0C39 /* JSIDBTransactionMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBTransactionMode.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                839A2F2B1E204A6D0039057E /* WebGLStateTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGLStateTracker.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                839A2F2C1E204A6D0039057E /* WebGLStateTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLStateTracker.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLWBRElement.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLWBRElement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLDocumentCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -22669,6 +22673,8 @@
</span><span class="cx">                                 9A1142031832D134000BB8AD /* ValueToString.h */,
</span><span class="cx">                                 515F79511CFCA3C700CCED93 /* WebCoreCrossThreadCopier.cpp */,
</span><span class="cx">                                 515F79521CFCA3C700CCED93 /* WebCoreCrossThreadCopier.h */,
</span><ins>+                                839A2F2B1E204A6D0039057E /* WebGLStateTracker.cpp */,
+                                839A2F2C1E204A6D0039057E /* WebGLStateTracker.h */,
</ins><span class="cx">                                 9380F47109A11AB4001FDB34 /* Widget.cpp */,
</span><span class="cx">                                 9380F47209A11AB4001FDB34 /* Widget.h */,
</span><span class="cx">                                 E1E1BEFF115FF6FB006F52CA /* WindowsKeyboardCodes.h */,
</span><span class="lines">@@ -25489,6 +25495,7 @@
</span><span class="cx">                                 0F4710AF1DB56AFC002DCEC3 /* DOMRect.h in Headers */,
</span><span class="cx">                                 0F4710B11DB56AFC002DCEC3 /* DOMRectInit.h in Headers */,
</span><span class="cx">                                 0F4710B31DB56AFC002DCEC3 /* DOMRectReadOnly.h in Headers */,
</span><ins>+                                839A2F2E1E204A710039057E /* WebGLStateTracker.h in Headers */,
</ins><span class="cx">                                 BC5A86850C33676000EEA649 /* DOMSelection.h in Headers */,
</span><span class="cx">                                 C544274B11A57E7A0063A749 /* DOMStringList.h in Headers */,
</span><span class="cx">                                 BC64640A11D7F304006455B0 /* DOMStringMap.h in Headers */,
</span><span class="lines">@@ -29458,6 +29465,7 @@
</span><span class="cx">                                 65BF022E0974816300C43196 /* Frame.cpp in Sources */,
</span><span class="cx">                                 974A862214B7ADBB003FDC76 /* FrameDestructionObserver.cpp in Sources */,
</span><span class="cx">                                 FED13D3D0CEA936A00D89466 /* FrameIOS.mm in Sources */,
</span><ins>+                                839A2F2D1E204A710039057E /* WebGLStateTracker.cpp in Sources */,
</ins><span class="cx">                                 932E16090AF578340025F408 /* FrameLoader.cpp in Sources */,
</span><span class="cx">                                 D000EBA211BDAFD400C47726 /* FrameLoaderStateMachine.cpp in Sources */,
</span><span class="cx">                                 86BA766E166427A8005BE5D1 /* FrameLoadRequest.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -399,7 +399,8 @@
</span><span class="cx">     if (frame-&gt;settings().forceSoftwareWebGLRendering())
</span><span class="cx">         attributes.forceSoftwareRenderer = true;
</span><span class="cx"> 
</span><del>-    if (!attributes.preferLowPowerToHighPerformance &amp;&amp; frame-&gt;settings().preferLowPowerWebGLRendering())
</del><ins>+    attributes.initialPreferLowPowerToHighPerformance = attributes.preferLowPowerToHighPerformance;
+    if (frame-&gt;settings().preferLowPowerWebGLRendering())
</ins><span class="cx">         attributes.preferLowPowerToHighPerformance = true;
</span><span class="cx"> 
</span><span class="cx">     if (page)
</span><span class="lines">@@ -461,6 +462,7 @@
</span><span class="cx">     , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole)
</span><span class="cx">     , m_isPendingPolicyResolution(true)
</span><span class="cx"> {
</span><ins>+    registerWithWebGLStateTracker();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement&amp; passedCanvas, Ref&lt;GraphicsContext3D&gt;&amp;&amp; context, WebGLContextAttributes attributes)
</span><span class="lines">@@ -482,8 +484,22 @@
</span><span class="cx"> 
</span><span class="cx">     setupFlags();
</span><span class="cx">     initializeNewContext();
</span><ins>+    registerWithWebGLStateTracker();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebGLRenderingContextBase::registerWithWebGLStateTracker()
+{
+    auto* page = canvas().document().page();
+    if (!page)
+        return;
+
+    auto* tracker = page-&gt;webGLStateTracker();
+    if (!tracker)
+        return;
+
+    m_trackerToken = tracker-&gt;token(m_attributes.initialPreferLowPowerToHighPerformance);
+}
+
</ins><span class="cx"> void WebGLRenderingContextBase::initializeNewContext()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_contextLost);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #include &quot;WebGLFramebuffer.h&quot;
</span><span class="cx"> #include &quot;WebGLProgram.h&quot;
</span><span class="cx"> #include &quot;WebGLRenderbuffer.h&quot;
</span><ins>+#include &quot;WebGLStateTracker.h&quot;
</ins><span class="cx"> #include &quot;WebGLTexture.h&quot;
</span><span class="cx"> #include &quot;WebGLVertexArrayObjectOES.h&quot;
</span><span class="cx"> #include &lt;memory&gt;
</span><span class="lines">@@ -825,6 +826,9 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     bool validateArrayBufferType(const char* functionName, GC3Denum type, std::optional&lt;JSC::TypedArrayType&gt;);
</span><ins>+    void registerWithWebGLStateTracker();
+
+    WebGLStateTracker::Token m_trackerToken;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepageDiagnosticLoggingKeyscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -243,6 +243,11 @@
</span><span class="cx">     return ASCIILiteral(&quot;inMemoryCache&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String DiagnosticLoggingKeys::inactiveKey()
+{
+    return ASCIILiteral(&quot;inactive&quot;);
+}
+
</ins><span class="cx"> String DiagnosticLoggingKeys::internalErrorKey()
</span><span class="cx"> {
</span><span class="cx">     return ASCIILiteral(&quot;internalError&quot;);
</span><span class="lines">@@ -323,6 +328,16 @@
</span><span class="cx">     return ASCIILiteral(&quot;delta&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String DiagnosticLoggingKeys::activeInForegroundTabKey()
+{
+    return ASCIILiteral(&quot;activeInForegroundTab&quot;);
+}
+
+String DiagnosticLoggingKeys::activeInBackgroundTabOnlyKey()
+{
+    return ASCIILiteral(&quot;activeInBackgroundTabOnly&quot;);
+}
+
</ins><span class="cx"> String DiagnosticLoggingKeys::applicationCacheKey()
</span><span class="cx"> {
</span><span class="cx">     return ASCIILiteral(&quot;applicationCache&quot;);
</span><span class="lines">@@ -448,6 +463,11 @@
</span><span class="cx">     return ASCIILiteral(&quot;source&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String DiagnosticLoggingKeys::stateKey()
+{
+    return ASCIILiteral(&quot;state&quot;);
+}
+
</ins><span class="cx"> String DiagnosticLoggingKeys::streamingMedia()
</span><span class="cx"> {
</span><span class="cx">     return ASCIILiteral(&quot;streamingMedia&quot;);
</span><span class="lines">@@ -628,5 +648,10 @@
</span><span class="cx">     return ASCIILiteral(&quot;notInCache&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String WebCore::DiagnosticLoggingKeys::webGLKey()
+{
+    return ASCIILiteral(&quot;webGL&quot;);
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageDiagnosticLoggingKeysh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DiagnosticLoggingKeys.h (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DiagnosticLoggingKeys.h        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebCore/page/DiagnosticLoggingKeys.h        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -31,6 +31,8 @@
</span><span class="cx"> 
</span><span class="cx"> class DiagnosticLoggingKeys {
</span><span class="cx"> public:
</span><ins>+    WEBCORE_EXPORT static String activeInForegroundTabKey();
+    WEBCORE_EXPORT static String activeInBackgroundTabOnlyKey();
</ins><span class="cx">     static String applicationCacheKey();
</span><span class="cx">     static String audioKey();
</span><span class="cx">     WEBCORE_EXPORT static String backNavigationKey();
</span><span class="lines">@@ -57,6 +59,7 @@
</span><span class="cx">     static String httpsNoStoreKey();
</span><span class="cx">     static String imageKey();
</span><span class="cx">     static String inMemoryCacheKey();
</span><ins>+    WEBCORE_EXPORT static String inactiveKey();
</ins><span class="cx">     WEBCORE_EXPORT static String internalErrorKey();
</span><span class="cx">     WEBCORE_EXPORT static String invalidSessionIDKey();
</span><span class="cx">     WEBCORE_EXPORT static String isAttachmentKey();
</span><span class="lines">@@ -120,6 +123,7 @@
</span><span class="cx">     static String sameLoadKey();
</span><span class="cx">     static String scriptKey();
</span><span class="cx">     static String sourceKey();
</span><ins>+    WEBCORE_EXPORT static String stateKey();
</ins><span class="cx">     WEBCORE_EXPORT static String streamingMedia();
</span><span class="cx">     static String styleSheetKey();
</span><span class="cx">     WEBCORE_EXPORT static String successfulSpeculativeWarmupWithRevalidationKey();
</span><span class="lines">@@ -147,6 +151,7 @@
</span><span class="cx">     static String videoKey();
</span><span class="cx">     WEBCORE_EXPORT static String wastedSpeculativeWarmupWithRevalidationKey();
</span><span class="cx">     WEBCORE_EXPORT static String wastedSpeculativeWarmupWithoutRevalidationKey();
</span><ins>+    WEBCORE_EXPORT static String webGLKey();
</ins><span class="cx">     WEBCORE_EXPORT static String webViewKey();
</span><span class="cx">     WEBCORE_EXPORT static String zoomedKey();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.cpp (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.cpp        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebCore/page/Page.cpp        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -98,6 +98,7 @@
</span><span class="cx"> #include &quot;VisitedLinkState.h&quot;
</span><span class="cx"> #include &quot;VisitedLinkStore.h&quot;
</span><span class="cx"> #include &quot;VoidCallback.h&quot;
</span><ins>+#include &quot;WebGLStateTracker.h&quot;
</ins><span class="cx"> #include &quot;Widget.h&quot;
</span><span class="cx"> #include &lt;wtf/CurrentTime.h&gt;
</span><span class="cx"> #include &lt;wtf/RefCountedLeakCounter.h&gt;
</span><span class="lines">@@ -197,6 +198,7 @@
</span><span class="cx">     , m_plugInClient(pageConfiguration.plugInClient)
</span><span class="cx">     , m_validationMessageClient(WTFMove(pageConfiguration.validationMessageClient))
</span><span class="cx">     , m_diagnosticLoggingClient(WTFMove(pageConfiguration.diagnosticLoggingClient))
</span><ins>+    , m_webGLStateTracker(WTFMove(pageConfiguration.webGLStateTracker))
</ins><span class="cx">     , m_subframeCount(0)
</span><span class="cx">     , m_openedByDOM(false)
</span><span class="cx">     , m_tabKeyCyclesThroughElements(true)
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.h (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.h        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebCore/page/Page.h        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -130,6 +130,7 @@
</span><span class="cx"> class ValidationMessageClient;
</span><span class="cx"> class ActivityStateChangeObserver;
</span><span class="cx"> class VisitedLinkStore;
</span><ins>+class WebGLStateTracker;
</ins><span class="cx"> 
</span><span class="cx"> typedef uint64_t LinkHash;
</span><span class="cx"> 
</span><span class="lines">@@ -552,6 +553,7 @@
</span><span class="cx">     std::optional&lt;EventThrottlingBehavior&gt; eventThrottlingBehaviorOverride() const { return m_eventThrottlingBehaviorOverride; }
</span><span class="cx">     void setEventThrottlingBehaviorOverride(std::optional&lt;EventThrottlingBehavior&gt; throttling) { m_eventThrottlingBehaviorOverride = throttling; }
</span><span class="cx"> 
</span><ins>+    WebGLStateTracker* webGLStateTracker() const { return m_webGLStateTracker.get(); }
</ins><span class="cx"> private:
</span><span class="cx">     WEBCORE_EXPORT void initGroup();
</span><span class="cx"> 
</span><span class="lines">@@ -617,6 +619,7 @@
</span><span class="cx">     PlugInClient* m_plugInClient;
</span><span class="cx">     std::unique_ptr&lt;ValidationMessageClient&gt; m_validationMessageClient;
</span><span class="cx">     std::unique_ptr&lt;DiagnosticLoggingClient&gt; m_diagnosticLoggingClient;
</span><ins>+    std::unique_ptr&lt;WebGLStateTracker&gt; m_webGLStateTracker;
</ins><span class="cx"> 
</span><span class="cx">     int m_subframeCount;
</span><span class="cx">     String m_groupName;
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageConfigurationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageConfiguration.cpp (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageConfiguration.cpp        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebCore/page/PageConfiguration.cpp        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include &quot;UserContentController.h&quot;
</span><span class="cx"> #include &quot;ValidationMessageClient.h&quot;
</span><span class="cx"> #include &quot;VisitedLinkStore.h&quot;
</span><ins>+#include &quot;WebGLStateTracker.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageConfigurationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageConfiguration.h (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageConfiguration.h        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebCore/page/PageConfiguration.h        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> class UserContentProvider;
</span><span class="cx"> class ValidationMessageClient;
</span><span class="cx"> class VisitedLinkStore;
</span><ins>+class WebGLStateTracker;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTEXT_MENUS)
</span><span class="cx"> class ContextMenuClient;
</span><span class="lines">@@ -80,6 +81,7 @@
</span><span class="cx">     std::unique_ptr&lt;ValidationMessageClient&gt; validationMessageClient;
</span><span class="cx">     FrameLoaderClient* loaderClientForMainFrame { nullptr };
</span><span class="cx">     std::unique_ptr&lt;DiagnosticLoggingClient&gt; diagnosticLoggingClient;
</span><ins>+    std::unique_ptr&lt;WebGLStateTracker&gt; webGLStateTracker;
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;ApplicationCacheStorage&gt; applicationCacheStorage;
</span><span class="cx">     RefPtr&lt;DatabaseProvider&gt; databaseProvider;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformWebGLStateTrackercppfromrev210752trunkSourceWebCoreplatformgraphicsGraphicsContext3DAttributesh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/WebGLStateTracker.cpp (from rev 210752, trunk/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h) (0 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/WebGLStateTracker.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/WebGLStateTracker.cpp        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;WebGLStateTracker.h&quot;
+
+namespace WebCore {
+
+WebGLStateTracker::WebGLStateTracker(StateChangeHandler&amp;&amp; handler)
+    : m_webGLContextCounter([this](RefCounterEvent) { updateWebGLState(); })
+    , m_stateChangeHandler(WTFMove(handler))
+{
+}
+
+auto WebGLStateTracker::token(bool preferLowPower) -&gt; Token
+{
+    // We only track high performance WebGL contexts at the moment.
+    if (preferLowPower)
+        return { };
+    return m_webGLContextCounter.count();
+}
+
+void WebGLStateTracker::updateWebGLState()
+{
+    if (!m_webGLContextCounter.value())
+        m_stateChangeHandler(false);
+    else if (m_webGLContextCounter.value() == 1)
+        m_stateChangeHandler(true);
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformWebGLStateTrackerhfromrev210752trunkSourceWebCoreplatformgraphicsGraphicsContext3DAttributesh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/WebGLStateTracker.h (from rev 210752, trunk/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h) (0 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/WebGLStateTracker.h                                (rev 0)
+++ trunk/Source/WebCore/platform/WebGLStateTracker.h        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include &lt;wtf/Function.h&gt;
+#include &lt;wtf/RefCounter.h&gt;
+
+namespace WebCore {
+
+class WebGLStateTracker {
+public:
+    using StateChangeHandler = Function&lt;void(bool isUsingWebGL)&gt;;
+    WEBCORE_EXPORT explicit WebGLStateTracker(StateChangeHandler&amp;&amp;);
+
+    enum WebGLContextCounterType { };
+    using WebGLContextCounter = RefCounter&lt;WebGLContextCounterType&gt;;
+    using Token = WebGLContextCounter::Token;
+
+    Token token(bool preferLowPower);
+
+private:
+    void updateWebGLState();
+
+    WebGLContextCounter m_webGLContextCounter;
+    StateChangeHandler m_stateChangeHandler;
+};
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContext3DAttributesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx">     bool useGLES3 { false };
</span><span class="cx">     bool noExtensions { false };
</span><span class="cx">     float devicePixelRatio { 1 };
</span><ins>+    bool initialPreferLowPowerToHighPerformance { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebKit2/ChangeLog        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2017-01-13  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [WK2] Add diagnostic logging to measure WebGL usage
+        https://bugs.webkit.org/show_bug.cgi?id=166730
+        &lt;rdar://problem/29883469&gt;
+
+        Reviewed by Alex Christensen.
+
+        Add diagnostic logging to measure high performance WebGL usage. We report
+        at regular intervals in which WebGL state Safari is:
+        - Inactive
+        - ActiveInForegroundTab
+        - ActiveInBackgroundTabOnly
+
+        This should give us an estimate of:
+        - What % of the time is Safari using high performance graphics
+        - What % of this time is only due to background tabs
+
+        * UIProcess/HighPerformanceGraphicsUsageSampler.cpp: Added.
+        (WebKit::HighPerformanceGraphicsUsageSampler::HighPerformanceGraphicsUsageSampler):
+        (WebKit::HighPerformanceGraphicsUsageSampler::timerFired):
+        * UIProcess/HighPerformanceGraphicsUsageSampler.h: Copied from Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h.
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::setIsUsingHighPerformanceWebGL):
+        (WebKit::WebPageProxy::isUsingHighPerformanceWebGL):
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::m_highPerformanceGraphicsUsageSampler):
+        * UIProcess/WebProcessPool.h:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_userInterfaceLayoutDirection):
+
</ins><span class="cx"> 2017-01-13  Matt Rajca  &lt;mrajca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Defer use of autoplay heuristics to clients
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessHighPerformanceGraphicsUsageSamplercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.cpp (0 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.cpp        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;HighPerformanceGraphicsUsageSampler.h&quot;
+
+#include &quot;WebProcessPool.h&quot;
+#include &lt;WebCore/DiagnosticLoggingKeys.h&gt;
+
+namespace WebKit {
+
+using namespace WebCore;
+
+static const std::chrono::minutes samplingInterval { 10 };
+
+HighPerformanceGraphicsUsageSampler::HighPerformanceGraphicsUsageSampler(WebProcessPool&amp; webProcessPool)
+    : m_webProcessPool(webProcessPool)
+    , m_timer(RunLoop::main(), this, &amp;HighPerformanceGraphicsUsageSampler::timerFired)
+{
+    m_timer.startRepeating(samplingInterval);
+}
+
+void HighPerformanceGraphicsUsageSampler::timerFired()
+{
+    bool isUsingHighPerformanceWebGL = false;
+    bool isUsingHighPerformanceWebGLInVisibleView = false;
+
+    WebPageProxy* firstPage = nullptr;
+    for (auto&amp; webProcess : m_webProcessPool.processes()) {
+        for (auto&amp; page : webProcess-&gt;pages()) {
+            if (!firstPage)
+                firstPage = page;
+
+            if (page-&gt;isUsingHighPerformanceWebGL()) {
+                isUsingHighPerformanceWebGL = true;
+                if (page-&gt;isViewVisible()) {
+                    isUsingHighPerformanceWebGLInVisibleView = true;
+                    break;
+                }
+            }
+        }
+    }
+
+    if (!firstPage)
+        return;
+
+    String state = DiagnosticLoggingKeys::inactiveKey();
+    if (isUsingHighPerformanceWebGLInVisibleView)
+        state = DiagnosticLoggingKeys::activeInForegroundTabKey();
+    else if (isUsingHighPerformanceWebGL)
+        state = DiagnosticLoggingKeys::activeInBackgroundTabOnlyKey();
+
+    firstPage-&gt;logDiagnosticMessageWithValue(DiagnosticLoggingKeys::webGLKey(), DiagnosticLoggingKeys::stateKey(), state, false);
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessHighPerformanceGraphicsUsageSamplerhfromrev210752trunkSourceWebCoreplatformgraphicsGraphicsContext3DAttributesh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.h (from rev 210752, trunk/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h) (0 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.h        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include &lt;wtf/RunLoop.h&gt;
+
+namespace WebKit {
+
+class WebProcessPool;
+
+class HighPerformanceGraphicsUsageSampler {
+public:
+    explicit HighPerformanceGraphicsUsageSampler(WebProcessPool&amp;);
+
+private:
+    void timerFired();
+
+    WebProcessPool&amp; m_webProcessPool;
+    RunLoop::Timer&lt;HighPerformanceGraphicsUsageSampler&gt; m_timer;
+};
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -378,6 +378,9 @@
</span><span class="cx">     bool tryClose();
</span><span class="cx">     bool isClosed() const { return m_isClosed; }
</span><span class="cx"> 
</span><ins>+    void setIsUsingHighPerformanceWebGL(bool value) { m_isUsingHighPerformanceWebGL = value; }
+    bool isUsingHighPerformanceWebGL() const { return m_isUsingHighPerformanceWebGL; }
+
</ins><span class="cx">     void closePage(bool stopResponsivenessTimer);
</span><span class="cx"> 
</span><span class="cx">     void addPlatformLoadParameters(LoadParameters&amp;);
</span><span class="lines">@@ -1973,6 +1976,8 @@
</span><span class="cx"> #if ENABLE(DOWNLOAD_ATTRIBUTE)
</span><span class="cx">     bool m_syncNavigationActionHasDownloadAttribute { false };
</span><span class="cx"> #endif
</span><ins>+
+    bool m_isUsingHighPerformanceWebGL { false };
</ins><span class="cx">         
</span><span class="cx">     WeakPtrFactory&lt;WebPageProxy&gt; m_weakPtrFactory;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -485,4 +485,6 @@
</span><span class="cx">     DidHandleAcceptedCandidate()
</span><span class="cx">     HandleActiveNowPlayingSessionInfoResponse(bool hasActiveSession, String title, double duration, double elapsedTime)
</span><span class="cx"> #endif
</span><ins>+
+    SetIsUsingHighPerformanceWebGL(bool isUsingHighPerformanceWebGL)
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessPoolcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include &quot;DownloadProxy.h&quot;
</span><span class="cx"> #include &quot;DownloadProxyMessages.h&quot;
</span><span class="cx"> #include &quot;GamepadData.h&quot;
</span><ins>+#include &quot;HighPerformanceGraphicsUsageSampler.h&quot;
</ins><span class="cx"> #include &quot;LogInitialization.h&quot;
</span><span class="cx"> #include &quot;NetworkProcessCreationParameters.h&quot;
</span><span class="cx"> #include &quot;NetworkProcessMessages.h&quot;
</span><span class="lines">@@ -165,6 +166,9 @@
</span><span class="cx">     , m_memorySamplerEnabled(false)
</span><span class="cx">     , m_memorySamplerInterval(1400.0)
</span><span class="cx">     , m_websiteDataStore(m_configuration-&gt;shouldHaveLegacyDataStore() ? API::WebsiteDataStore::create(legacyWebsiteDataStoreConfiguration(m_configuration)).ptr() : nullptr)
</span><ins>+#if PLATFORM(MAC)
+    , m_highPerformanceGraphicsUsageSampler(std::make_unique&lt;HighPerformanceGraphicsUsageSampler&gt;(*this))
+#endif
</ins><span class="cx">     , m_shouldUseTestingNetworkSession(false)
</span><span class="cx">     , m_processTerminationEnabled(true)
</span><span class="cx">     , m_canHandleHTTPSServerTrustEvaluation(true)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessPoolh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessPool.h        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.h        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -79,6 +79,7 @@
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> class DownloadProxy;
</span><ins>+class HighPerformanceGraphicsUsageSampler;
</ins><span class="cx"> class UIGamepad;
</span><span class="cx"> class WebAutomationSession;
</span><span class="cx"> class WebContextSupplement;
</span><span class="lines">@@ -523,6 +524,8 @@
</span><span class="cx">     RetainPtr&lt;NSObject&gt; m_automaticSpellingCorrectionNotificationObserver;
</span><span class="cx">     RetainPtr&lt;NSObject&gt; m_automaticQuoteSubstitutionNotificationObserver;
</span><span class="cx">     RetainPtr&lt;NSObject&gt; m_automaticDashSubstitutionNotificationObserver;
</span><ins>+
+    std::unique_ptr&lt;HighPerformanceGraphicsUsageSampler&gt; m_highPerformanceGraphicsUsageSampler;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     String m_overrideIconDatabasePath;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -1253,6 +1253,8 @@
</span><span class="cx">                 839149651BEA838500D2D953 /* NetworkLoadParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 839149631BEA838500D2D953 /* NetworkLoadParameters.h */; };
</span><span class="cx">                 839902021BE9A02B000F3653 /* NetworkLoad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839901FF1BE9A01B000F3653 /* NetworkLoad.cpp */; };
</span><span class="cx">                 839902031BE9A02B000F3653 /* NetworkLoad.h in Headers */ = {isa = PBXBuildFile; fileRef = 839901FE1BE9A01B000F3653 /* NetworkLoad.h */; };
</span><ins>+                839A2F311E2067450039057E /* HighPerformanceGraphicsUsageSampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839A2F2F1E2067390039057E /* HighPerformanceGraphicsUsageSampler.cpp */; };
+                839A2F321E2067450039057E /* HighPerformanceGraphicsUsageSampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 839A2F301E2067390039057E /* HighPerformanceGraphicsUsageSampler.h */; };
</ins><span class="cx">                 83BDCCB91AC5FDB6003F6441 /* NetworkCacheStatistics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BDCCB81AC5FDB6003F6441 /* NetworkCacheStatistics.cpp */; };
</span><span class="cx">                 83BFAC421D96137C00433490 /* BlobDownloadClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BFAC401D96136000433490 /* BlobDownloadClient.h */; };
</span><span class="cx">                 83BFAC431D96137C00433490 /* BlobDownloadClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BFAC411D96136000433490 /* BlobDownloadClient.cpp */; };
</span><span class="lines">@@ -3401,6 +3403,8 @@
</span><span class="cx">                 839149631BEA838500D2D953 /* NetworkLoadParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkLoadParameters.h; path = NetworkProcess/NetworkLoadParameters.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 839901FE1BE9A01B000F3653 /* NetworkLoad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkLoad.h; path = NetworkProcess/NetworkLoad.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 839901FF1BE9A01B000F3653 /* NetworkLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkLoad.cpp; path = NetworkProcess/NetworkLoad.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                839A2F2F1E2067390039057E /* HighPerformanceGraphicsUsageSampler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HighPerformanceGraphicsUsageSampler.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                839A2F301E2067390039057E /* HighPerformanceGraphicsUsageSampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HighPerformanceGraphicsUsageSampler.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 83BDCCB81AC5FDB6003F6441 /* NetworkCacheStatistics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCacheStatistics.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 83BFAC401D96136000433490 /* BlobDownloadClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BlobDownloadClient.h; path = NetworkProcess/Downloads/BlobDownloadClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 83BFAC411D96136000433490 /* BlobDownloadClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BlobDownloadClient.cpp; path = NetworkProcess/Downloads/BlobDownloadClient.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -6257,6 +6261,8 @@
</span><span class="cx">                                 BC06F44812DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.h */,
</span><span class="cx">                                 BC06F43912DBCCFB002D78DE /* GeolocationPermissionRequestProxy.cpp */,
</span><span class="cx">                                 BC06F43812DBCCFB002D78DE /* GeolocationPermissionRequestProxy.h */,
</span><ins>+                                839A2F2F1E2067390039057E /* HighPerformanceGraphicsUsageSampler.cpp */,
+                                839A2F301E2067390039057E /* HighPerformanceGraphicsUsageSampler.h */,
</ins><span class="cx">                                 31607F3819627002009B87DA /* LegacySessionStateCoding.h */,
</span><span class="cx">                                 BC6EDAA5111271C600E7678B /* PageClient.h */,
</span><span class="cx">                                 1AC75379183A9FDA0072CB15 /* PageLoadState.cpp */,
</span><span class="lines">@@ -7885,6 +7891,7 @@
</span><span class="cx">                                 1A6FBD2811E69BC200DB1371 /* NetscapePlugin.h in Headers */,
</span><span class="cx">                                 1A4A9C5612B816CF008FE984 /* NetscapePluginModule.h in Headers */,
</span><span class="cx">                                 1AA5889211EE70400061B882 /* NetscapePluginStream.h in Headers */,
</span><ins>+                                839A2F321E2067450039057E /* HighPerformanceGraphicsUsageSampler.h in Headers */,
</ins><span class="cx">                                 E1798C7A16E6818800240139 /* NetworkBlobRegistry.h in Headers */,
</span><span class="cx">                                 E4436ECC1A0D040B00EAD204 /* NetworkCache.h in Headers */,
</span><span class="cx">                                 E49D40D71AD3FB170066B7B9 /* NetworkCacheBlobStorage.h in Headers */,
</span><span class="lines">@@ -9380,6 +9387,7 @@
</span><span class="cx">                                 1A6FBD2911E69BC200DB1371 /* NetscapePlugin.cpp in Sources */,
</span><span class="cx">                                 1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */,
</span><span class="cx">                                 1A4A9C5512B816CF008FE984 /* NetscapePluginModule.cpp in Sources */,
</span><ins>+                                839A2F311E2067450039057E /* HighPerformanceGraphicsUsageSampler.cpp in Sources */,
</ins><span class="cx">                                 1A4A9C9A12B821CD008FE984 /* NetscapePluginModuleMac.mm in Sources */,
</span><span class="cx">                                 1AA5889311EE70400061B882 /* NetscapePluginStream.cpp in Sources */,
</span><span class="cx">                                 E1798C7916E6818800240139 /* NetworkBlobRegistry.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (210752 => 210753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2017-01-14 01:03:17 UTC (rev 210752)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2017-01-14 01:05:32 UTC (rev 210753)
</span><span class="lines">@@ -177,6 +177,7 @@
</span><span class="cx"> #include &lt;WebCore/UserStyleSheet.h&gt;
</span><span class="cx"> #include &lt;WebCore/VisiblePosition.h&gt;
</span><span class="cx"> #include &lt;WebCore/VisibleUnits.h&gt;
</span><ins>+#include &lt;WebCore/WebGLStateTracker.h&gt;
</ins><span class="cx"> #include &lt;WebCore/htmlediting.h&gt;
</span><span class="cx"> #include &lt;WebCore/markup.h&gt;
</span><span class="cx"> #include &lt;bindings/ScriptValue.h&gt;
</span><span class="lines">@@ -358,6 +359,9 @@
</span><span class="cx">     pageConfiguration.loaderClientForMainFrame = new WebFrameLoaderClient;
</span><span class="cx">     pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(*this);
</span><span class="cx">     pageConfiguration.diagnosticLoggingClient = std::make_unique&lt;WebDiagnosticLoggingClient&gt;(*this);
</span><ins>+    pageConfiguration.webGLStateTracker = std::make_unique&lt;WebGLStateTracker&gt;([this](bool isUsingHighPerformanceWebGL) {
+        send(Messages::WebPageProxy::SetIsUsingHighPerformanceWebGL(isUsingHighPerformanceWebGL));
+    });
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     pageConfiguration.validationMessageClient = std::make_unique&lt;WebValidationMessageClient&gt;(*this);
</span></span></pre>
</div>
</div>

</body>
</html>