Title: [234704] trunk/Source
Revision
234704
Author
[email protected]
Date
2018-08-08 12:06:43 -0700 (Wed, 08 Aug 2018)

Log Message

Add a WebKit2 logging channel for ActivityState
https://bugs.webkit.org/show_bug.cgi?id=188411

Reviewed by Tim Horton.
Source/WebCore:

Add logging for ActivityState changes and the entrypoints that affect ActivityState.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* page/ActivityState.cpp: Added.
(WebCore::activityStateFlagsToString):
* page/ActivityState.h:

Source/WebKit:

Add logging for ActivityState changes and the entrypoints that affect ActivityState.

* Platform/Logging.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::windowDidOrderOffScreen):
(WebKit::WebViewImpl::windowDidOrderOnScreen):
(WebKit::WebViewImpl::windowDidChangeOcclusionState):
(WebKit::WebViewImpl::viewDidMoveToWindow):
(WebKit::WebViewImpl::viewDidHide):
(WebKit::WebViewImpl::viewDidUnhide):
(WebKit::WebViewImpl::activeSpaceDidChange):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::activityStateDidChange):
(WebKit::WebPageProxy::dispatchActivityStateChange):
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::isViewVisible):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setActivityState):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (234703 => 234704)


--- trunk/Source/WebCore/ChangeLog	2018-08-08 18:10:59 UTC (rev 234703)
+++ trunk/Source/WebCore/ChangeLog	2018-08-08 19:06:43 UTC (rev 234704)
@@ -1,3 +1,18 @@
+2018-08-08  Simon Fraser  <[email protected]>
+
+        Add a WebKit2 logging channel for ActivityState
+        https://bugs.webkit.org/show_bug.cgi?id=188411
+
+        Reviewed by Tim Horton.
+
+        Add logging for ActivityState changes and the entrypoints that affect ActivityState.
+        
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/ActivityState.cpp: Added.
+        (WebCore::activityStateFlagsToString):
+        * page/ActivityState.h:
+
 2018-08-08  Eric Carlson  <[email protected]>
 
         Add LogArgument template for PlatformMediaSession::RemoteControlCommandType

Modified: trunk/Source/WebCore/Sources.txt (234703 => 234704)


--- trunk/Source/WebCore/Sources.txt	2018-08-08 18:10:59 UTC (rev 234703)
+++ trunk/Source/WebCore/Sources.txt	2018-08-08 19:06:43 UTC (rev 234704)
@@ -1349,6 +1349,7 @@
 
 page/AbstractDOMWindow.cpp
 page/AbstractFrame.cpp
+page/ActivityState.cpp
 page/AutoscrollController.cpp
 page/BarProp.cpp
 page/Base64Utilities.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (234703 => 234704)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-08-08 18:10:59 UTC (rev 234703)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-08-08 19:06:43 UTC (rev 234704)
