Title: [210876] branches/safari-603-branch/Source
Revision
210876
Author
matthew_han...@apple.com
Date
2017-01-18 12:43:31 -0800 (Wed, 18 Jan 2017)

Log Message

Merge r210753. rdar://problem/29883469

Modified Paths

Added Paths

Diff

Modified: branches/safari-603-branch/Source/WebCore/CMakeLists.txt (210875 => 210876)


--- branches/safari-603-branch/Source/WebCore/CMakeLists.txt	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebCore/CMakeLists.txt	2017-01-18 20:43:31 UTC (rev 210876)
@@ -2177,6 +2177,7 @@
     platform/UUID.cpp
     platform/UserActivity.cpp
     platform/WebCoreCrossThreadCopier.cpp
+    platform/WebGLStateTracker.cpp
     platform/Widget.cpp
 
     platform/animation/Animation.cpp

Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (210875 => 210876)


--- branches/safari-603-branch/Source/WebCore/ChangeLog	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog	2017-01-18 20:43:31 UTC (rev 210876)
@@ -1,5 +1,55 @@
 2017-01-18  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r210753. rdar://problem/29883469
+
+    2017-01-13  Chris Dumez  <cdu...@apple.com>
+
+            [WK2] Add diagnostic logging to measure WebGL usage
+            https://bugs.webkit.org/show_bug.cgi?id=166730
+            <rdar://problem/29883469>
+
+            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:
+
+2017-01-18  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r210748. rdar://problem/27745030
 
     2017-01-13  Jer Noble  <jer.no...@apple.com>

Modified: branches/safari-603-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (210875 => 210876)


--- branches/safari-603-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-01-18 20:43:31 UTC (rev 210876)
@@ -3031,6 +3031,8 @@
 		838EF5381DC149E2008F0C39 /* IDBTransactionMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 838EF5361DC149DA008F0C39 /* IDBTransactionMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		838EF53B1DC14A7C008F0C39 /* JSIDBTransactionMode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 838EF5391DC14A75008F0C39 /* JSIDBTransactionMode.cpp */; };
 		838EF53C1DC14A7C008F0C39 /* JSIDBTransactionMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 838EF53A1DC14A75008F0C39 /* JSIDBTransactionMode.h */; };
+		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, ); }; };
 		839AAFEC1A0C0C8D00605F99 /* HTMLWBRElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */; };
 		839AAFED1A0C0C8D00605F99 /* HTMLWBRElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */; };
 		83A4A9F91CE7FD8100709B00 /* JSXMLDocumentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */; };
@@ -10567,6 +10569,8 @@
 		838EF5371DC149DA008F0C39 /* IDBTransactionMode.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBTransactionMode.idl; sourceTree = "<group>"; };
 		838EF5391DC14A75008F0C39 /* JSIDBTransactionMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBTransactionMode.cpp; sourceTree = "<group>"; };
 		838EF53A1DC14A75008F0C39 /* JSIDBTransactionMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBTransactionMode.h; sourceTree = "<group>"; };
+		839A2F2B1E204A6D0039057E /* WebGLStateTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGLStateTracker.cpp; sourceTree = "<group>"; };
+		839A2F2C1E204A6D0039057E /* WebGLStateTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLStateTracker.h; sourceTree = "<group>"; };
 		839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLWBRElement.cpp; sourceTree = "<group>"; };
 		839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLWBRElement.h; sourceTree = "<group>"; };
 		83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLDocumentCustom.cpp; sourceTree = "<group>"; };
@@ -22716,6 +22720,8 @@
 				46DB7D591B20FE58005651B2 /* VNodeTracker.h */,
 				515F79511CFCA3C700CCED93 /* WebCoreCrossThreadCopier.cpp */,
 				515F79521CFCA3C700CCED93 /* WebCoreCrossThreadCopier.h */,
+				839A2F2B1E204A6D0039057E /* WebGLStateTracker.cpp */,
+				839A2F2C1E204A6D0039057E /* WebGLStateTracker.h */,
 				9380F47109A11AB4001FDB34 /* Widget.cpp */,
 				9380F47209A11AB4001FDB34 /* Widget.h */,
 				E1E1BEFF115FF6FB006F52CA /* WindowsKeyboardCodes.h */,
