Changeset 211151 in webkit
- Timestamp:
- Jan 25, 2017 9:51:13 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r211149 r211151 1 2017-01-25 Chris Dumez <cdumez@apple.com> 2 3 Measure how common it is for content to deal with WebGL context loss 4 https://bugs.webkit.org/show_bug.cgi?id=166866 5 <rdar://problem/30171195> 6 7 Reviewed by Alex Christensen. 8 9 Add diagnostic logging to measure how common it is for sites to handle 10 WebGL context loss via the webglcontextlost & webglcontextrestored 11 events. 12 13 * html/canvas/WebGLRenderingContextBase.cpp: 14 (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase): 15 (WebCore::WebGLRenderingContextBase::checkForContextLossHandling): 16 * html/canvas/WebGLRenderingContextBase.h: 17 * page/DiagnosticLoggingKeys.cpp: 18 (WebCore::DiagnosticLoggingKeys::noKey): 19 (WebCore::DiagnosticLoggingKeys::yesKey): 20 (WebCore::DiagnosticLoggingKeys::handlesContextLossKey): 21 * page/DiagnosticLoggingKeys.h: 22 1 23 2017-01-25 Simon Fraser <simon.fraser@apple.com> 2 24 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r211085 r211151 32 32 #include "CachedImage.h" 33 33 #include "DOMWindow.h" 34 #include "DiagnosticLoggingClient.h" 35 #include "DiagnosticLoggingKeys.h" 34 36 #include "Document.h" 35 37 #include "EXTBlendMinMax.h" … … 101 103 const double secondsBetweenRestoreAttempts = 1.0; 102 104 const int maxGLErrorsAllowedToConsole = 256; 105 static const std::chrono::seconds checkContextLossHandlingDelay { 3 }; 103 106 104 107 namespace { … … 457 460 , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole) 458 461 , m_isPendingPolicyResolution(true) 462 , m_checkForContextLossHandlingTimer(*this, &WebGLRenderingContextBase::checkForContextLossHandling) 459 463 { 460 464 registerWithWebGLStateTracker(); 465 m_checkForContextLossHandlingTimer.startOneShot(checkContextLossHandlingDelay); 461 466 } 462 467 … … 470 475 , m_attributes(attributes) 471 476 , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole) 477 , m_checkForContextLossHandlingTimer(*this, &WebGLRenderingContextBase::checkForContextLossHandling) 472 478 { 473 479 m_contextGroup = WebGLContextGroup::create(); … … 481 487 initializeNewContext(); 482 488 registerWithWebGLStateTracker(); 489 m_checkForContextLossHandlingTimer.startOneShot(checkContextLossHandlingDelay); 490 } 491 492 // We check for context loss handling after a few seconds to give the JS a chance to register the event listeners 493 // and to discard temporary GL contexts (e.g. feature detection). 494 void WebGLRenderingContextBase::checkForContextLossHandling() 495 { 496 if (!canvas().renderer()) 497 return; 498 499 auto* page = canvas().document().page(); 500 if (!page) 501 return; 502 503 bool handlesContextLoss = canvas().hasEventListeners(eventNames().webglcontextlostEvent) && canvas().hasEventListeners(eventNames().webglcontextrestoredEvent); 504 page->diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::webGLKey(), DiagnosticLoggingKeys::handlesContextLossKey(), handlesContextLoss ? DiagnosticLoggingKeys::yesKey() : DiagnosticLoggingKeys::noKey(), ShouldSample::No); 483 505 } 484 506 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h
r210753 r211151 828 828 bool validateArrayBufferType(const char* functionName, GC3Denum type, std::optional<JSC::TypedArrayType>); 829 829 void registerWithWebGLStateTracker(); 830 void checkForContextLossHandling(); 830 831 831 832 WebGLStateTracker::Token m_trackerToken; 833 Timer m_checkForContextLossHandlingTimer; 832 834 }; 833 835 -
trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp
r211120 r211151 154 154 } 155 155 156 String DiagnosticLoggingKeys::noKey() 157 { 158 return ASCIILiteral("no"); 159 } 160 156 161 String DiagnosticLoggingKeys::noCacheKey() 157 162 { … … 634 639 } 635 640 641 String DiagnosticLoggingKeys::yesKey() 642 { 643 return ASCIILiteral("yes"); 644 } 645 636 646 String DiagnosticLoggingKeys::zoomedKey() 637 647 { … … 647 657 { 648 658 return ASCIILiteral("font"); 659 } 660 661 String DiagnosticLoggingKeys::handlesContextLossKey() 662 { 663 return ASCIILiteral("handlesContextLoss"); 649 664 } 650 665 -
trunk/Source/WebCore/page/DiagnosticLoggingKeys.h
r211120 r211151 57 57 static String expiredKey(); 58 58 static String fontKey(); 59 static String handlesContextLossKey(); 59 60 static String hasPluginsKey(); 60 61 static String httpsNoStoreKey(); … … 85 86 WEBCORE_EXPORT static String networkProcessCrashedKey(); 86 87 WEBCORE_EXPORT static String neverSeenBeforeKey(); 88 static String noKey(); 87 89 static String noCacheKey(); 88 90 static String noCurrentHistoryItemKey(); … … 159 161 WEBCORE_EXPORT static String webGLKey(); 160 162 WEBCORE_EXPORT static String webViewKey(); 163 static String yesKey(); 161 164 WEBCORE_EXPORT static String zoomedKey(); 162 165
Note: See TracChangeset
for help on using the changeset viewer.