@@ -5645,6 +5645,7 @@
 		0F6383DC18615B29003E5DB5 /* ThreadedScrollingTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadedScrollingTree.h; sourceTree = "<group>"; };
 		0F6A12BB1A00923700C6DE72 /* DebugPageOverlays.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DebugPageOverlays.cpp; sourceTree = "<group>"; };
 		0F6A12BC1A00923700C6DE72 /* DebugPageOverlays.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugPageOverlays.h; sourceTree = "<group>"; };
+		0F70495D211B524200369968 /* ActivityState.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ActivityState.cpp; sourceTree = "<group>"; };
 		0F7DF1471E2BF1A60095951B /* WebCoreJSClientData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreJSClientData.cpp; sourceTree = "<group>"; };
 		0F850FE21ED7C18300FB77A7 /* PerformanceLoggingClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceLoggingClient.h; sourceTree = "<group>"; };
 		0F87166D1C869D83004FF0DE /* LengthPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LengthPoint.cpp; sourceTree = "<group>"; };
@@ -5813,6 +5814,7 @@
 		11EA57FB20FFAFB600311EBB /* SimpleTextRunGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleTextRunGenerator.cpp; sourceTree = "<group>"; };
 		11EA57FC20FFAFB700311EBB /* SimpleTextRunGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleTextRunGenerator.h; sourceTree = "<group>"; };
 		11FF02D520BA3C810083F25B /* Verification.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Verification.cpp; sourceTree = "<group>"; };
+		12F75A9A86EA03DAF24B7971 /* ISOProtectionSystemSpecificHeaderBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISOProtectionSystemSpecificHeaderBox.h; sourceTree = "<group>"; };
 		1400D7A717136EA70077CE05 /* ScriptWrappableInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptWrappableInlines.h; sourceTree = "<group>"; };
 		1402645D0AFDC19B005919E2 /* LoggingMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LoggingMac.mm; sourceTree = "<group>"; };
 		1403B90C09EB124500797C7F /* DOMWindow.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindow.idl; sourceTree = "<group>"; };
@@ -7519,6 +7521,7 @@
 		450CEBEF15073BBE002BB149 /* LabelableElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LabelableElement.h; sourceTree = "<group>"; };
 		4512502015DCE37D002F84E2 /* SpinButtonElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpinButtonElement.cpp; sourceTree = "<group>"; };
 		4512502115DCE37D002F84E2 /* SpinButtonElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpinButtonElement.h; sourceTree = "<group>"; };
+		451A49F8F8726BE071518BE2 /* ISOProtectionSystemSpecificHeaderBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISOProtectionSystemSpecificHeaderBox.cpp; sourceTree = "<group>"; };
 		453EB635159C570400001BB7 /* DateTimeFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateTimeFormat.h; sourceTree = "<group>"; };
 		45830D4B1679B4F800ACF8C3 /* AutoscrollController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutoscrollController.cpp; sourceTree = "<group>"; };
 		45830D4C1679B4F800ACF8C3 /* AutoscrollController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoscrollController.h; sourceTree = "<group>"; };
@@ -13280,8 +13283,6 @@
 		CD871C621FB52B6500F0B965 /* ISOBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISOBox.h; sourceTree = "<group>"; };
 		CD871C631FB52B6600F0B965 /* ISOSchemeInformationBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISOSchemeInformationBox.cpp; sourceTree = "<group>"; };
 		CD871C641FB52B6700F0B965 /* ISOSchemeInformationBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISOSchemeInformationBox.h; sourceTree = "<group>"; };
-		451A49F8F8726BE071518BE2 /* ISOProtectionSystemSpecificHeaderBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISOProtectionSystemSpecificHeaderBox.cpp; sourceTree = "<group>"; };
-		12F75A9A86EA03DAF24B7971 /* ISOProtectionSystemSpecificHeaderBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISOProtectionSystemSpecificHeaderBox.h; sourceTree = "<group>"; };
 		CD871C651FB52B6700F0B965 /* ISOVTTCue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISOVTTCue.h; sourceTree = "<group>"; };
 		CD871C661FB52B6800F0B965 /* ISOTrackEncryptionBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISOTrackEncryptionBox.h; sourceTree = "<group>"; };
 		CD871C671FB52B6800F0B965 /* ISOOriginalFormatBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISOOriginalFormatBox.h; sourceTree = "<group>"; };
@@ -19265,6 +19266,7 @@
 				46B9518A207D632800A7D2DD /* AbstractDOMWindow.h */,
 				46B95194207D633000A7D2DD /* AbstractFrame.cpp */,
 				46B9518F207D632B00A7D2DD /* AbstractFrame.h */,
+				0F70495D211B524200369968 /* ActivityState.cpp */,
 				724EE54E1DC7F25B00A91FFB /* ActivityState.h */,
 				724EE54F1DC7F25B00A91FFB /* ActivityStateChangeObserver.h */,
 				BCF48CE61370D114004E87D6 /* AdjustViewSizeOrNot.h */,

Added: trunk/Source/WebCore/page/ActivityState.cpp (0 => 234704)