@@ -25521,6 +25527,7 @@
 				0F4710AF1DB56AFC002DCEC3 /* DOMRect.h in Headers */,
 				0F4710B11DB56AFC002DCEC3 /* DOMRectInit.h in Headers */,
 				0F4710B31DB56AFC002DCEC3 /* DOMRectReadOnly.h in Headers */,
+				839A2F2E1E204A710039057E /* WebGLStateTracker.h in Headers */,
 				BC5A86850C33676000EEA649 /* DOMSelection.h in Headers */,
 				C544274B11A57E7A0063A749 /* DOMStringList.h in Headers */,
 				BC64640A11D7F304006455B0 /* DOMStringMap.h in Headers */,
@@ -29490,6 +29497,7 @@
 				65BF022E0974816300C43196 /* Frame.cpp in Sources */,
 				974A862214B7ADBB003FDC76 /* FrameDestructionObserver.cpp in Sources */,
 				FED13D3D0CEA936A00D89466 /* FrameIOS.mm in Sources */,
+				839A2F2D1E204A710039057E /* WebGLStateTracker.cpp in Sources */,
 				932E16090AF578340025F408 /* FrameLoader.cpp in Sources */,
 				D000EBA211BDAFD400C47726 /* FrameLoaderStateMachine.cpp in Sources */,
 				86BA766E166427A8005BE5D1 /* FrameLoadRequest.cpp in Sources */,

Modified: branches/safari-603-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (210875 => 210876)


--- branches/safari-603-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2017-01-18 20:43:31 UTC (rev 210876)
@@ -399,7 +399,8 @@
     if (frame->settings().forceSoftwareWebGLRendering())
         attributes.forceSoftwareRenderer = true;
 
-    if (!attributes.preferLowPowerToHighPerformance && frame->settings().preferLowPowerWebGLRendering())
+    attributes.initialPreferLowPowerToHighPerformance = attributes.preferLowPowerToHighPerformance;
+    if (frame->settings().preferLowPowerWebGLRendering())
         attributes.preferLowPowerToHighPerformance = true;
 
     if (page)
@@ -470,6 +471,7 @@
     , m_isPendingPolicyResolution(true)
     , m_hasRequestedPolicyResolution(false)
 {
+    registerWithWebGLStateTracker();
 }
 
 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement& passedCanvas, RefPtr<GraphicsContext3D>&& context, WebGLContextAttributes attributes)
@@ -499,8 +501,22 @@
 
     setupFlags();
     initializeNewContext();
+    registerWithWebGLStateTracker();
 }
 
+void WebGLRenderingContextBase::registerWithWebGLStateTracker()
+{
+    auto* page = canvas().document().page();
+    if (!page)
+        return;
+
+    auto* tracker = page->webGLStateTracker();
+    if (!tracker)
+        return;
+
+    m_trackerToken = tracker->token(m_attributes.initialPreferLowPowerToHighPerformance);
+}
+
 void WebGLRenderingContextBase::initializeNewContext()
 {
     ASSERT(!m_contextLost);

Modified: branches/safari-603-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (210875 => 210876)


--- branches/safari-603-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2017-01-18 20:43:31 UTC (rev 210876)
@@ -33,6 +33,7 @@
 #include "WebGLContextAttributes.h"
 #include "WebGLGetInfo.h"
 #include "WebGLObject.h"
+#include "WebGLStateTracker.h"
 #include "WebGLTexture.h"
 #include <memory>
 #include <runtime/Float32Array.h>
@@ -801,6 +802,9 @@
 
 private:
     bool validateArrayBufferType(const char* functionName, GC3Denum type, std::optional<JSC::TypedArrayType>);
+    void registerWithWebGLStateTracker();
+
+    WebGLStateTracker::Token m_trackerToken;
 };
 
 } // namespace WebCore

Modified: branches/safari-603-branch/Source/WebCore/page/DiagnosticLoggingKeys.cpp (210875 => 210876)


