[WK2] Add diagnostic logging to measure WebGL usage
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Jan 2017 01:05:32 +0000 (01:05 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Jan 2017 01:05:32 +0000 (01:05 +0000)
commitaaa9a29312e25dd3de4fff49cc18ebce8c99b3d0
treeea5bc3b3158226a0b85200341c77f5395119501f
parent32b5a6c3ec9c1d9e543de977caf3913aab5059a9
[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

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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210753 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
Source/WebCore/html/canvas/WebGLRenderingContextBase.h
Source/WebCore/page/DiagnosticLoggingKeys.cpp
Source/WebCore/page/DiagnosticLoggingKeys.h
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/page/PageConfiguration.cpp
Source/WebCore/page/PageConfiguration.h
Source/WebCore/platform/WebGLStateTracker.cpp [new file with mode: 0644]
Source/WebCore/platform/WebGLStateTracker.h [new file with mode: 0644]
Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.h [new file with mode: 0644]
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/WebProcessPool.cpp
Source/WebKit2/UIProcess/WebProcessPool.h
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebPage/WebPage.cpp