--- trunk/Source/WebCore/page/ActivityState.cpp	                        (rev 0)
+++ trunk/Source/WebCore/page/ActivityState.cpp	2018-08-08 19:06:43 UTC (rev 234704)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2018 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 "ActivityState.h"
+
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+String activityStateFlagsToString(ActivityState::Flags flags)
+{
+    StringBuilder builder;
+    
+    auto appendCommaIfNecessary = [&]() {
+        if (!builder.isEmpty())
+            builder.append(", ");
+    };
+    
+    if (flags & WebCore::ActivityState::WindowIsActive) {
+        appendCommaIfNecessary();
+        builder.append("active window");
+    }
+
+    if (flags & WebCore::ActivityState::IsFocused) {
+        appendCommaIfNecessary();
+        builder.append("focused");
+    }
+
+    if (flags & WebCore::ActivityState::IsVisible) {
+        appendCommaIfNecessary();
+        builder.append("visible");
+    }
+
+    if (flags & WebCore::ActivityState::IsVisibleOrOccluded) {
+        appendCommaIfNecessary();
+        builder.append("visible or occluded");
+    }
+
+    if (flags & WebCore::ActivityState::IsInWindow) {
+        appendCommaIfNecessary();
+        builder.append("in-window");
+    }
+
+    if (flags & WebCore::ActivityState::IsVisuallyIdle) {
+        appendCommaIfNecessary();
+        builder.append("visually idle");
+    }
+
+    if (flags & WebCore::ActivityState::IsAudible) {
+        appendCommaIfNecessary();
+        builder.append("audible");
+    }
+
+    if (flags & WebCore::ActivityState::IsLoading) {
+        appendCommaIfNecessary();
+        builder.append("loading");
+    }
+
+    if (flags & WebCore::ActivityState::IsCapturingMedia) {
+        appendCommaIfNecessary();
+        builder.append("capturing media");
+    }
+    
+    return builder.toString();
+}
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/page/ActivityState.h (234703 => 234704)


--- trunk/Source/WebCore/page/ActivityState.h	2018-08-08 18:10:59 UTC (rev 234703)
+++ trunk/Source/WebCore/page/ActivityState.h	2018-08-08 19:06:43 UTC (rev 234704)
@@ -25,6 +25,10 @@
 
 #pragma once
 
+namespace WTF {
+class String;
+}
+
 namespace WebCore {
 
 struct ActivityState {
@@ -52,4 +56,7 @@
     VisibleAndActive
 };
 
+// Ideally this would be operator<<(WTF::TextStream&, ActivityState::Flags) but ActivityState::Flags needs to be strongly typed to avoid ambiguous overloads.
+WEBCORE_EXPORT WTF::String activityStateFlagsToString(ActivityState::Flags);
+
 } // namespace WebCore

Modified: trunk/Source/WebKit/ChangeLog (234703 => 234704)


--- trunk/Source/WebKit/ChangeLog	2018-08-08 18:10:59 UTC (rev 234703)
+++ trunk/Source/WebKit/ChangeLog	2018-08-08 19:06:43 UTC (rev 234704)
@@ -1,3 +1,29 @@
+2018-08-08  Simon Fraser  <[email protected]>
+
+        Add a WebKit2 logging channel for ActivityState
+        https://bugs.webkit.org/show_bug.cgi?id=188411
+
+        Reviewed by Tim Horton.
+        
+        Add logging for ActivityState changes and the entrypoints that affect ActivityState.
+
+        * Platform/Logging.h:
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::windowDidOrderOffScreen):
+        (WebKit::WebViewImpl::windowDidOrderOnScreen):
+        (WebKit::WebViewImpl::windowDidChangeOcclusionState):
+        (WebKit::WebViewImpl::viewDidMoveToWindow):
+        (WebKit::WebViewImpl::viewDidHide):
+        (WebKit::WebViewImpl::viewDidUnhide):
+        (WebKit::WebViewImpl::activeSpaceDidChange):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::activityStateDidChange):
+        (WebKit::WebPageProxy::dispatchActivityStateChange):
+        * UIProcess/mac/PageClientImplMac.mm:
+        (WebKit::PageClientImpl::isViewVisible):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setActivityState):
+
 2018-08-05  Darin Adler  <[email protected]>
 
         [Cocoa] More tweaks and refactoring to prepare for ARC