--- branches/safari-603-branch/Source/WebCore/page/DiagnosticLoggingKeys.cpp	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebCore/page/DiagnosticLoggingKeys.cpp	2017-01-18 20:43:31 UTC (rev 210876)
@@ -238,6 +238,11 @@
     return ASCIILiteral("inMemoryCache");
 }
 
+String DiagnosticLoggingKeys::inactiveKey()
+{
+    return ASCIILiteral("inactive");
+}
+
 String DiagnosticLoggingKeys::internalErrorKey()
 {
     return ASCIILiteral("internalError");
@@ -313,6 +318,16 @@
     return ASCIILiteral("delta");
 }
 
+String DiagnosticLoggingKeys::activeInForegroundTabKey()
+{
+    return ASCIILiteral("activeInForegroundTab");
+}
+
+String DiagnosticLoggingKeys::activeInBackgroundTabOnlyKey()
+{
+    return ASCIILiteral("activeInBackgroundTabOnly");
+}
+
 String DiagnosticLoggingKeys::applicationCacheKey()
 {
     return ASCIILiteral("applicationCache");
@@ -438,6 +453,11 @@
     return ASCIILiteral("source");
 }
 
+String DiagnosticLoggingKeys::stateKey()
+{
+    return ASCIILiteral("state");
+}
+
 String DiagnosticLoggingKeys::streamingMedia()
 {
     return ASCIILiteral("streamingMedia");
@@ -618,5 +638,10 @@
     return ASCIILiteral("notInCache");
 }
 
+String WebCore::DiagnosticLoggingKeys::webGLKey()
+{
+    return ASCIILiteral("webGL");
+}
+
 } // namespace WebCore
 

Modified: branches/safari-603-branch/Source/WebCore/page/DiagnosticLoggingKeys.h (210875 => 210876)


