Changeset 211211 in webkit


Ignore:
Timestamp:
Jan 26, 2017 7:52:52 AM (7 years ago)
Author:
matthew_hanson@apple.com
Message:

Merge r211151. rdar://problem/30171195

Location:
branches/safari-603-branch/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-603-branch/Source/WebCore/ChangeLog

    r211190 r211211  
     12017-01-25  Matthew Hanson  <matthew_hanson@apple.com>
     2
     3        Merge r211151. rdar://problem/30171195
     4
     5    2017-01-25  Chris Dumez  <cdumez@apple.com>
     6
     7            Measure how common it is for content to deal with WebGL context loss
     8            https://bugs.webkit.org/show_bug.cgi?id=166866
     9            <rdar://problem/30171195>
     10
     11            Reviewed by Alex Christensen.
     12
     13            Add diagnostic logging to measure how common it is for sites to handle
     14            WebGL context loss via the webglcontextlost & webglcontextrestored
     15            events.
     16
     17            * html/canvas/WebGLRenderingContextBase.cpp:
     18            (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
     19            (WebCore::WebGLRenderingContextBase::checkForContextLossHandling):
     20            * html/canvas/WebGLRenderingContextBase.h:
     21            * page/DiagnosticLoggingKeys.cpp:
     22            (WebCore::DiagnosticLoggingKeys::noKey):
     23            (WebCore::DiagnosticLoggingKeys::yesKey):
     24            (WebCore::DiagnosticLoggingKeys::handlesContextLossKey):
     25            * page/DiagnosticLoggingKeys.h:
     26
    1272017-01-25  Matthew Hanson  <matthew_hanson@apple.com>
    228
  • branches/safari-603-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp

    r210876 r211211  
    3232#include "CachedImage.h"
    3333#include "DOMWindow.h"
     34#include "DiagnosticLoggingClient.h"
     35#include "DiagnosticLoggingKeys.h"
    3436#include "Document.h"
    3537#include "EXTBlendMinMax.h"
     
    101103const double secondsBetweenRestoreAttempts = 1.0;
    102104const int maxGLErrorsAllowedToConsole = 256;
     105static const std::chrono::seconds checkContextLossHandlingDelay { 3 };
    103106
    104107namespace {
     
    471474    , m_isPendingPolicyResolution(true)
    472475    , m_hasRequestedPolicyResolution(false)
     476    , m_checkForContextLossHandlingTimer(*this, &WebGLRenderingContextBase::checkForContextLossHandling)
    473477{
    474478    registerWithWebGLStateTracker();
     479    m_checkForContextLossHandlingTimer.startOneShot(checkContextLossHandlingDelay);
    475480}
    476481
     
    490495    , m_isPendingPolicyResolution(false)
    491496    , m_hasRequestedPolicyResolution(false)
     497    , m_checkForContextLossHandlingTimer(*this, &WebGLRenderingContextBase::checkForContextLossHandling)
    492498{
    493499    ASSERT(m_context);
     
    503509    initializeNewContext();
    504510    registerWithWebGLStateTracker();
     511    m_checkForContextLossHandlingTimer.startOneShot(checkContextLossHandlingDelay);
     512}
     513
     514// We check for context loss handling after a few seconds to give the JS a chance to register the event listeners
     515// and to discard temporary GL contexts (e.g. feature detection).
     516void WebGLRenderingContextBase::checkForContextLossHandling()
     517{
     518    if (!canvas().renderer())
     519        return;
     520
     521    auto* page = canvas().document().page();
     522    if (!page)
     523        return;
     524
     525    bool handlesContextLoss = canvas().hasEventListeners(eventNames().webglcontextlostEvent) && canvas().hasEventListeners(eventNames().webglcontextrestoredEvent);
     526    page->diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::webGLKey(), DiagnosticLoggingKeys::handlesContextLossKey(), handlesContextLoss ? DiagnosticLoggingKeys::yesKey() : DiagnosticLoggingKeys::noKey(), ShouldSample::No);
    505527}
    506528
  • branches/safari-603-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.h

    r210876 r211211  
    804804    bool validateArrayBufferType(const char* functionName, GC3Denum type, std::optional<JSC::TypedArrayType>);
    805805    void registerWithWebGLStateTracker();
     806    void checkForContextLossHandling();
    806807
    807808    WebGLStateTracker::Token m_trackerToken;
     809    Timer m_checkForContextLossHandlingTimer;
    808810};
    809811
  • branches/safari-603-branch/Source/WebCore/page/DiagnosticLoggingKeys.cpp

    r211188 r211211  
    154154}
    155155
     156String DiagnosticLoggingKeys::noKey()
     157{
     158    return ASCIILiteral("no");
     159}
     160
    156161String DiagnosticLoggingKeys::noCacheKey()
    157162{
     
    634639}
    635640
     641String DiagnosticLoggingKeys::yesKey()
     642{
     643    return ASCIILiteral("yes");
     644}
     645
    636646String DiagnosticLoggingKeys::zoomedKey()
    637647{
     
    647657{
    648658    return ASCIILiteral("font");
     659}
     660
     661String DiagnosticLoggingKeys::handlesContextLossKey()
     662{
     663    return ASCIILiteral("handlesContextLoss");
    649664}
    650665
  • branches/safari-603-branch/Source/WebCore/page/DiagnosticLoggingKeys.h

    r211188 r211211  
    5757    static String expiredKey();
    5858    static String fontKey();
     59    static String handlesContextLossKey();
    5960    static String hasPluginsKey();
    6061    static String httpsNoStoreKey();
     
    8586    WEBCORE_EXPORT static String networkProcessCrashedKey();
    8687    WEBCORE_EXPORT static String neverSeenBeforeKey();
     88    static String noKey();
    8789    static String noCacheKey();
    8890    static String noCurrentHistoryItemKey();
     
    159161    WEBCORE_EXPORT static String webGLKey();
    160162    WEBCORE_EXPORT static String webViewKey();
     163    static String yesKey();
    161164    WEBCORE_EXPORT static String zoomedKey();
    162165
Note: See TracChangeset for help on using the changeset viewer.