Modified: trunk/Source/WebKit/Platform/Logging.h (234703 => 234704)


--- trunk/Source/WebKit/Platform/Logging.h	2018-08-08 18:10:59 UTC (rev 234703)
+++ trunk/Source/WebKit/Platform/Logging.h	2018-08-08 19:06:43 UTC (rev 234704)
@@ -40,6 +40,7 @@
 #endif
 
 #define WEBKIT2_LOG_CHANNELS(M) \
+    M(ActivityState) \
     M(BackForward) \
     M(CacheStorage) \
     M(ContextMenu) \

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (234703 => 234704)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2018-08-08 18:10:59 UTC (rev 234703)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2018-08-08 19:06:43 UTC (rev 234704)
@@ -1890,11 +1890,13 @@
 
 void WebViewImpl::windowDidOrderOffScreen()
 {
+    LOG(ActivityState, "WebViewImpl %p (page %llu) windowDidOrderOffScreen", this, m_page->pageID());
     m_page->activityStateDidChange(WebCore::ActivityState::IsVisible | WebCore::ActivityState::WindowIsActive);
 }
 
 void WebViewImpl::windowDidOrderOnScreen()
 {
+    LOG(ActivityState, "WebViewImpl %p (page %llu) windowDidOrderOnScreen", this, m_page->pageID());
     m_page->activityStateDidChange(WebCore::ActivityState::IsVisible | WebCore::ActivityState::WindowIsActive);
 }
 
@@ -1962,6 +1964,7 @@
 
 void WebViewImpl::windowDidChangeOcclusionState()
 {
+    LOG(ActivityState, "WebViewImpl %p (page %llu) windowDidChangeOcclusionState", this, m_page->pageID());
     m_page->activityStateDidChange(WebCore::ActivityState::IsVisible);
 }
 