--- branches/safari-603-branch/Source/WebCore/page/DiagnosticLoggingKeys.h	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebCore/page/DiagnosticLoggingKeys.h	2017-01-18 20:43:31 UTC (rev 210876)
@@ -31,6 +31,8 @@
 
 class DiagnosticLoggingKeys {
 public:
+    WEBCORE_EXPORT static String activeInForegroundTabKey();
+    WEBCORE_EXPORT static String activeInBackgroundTabOnlyKey();
     static String applicationCacheKey();
     static String audioKey();
     WEBCORE_EXPORT static String backNavigationKey();
@@ -56,6 +58,7 @@
     static String httpsNoStoreKey();
     static String imageKey();
     static String inMemoryCacheKey();
+    WEBCORE_EXPORT static String inactiveKey();
     WEBCORE_EXPORT static String internalErrorKey();
     WEBCORE_EXPORT static String invalidSessionIDKey();
     WEBCORE_EXPORT static String isAttachmentKey();
@@ -118,6 +121,7 @@
     static String sameLoadKey();
     static String scriptKey();
     static String sourceKey();
+    WEBCORE_EXPORT static String stateKey();
     WEBCORE_EXPORT static String streamingMedia();
     static String styleSheetKey();
     WEBCORE_EXPORT static String successfulSpeculativeWarmupWithRevalidationKey();
@@ -145,6 +149,7 @@
     static String videoKey();
     WEBCORE_EXPORT static String wastedSpeculativeWarmupWithRevalidationKey();
     WEBCORE_EXPORT static String wastedSpeculativeWarmupWithoutRevalidationKey();
+    WEBCORE_EXPORT static String webGLKey();
     WEBCORE_EXPORT static String webViewKey();
     WEBCORE_EXPORT static String zoomedKey();
 

Modified: branches/safari-603-branch/Source/WebCore/page/Page.cpp (210875 => 210876)


--- branches/safari-603-branch/Source/WebCore/page/Page.cpp	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebCore/page/Page.cpp	2017-01-18 20:43:31 UTC (rev 210876)
@@ -96,6 +96,7 @@
 #include "VisitedLinkState.h"
 #include "VisitedLinkStore.h"
 #include "VoidCallback.h"
+#include "WebGLStateTracker.h"
 #include "Widget.h"
 #include <wtf/RefCountedLeakCounter.h>
 #include <wtf/StdLibExtras.h>
@@ -189,6 +190,7 @@
     , m_plugInClient(pageConfiguration.plugInClient)
     , m_validationMessageClient(WTFMove(pageConfiguration.validationMessageClient))
     , m_diagnosticLoggingClient(WTFMove(pageConfiguration.diagnosticLoggingClient))
+    , m_webGLStateTracker(WTFMove(pageConfiguration.webGLStateTracker))
     , m_openedByDOM(false)
     , m_tabKeyCyclesThroughElements(true)
     , m_defersLoading(false)

Modified: branches/safari-603-branch/Source/WebCore/page/Page.h (210875 => 210876)


--- branches/safari-603-branch/Source/WebCore/page/Page.h	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebCore/page/Page.h	2017-01-18 20:43:31 UTC (rev 210876)
@@ -129,6 +129,7 @@
 class ValidationMessageClient;
 class ActivityStateChangeObserver;
 class VisitedLinkStore;
+class WebGLStateTracker;
 
 typedef uint64_t LinkHash;
 
@@ -553,6 +554,7 @@
     std::optional<EventThrottlingBehavior> eventThrottlingBehaviorOverride() const { return m_eventThrottlingBehaviorOverride; }
     void setEventThrottlingBehaviorOverride(std::optional<EventThrottlingBehavior> throttling) { m_eventThrottlingBehaviorOverride = throttling; }
 
+    WebGLStateTracker* webGLStateTracker() const { return m_webGLStateTracker.get(); }
 private:
     WEBCORE_EXPORT void initGroup();
 
@@ -616,6 +618,7 @@
     PlugInClient* m_plugInClient;
     std::unique_ptr<ValidationMessageClient> m_validationMessageClient;
     std::unique_ptr<DiagnosticLoggingClient> m_diagnosticLoggingClient;
+    std::unique_ptr<WebGLStateTracker> m_webGLStateTracker;
 
     int m_nestedRunLoopCount { 0 };
     std::function<void()> m_unnestCallback;

Modified: branches/safari-603-branch/Source/WebCore/page/PageConfiguration.cpp (210875 => 210876)


--- branches/safari-603-branch/Source/WebCore/page/PageConfiguration.cpp	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebCore/page/PageConfiguration.cpp	2017-01-18 20:43:31 UTC (rev 210876)
@@ -37,6 +37,7 @@
 #include "UserContentController.h"
 #include "ValidationMessageClient.h"
 #include "VisitedLinkStore.h"
+#include "WebGLStateTracker.h"
 
 namespace WebCore {
 

Modified: branches/safari-603-branch/Source/WebCore/page/PageConfiguration.h (210875 => 210876)


--- branches/safari-603-branch/Source/WebCore/page/PageConfiguration.h	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebCore/page/PageConfiguration.h	2017-01-18 20:43:31 UTC (rev 210876)
@@ -50,6 +50,7 @@
 class UserContentProvider;
 class ValidationMessageClient;
 class VisitedLinkStore;
+class WebGLStateTracker;
 
 #if ENABLE(CONTEXT_MENUS)
 class ContextMenuClient;
@@ -80,6 +81,7 @@
     std::unique_ptr<ValidationMessageClient> validationMessageClient;
     FrameLoaderClient* loaderClientForMainFrame { nullptr };
     std::unique_ptr<DiagnosticLoggingClient> diagnosticLoggingClient;
+    std::unique_ptr<WebGLStateTracker> webGLStateTracker;
 
     RefPtr<ApplicationCacheStorage> applicationCacheStorage;
     RefPtr<DatabaseProvider> databaseProvider;

Copied: branches/safari-603-branch/Source/WebCore/platform/WebGLStateTracker.cpp (from rev 210875, branches/safari-603-branch/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h) (0 => 210876)


--- branches/safari-603-branch/Source/WebCore/platform/WebGLStateTracker.cpp	                        (rev 0)
+++ branches/safari-603-branch/Source/WebCore/platform/WebGLStateTracker.cpp	2017-01-18 20:43:31 UTC (rev 210876)
@@ -0,0 +1,53 @@
+/*
+ * 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 "config.h"
+#include "WebGLStateTracker.h"
+
+namespace WebCore {
+
+WebGLStateTracker::WebGLStateTracker(StateChangeHandler&& handler)
+    : m_webGLContextCounter([this](RefCounterEvent) { updateWebGLState(); })
+    , m_stateChangeHandler(WTFMove(handler))
+{
+}
+
+auto WebGLStateTracker::token(bool preferLowPower) -> 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

Copied: branches/safari-603-branch/Source/WebCore/platform/WebGLStateTracker.h (from rev 210875, branches/safari-603-branch/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h) (0 => 210876)


--- branches/safari-603-branch/Source/WebCore/platform/WebGLStateTracker.h	                        (rev 0)
+++ branches/safari-603-branch/Source/WebCore/platform/WebGLStateTracker.h	2017-01-18 20:43:31 UTC (rev 210876)
@@ -0,0 +1,51 @@
+/*
+ * 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 <wtf/Function.h>
+#include <wtf/RefCounter.h>
+
+namespace WebCore {
+
+class WebGLStateTracker {
+public:
+    using StateChangeHandler = Function<void(bool isUsingWebGL)>;
+    WEBCORE_EXPORT explicit WebGLStateTracker(StateChangeHandler&&);
+
+    enum WebGLContextCounterType { };
+    using WebGLContextCounter = RefCounter<WebGLContextCounterType>;
+    using Token = WebGLContextCounter::Token;
+
+    Token token(bool preferLowPower);
+
+private:
+    void updateWebGLState();
+
+    WebGLContextCounter m_webGLContextCounter;
+    StateChangeHandler m_stateChangeHandler;
+};
+
+} // namespace WebCore

Modified: branches/safari-603-branch/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h (210875 => 210876)


--- branches/safari-603-branch/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h	2017-01-18 20:43:31 UTC (rev 210876)
@@ -44,6 +44,7 @@
     bool useGLES3 { false };
     bool noExtensions { false };
     float devicePixelRatio { 1 };
+    bool initialPreferLowPowerToHighPerformance { false };
 };
 
 }

Modified: branches/safari-603-branch/Source/WebKit2/ChangeLog (210875 => 210876)


--- branches/safari-603-branch/Source/WebKit2/ChangeLog	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebKit2/ChangeLog	2017-01-18 20:43:31 UTC (rev 210876)
@@ -1,5 +1,42 @@
 2017-01-18  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r210753. rdar://problem/29883469
+
+    2017-01-13  Chris Dumez  <cdu...@apple.com>
+
+            [WK2] Add diagnostic logging to measure WebGL usage
+            https://bugs.webkit.org/show_bug.cgi?id=166730
+            <rdar://problem/29883469>
+
+            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):
+
+2017-01-18  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r210827. rdar://problem/28620865
 
     2017-01-17  Brady Eidson  <beid...@apple.com>

Added: branches/safari-603-branch/Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.cpp (0 => 210876)


--- branches/safari-603-branch/Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.cpp	                        (rev 0)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.cpp	2017-01-18 20:43:31 UTC (rev 210876)
@@ -0,0 +1,78 @@
+/*
+ * 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 "config.h"
+#include "HighPerformanceGraphicsUsageSampler.h"
+
+#include "WebProcessPool.h"
+#include <WebCore/DiagnosticLoggingKeys.h>
+
+namespace WebKit {
+
+using namespace WebCore;
+
+static const std::chrono::minutes samplingInterval { 10 };
+
+HighPerformanceGraphicsUsageSampler::HighPerformanceGraphicsUsageSampler(WebProcessPool& webProcessPool)
+    : m_webProcessPool(webProcessPool)
+    , m_timer(RunLoop::main(), this, &HighPerformanceGraphicsUsageSampler::timerFired)
+{
+    m_timer.startRepeating(samplingInterval);
+}
+
+void HighPerformanceGraphicsUsageSampler::timerFired()
+{
+    bool isUsingHighPerformanceWebGL = false;
+    bool isUsingHighPerformanceWebGLInVisibleView = false;
+
+    WebPageProxy* firstPage = nullptr;
+    for (auto& webProcess : m_webProcessPool.processes()) {
+        for (auto& page : webProcess->pages()) {
+            if (!firstPage)
+                firstPage = page;
+
+            if (page->isUsingHighPerformanceWebGL()) {
+                isUsingHighPerformanceWebGL = true;
+                if (page->isViewVisible()) {
+                    isUsingHighPerformanceWebGLInVisibleView = true;
+                    break;
+                }
+            }
+        }
+    }
+
+    if (!firstPage)
+        return;
+
+    String state = DiagnosticLoggingKeys::inactiveKey();
+    if (isUsingHighPerformanceWebGLInVisibleView)
+        state = DiagnosticLoggingKeys::activeInForegroundTabKey();
+    else if (isUsingHighPerformanceWebGL)
+        state = DiagnosticLoggingKeys::activeInBackgroundTabOnlyKey();
+
+    firstPage->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::webGLKey(), DiagnosticLoggingKeys::stateKey(), state, false);
+}
+
+} // namespace WebKit

Copied: branches/safari-603-branch/Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.h (from rev 210875, branches/safari-603-branch/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h) (0 => 210876)


--- branches/safari-603-branch/Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.h	                        (rev 0)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.h	2017-01-18 20:43:31 UTC (rev 210876)
@@ -0,0 +1,45 @@
+/*
+ * 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 <wtf/RunLoop.h>
+
+namespace WebKit {
+
+class WebProcessPool;
+
+class HighPerformanceGraphicsUsageSampler {
+public:
+    explicit HighPerformanceGraphicsUsageSampler(WebProcessPool&);
+
+private:
+    void timerFired();
+
+    WebProcessPool& m_webProcessPool;
+    RunLoop::Timer<HighPerformanceGraphicsUsageSampler> m_timer;
+};
+
+} // namespace WebKit

Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.h (210875 => 210876)


--- branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2017-01-18 20:43:31 UTC (rev 210876)
@@ -378,6 +378,9 @@
     bool tryClose();
     bool isClosed() const { return m_isClosed; }
 
+    void setIsUsingHighPerformanceWebGL(bool value) { m_isUsingHighPerformanceWebGL = value; }
+    bool isUsingHighPerformanceWebGL() const { return m_isUsingHighPerformanceWebGL; }
+
     void closePage(bool stopResponsivenessTimer);
 
     void addPlatformLoadParameters(LoadParameters&);
@@ -1973,6 +1976,8 @@
 #if ENABLE(DOWNLOAD_ATTRIBUTE)
     bool m_syncNavigationActionHasDownloadAttribute { false };
 #endif
+
+    bool m_isUsingHighPerformanceWebGL { false };
         
     WeakPtrFactory<WebPageProxy> m_weakPtrFactory;
 };

Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in (210875 => 210876)


--- branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2017-01-18 20:43:31 UTC (rev 210876)
@@ -485,4 +485,6 @@
     DidHandleAcceptedCandidate()
     HandleActiveNowPlayingSessionInfoResponse(bool hasActiveSession, String title, double duration, double elapsedTime)
 #endif
+
+    SetIsUsingHighPerformanceWebGL(bool isUsingHighPerformanceWebGL)
 }

Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/WebProcessPool.cpp (210875 => 210876)


--- branches/safari-603-branch/Source/WebKit2/UIProcess/WebProcessPool.cpp	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/WebProcessPool.cpp	2017-01-18 20:43:31 UTC (rev 210876)
@@ -37,6 +37,7 @@
 #include "DownloadProxy.h"
 #include "DownloadProxyMessages.h"
 #include "GamepadData.h"
+#include "HighPerformanceGraphicsUsageSampler.h"
 #include "LogInitialization.h"
 #include "NetworkProcessCreationParameters.h"
 #include "NetworkProcessMessages.h"
@@ -165,6 +166,9 @@
     , m_memorySamplerEnabled(false)
     , m_memorySamplerInterval(1400.0)
     , m_websiteDataStore(m_configuration->shouldHaveLegacyDataStore() ? API::WebsiteDataStore::create(legacyWebsiteDataStoreConfiguration(m_configuration)).ptr() : nullptr)
+#if PLATFORM(MAC)
+    , m_highPerformanceGraphicsUsageSampler(std::make_unique<HighPerformanceGraphicsUsageSampler>(*this))
+#endif
     , m_shouldUseTestingNetworkSession(false)
     , m_processTerminationEnabled(true)
     , m_canHandleHTTPSServerTrustEvaluation(true)

Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/WebProcessPool.h (210875 => 210876)


--- branches/safari-603-branch/Source/WebKit2/UIProcess/WebProcessPool.h	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/WebProcessPool.h	2017-01-18 20:43:31 UTC (rev 210876)
@@ -79,6 +79,7 @@
 namespace WebKit {
 
 class DownloadProxy;
+class HighPerformanceGraphicsUsageSampler;
 class UIGamepad;
 class WebAutomationSession;
 class WebContextSupplement;
@@ -523,6 +524,8 @@
     RetainPtr<NSObject> m_automaticSpellingCorrectionNotificationObserver;
     RetainPtr<NSObject> m_automaticQuoteSubstitutionNotificationObserver;
     RetainPtr<NSObject> m_automaticDashSubstitutionNotificationObserver;
+
+    std::unique_ptr<HighPerformanceGraphicsUsageSampler> m_highPerformanceGraphicsUsageSampler;
 #endif
 
     String m_overrideIconDatabasePath;

Modified: branches/safari-603-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (210875 => 210876)


--- branches/safari-603-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2017-01-18 20:43:31 UTC (rev 210876)
@@ -1252,6 +1252,8 @@
 		839149651BEA838500D2D953 /* NetworkLoadParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 839149631BEA838500D2D953 /* NetworkLoadParameters.h */; };
 		839902021BE9A02B000F3653 /* NetworkLoad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839901FF1BE9A01B000F3653 /* NetworkLoad.cpp */; };
 		839902031BE9A02B000F3653 /* NetworkLoad.h in Headers */ = {isa = PBXBuildFile; fileRef = 839901FE1BE9A01B000F3653 /* NetworkLoad.h */; };