@@ -2055,6 +2058,8 @@
 {
     NSWindow *window = m_targetWindowForMovePreparation ? m_targetWindowForMovePreparation : [m_view window];
 
+    LOG(ActivityState, "WebViewImpl %p viewDidMoveToWindow %p", this, window);
+
     if (window) {
         windowDidChangeScreen();
 
@@ -2119,16 +2124,19 @@
 
 void WebViewImpl::viewDidHide()
 {
+    LOG(ActivityState, "WebViewImpl %p (page %llu) viewDidHide", this, m_page->pageID());
     m_page->activityStateDidChange(WebCore::ActivityState::IsVisible);
 }
 
 void WebViewImpl::viewDidUnhide()
 {
+    LOG(ActivityState, "WebViewImpl %p (page %llu) viewDidUnhide", this, m_page->pageID());
     m_page->activityStateDidChange(WebCore::ActivityState::IsVisible);
 }
 
 void WebViewImpl::activeSpaceDidChange()
 {
+    LOG(ActivityState, "WebViewImpl %p (page %llu) activeSpaceDidChange", this, m_page->pageID());
     m_page->activityStateDidChange(WebCore::ActivityState::IsVisible);
 }
 

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (234703 => 234704)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-08-08 18:10:59 UTC (rev 234703)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-08-08 19:06:43 UTC (rev 234704)
@@ -157,6 +157,7 @@
 #include <wtf/NeverDestroyed.h>
 #include <wtf/SystemTracing.h>
 #include <wtf/text/StringView.h>
+#include <wtf/text/TextStream.h>
 
 #if ENABLE(APPLICATION_MANIFEST)
 #include "APIApplicationManifest.h"
@@ -1516,6 +1517,8 @@
 
 void WebPageProxy::activityStateDidChange(ActivityState::Flags mayHaveChanged, bool wantsSynchronousReply, ActivityStateChangeDispatchMode dispatchMode)
 {
+    LOG_WITH_STREAM(ActivityState, stream << "WebPageProxy " << pageID() << " activityStateDidChange - mayHaveChanged " <<  activityStateFlagsToString(mayHaveChanged));
+
     m_potentiallyChangedActivityStateFlags |= mayHaveChanged;
     m_activityStateChangeWantsSynchronousReply = m_activityStateChangeWantsSynchronousReply || wantsSynchronousReply;
 
@@ -1563,6 +1566,8 @@
     if (!isValid())
         return;
 
+    LOG_WITH_STREAM(ActivityState, stream << "WebPageProxy " << pageID() << " dispatchActivityStateChange - potentiallyChangedActivityStateFlags " << activityStateFlagsToString(m_potentiallyChangedActivityStateFlags));
+
     // If the visibility state may have changed, then so may the visually idle & occluded agnostic state.
     if (m_potentiallyChangedActivityStateFlags & ActivityState::IsVisible)
         m_potentiallyChangedActivityStateFlags |= ActivityState::IsVisibleOrOccluded | ActivityState::IsVisuallyIdle;
@@ -1573,6 +1578,9 @@
     updateActivityState(m_potentiallyChangedActivityStateFlags);
     ActivityState::Flags changed = m_activityState ^ previousActivityState;
 
+    if (changed)
+        LOG_WITH_STREAM(ActivityState, stream << "WebPageProxy " << pageID() << " dispatchActivityStateChange: state changed from " << activityStateFlagsToString(previousActivityState) << " to " << activityStateFlagsToString(m_activityState));
+
     if ((m_potentiallyChangedActivityStateFlags & ActivityState::IsVisible) && isViewVisible())
         viewIsBecomingVisible();
 

Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm (234703 => 234704)


--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2018-08-08 18:10:59 UTC (rev 234703)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2018-08-08 19:06:43 UTC (rev 234704)
@@ -33,6 +33,7 @@
 #import "DataReference.h"
 #import "DownloadProxy.h"
 #import "DrawingAreaProxy.h"
+#import "Logging.h"
 #import "NativeWebGestureEvent.h"
 #import "NativeWebKeyboardEvent.h"
 #import "NativeWebMouseEvent.h"
@@ -198,6 +199,13 @@
     NSView *activeView = this->activeView();
     NSWindow *activeViewWindow = activeWindow();
 
+    auto windowIsOccluded = [&]()->bool {
+        return m_impl && m_impl->windowOcclusionDetectionEnabled() && (activeViewWindow.occlusionState & NSWindowOcclusionStateVisible) != NSWindowOcclusionStateVisible;
+    };
+
+    LOG_WITH_STREAM(ActivityState, stream << "PageClientImpl " << this << " isViewVisible(): activeViewWindow " << activeViewWindow
+        << " (window visible " << activeViewWindow.isVisible << ", view hidden " << activeView.isHiddenOrHasHiddenAncestor << ", window occluded " << windowIsOccluded() << ")");
+
     if (!activeViewWindow)
         return false;
 
@@ -207,7 +215,7 @@
     if (activeView.isHiddenOrHasHiddenAncestor)
         return false;
 
-    if (m_impl->windowOcclusionDetectionEnabled() && (activeViewWindow.occlusionState & NSWindowOcclusionStateVisible) != NSWindowOcclusionStateVisible)
+    if (windowIsOccluded())
         return false;
 
     return true;

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (234703 => 234704)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-08-08 18:10:59 UTC (rev 234703)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-08-08 19:06:43 UTC (rev 234704)
@@ -2796,6 +2796,8 @@
 
 void WebPage::setActivityState(ActivityState::Flags activityState, ActivityStateChangeID activityStateChangeID, const Vector<CallbackID>& callbackIDs)
 {
+    LOG_WITH_STREAM(ActivityState, stream << "WebPage " << pageID() << " setActivityState to " << activityStateFlagsToString(activityState));
+
     ActivityState::Flags changed = m_activityState ^ activityState;
     m_activityState = activityState;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to