+		839A2F311E2067450039057E /* HighPerformanceGraphicsUsageSampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839A2F2F1E2067390039057E /* HighPerformanceGraphicsUsageSampler.cpp */; };
+		839A2F321E2067450039057E /* HighPerformanceGraphicsUsageSampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 839A2F301E2067390039057E /* HighPerformanceGraphicsUsageSampler.h */; };
 		83BDCCB91AC5FDB6003F6441 /* NetworkCacheStatistics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BDCCB81AC5FDB6003F6441 /* NetworkCacheStatistics.cpp */; };
 		83BFAC421D96137C00433490 /* BlobDownloadClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BFAC401D96136000433490 /* BlobDownloadClient.h */; };
 		83BFAC431D96137C00433490 /* BlobDownloadClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BFAC411D96136000433490 /* BlobDownloadClient.cpp */; };
@@ -3404,6 +3406,8 @@
 		839149631BEA838500D2D953 /* NetworkLoadParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkLoadParameters.h; path = NetworkProcess/NetworkLoadParameters.h; sourceTree = "<group>"; };
 		839901FE1BE9A01B000F3653 /* NetworkLoad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkLoad.h; path = NetworkProcess/NetworkLoad.h; sourceTree = "<group>"; };
 		839901FF1BE9A01B000F3653 /* NetworkLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkLoad.cpp; path = NetworkProcess/NetworkLoad.cpp; sourceTree = "<group>"; };
+		839A2F2F1E2067390039057E /* HighPerformanceGraphicsUsageSampler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HighPerformanceGraphicsUsageSampler.cpp; sourceTree = "<group>"; };
+		839A2F301E2067390039057E /* HighPerformanceGraphicsUsageSampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HighPerformanceGraphicsUsageSampler.h; sourceTree = "<group>"; };
 		83BDCCB81AC5FDB6003F6441 /* NetworkCacheStatistics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCacheStatistics.cpp; sourceTree = "<group>"; };
 		83BFAC401D96136000433490 /* BlobDownloadClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BlobDownloadClient.h; path = NetworkProcess/Downloads/BlobDownloadClient.h; sourceTree = "<group>"; };
 		83BFAC411D96136000433490 /* BlobDownloadClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BlobDownloadClient.cpp; path = NetworkProcess/Downloads/BlobDownloadClient.cpp; sourceTree = "<group>"; };
@@ -6264,6 +6268,8 @@
 				BC06F44812DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.h */,
 				BC06F43912DBCCFB002D78DE /* GeolocationPermissionRequestProxy.cpp */,
 				BC06F43812DBCCFB002D78DE /* GeolocationPermissionRequestProxy.h */,
+				839A2F2F1E2067390039057E /* HighPerformanceGraphicsUsageSampler.cpp */,
+				839A2F301E2067390039057E /* HighPerformanceGraphicsUsageSampler.h */,
 				31607F3819627002009B87DA /* LegacySessionStateCoding.h */,
 				BC6EDAA5111271C600E7678B /* PageClient.h */,
 				1AC75379183A9FDA0072CB15 /* PageLoadState.cpp */,
@@ -7897,6 +7903,7 @@
 				1A6FBD2811E69BC200DB1371 /* NetscapePlugin.h in Headers */,
 				1A4A9C5612B816CF008FE984 /* NetscapePluginModule.h in Headers */,
 				1AA5889211EE70400061B882 /* NetscapePluginStream.h in Headers */,
+				839A2F321E2067450039057E /* HighPerformanceGraphicsUsageSampler.h in Headers */,
 				E1798C7A16E6818800240139 /* NetworkBlobRegistry.h in Headers */,
 				E4436ECC1A0D040B00EAD204 /* NetworkCache.h in Headers */,
 				E49D40D71AD3FB170066B7B9 /* NetworkCacheBlobStorage.h in Headers */,
@@ -9395,6 +9402,7 @@
 				1A6FBD2911E69BC200DB1371 /* NetscapePlugin.cpp in Sources */,
 				1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */,
 				1A4A9C5512B816CF008FE984 /* NetscapePluginModule.cpp in Sources */,
+				839A2F311E2067450039057E /* HighPerformanceGraphicsUsageSampler.cpp in Sources */,
 				1A4A9C9A12B821CD008FE984 /* NetscapePluginModuleMac.mm in Sources */,
 				1AA5889311EE70400061B882 /* NetscapePluginStream.cpp in Sources */,
 				E1798C7916E6818800240139 /* NetworkBlobRegistry.cpp in Sources */,

Modified: branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (210875 => 210876)


--- branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2017-01-18 20:43:23 UTC (rev 210875)
+++ branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2017-01-18 20:43:31 UTC (rev 210876)
@@ -178,6 +178,7 @@
 #include <WebCore/UserStyleSheet.h>
 #include <WebCore/VisiblePosition.h>
 #include <WebCore/VisibleUnits.h>
+#include <WebCore/WebGLStateTracker.h>
 #include <WebCore/htmlediting.h>
 #include <WebCore/markup.h>
 #include <bindings/ScriptValue.h>
@@ -390,6 +391,9 @@
     pageConfiguration.loaderClientForMainFrame = new WebFrameLoaderClient;
     pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(*this);
     pageConfiguration.diagnosticLoggingClient = std::make_unique<WebDiagnosticLoggingClient>(*this);
+    pageConfiguration.webGLStateTracker = std::make_unique<WebGLStateTracker>([this](bool isUsingHighPerformanceWebGL) {
+        send(Messages::WebPageProxy::SetIsUsingHighPerformanceWebGL(isUsingHighPerformanceWebGL));
+    });
 
 #if PLATFORM(COCOA)
     pageConfiguration.validationMessageClient = std::make_unique<WebValidationMessageClient>(*this);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to