WebKit should set a subsystem for os_log so it's easier to filter for WebKit log messages
https://bugs.webkit.org/show_bug.cgi?id=160969
<rdar://problem/26068734>
Reviewed by Simon Fraser.
Source/WebCore:
- Specify a channel when using RELEASE_LOG macros
- Add a new channel so that we have something to pass to the
RELEASE_LOG macros (Layers).
- Enable subsystem- and channel-related data and functions when using
RELEASE_LOG macros.
- Use the DECLARE_LOG_CHANNEL, DEFINE_LOG_CHANNEL, and
LOG_CHANNEL_ADDRESS macros that are now defined in WTF.
No new tests. There are no tests for logging.
* loader/FrameLoader.cpp:
* platform/LogInitialization.h:
* platform/LogMacros.h:
* platform/Logging.cpp:
* platform/Logging.h:
* platform/MemoryPressureHandler.cpp:
(WebCore::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawNativeImage):
* platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::IOSurface):
* platform/mac/LoggingMac.mm:
* platform/unix/LoggingUnix.cpp:
* platform/win/LoggingWin.cpp:
* testing/js/WebCoreTestSupport.cpp:
(WebCoreTestSupport::initializeLogChannelsIfNecessary):
Source/WebKit/mac:
Enable subsystem- and channel-related data and functions when using
RELEASE_LOG macros. Use the DECLARE_LOG_CHANNEL, DEFINE_LOG_CHANNEL,
and LOG_CHANNEL_ADDRESS macros that are now defined in WTF.
* Misc/WebKitLogging.h:
* Misc/WebKitLogging.m:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
Source/WebKit/win:
Enable subsystem- and channel-related data and functions when using
RELEASE_LOG macros. Use the DECLARE_LOG_CHANNEL, DEFINE_LOG_CHANNEL,
and LOG_CHANNEL_ADDRESS macros that are now defined in WTF.
* WebKitLogging.cpp:
* WebKitLogging.h:
* WebView.cpp:
(WebView::initWithFrame):
Source/WebKit2:
- Specify a channel when using RELEASE_LOG macros.
- Add some new channels so that we have something to pass to the
RELEASE_LOG macros (ProcessSuspension, IPC, Layers).
- Enable subsystem- and channel-related data and functions when using
RELEASE_LOG macros.
- Use the DECLARE_LOG_CHANNEL, DEFINE_LOG_CHANNEL, and
LOG_CHANNEL_ADDRESS macros that are now defined in WTF.
* NetworkProcess/Downloads/Download.cpp:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::prepareToSuspend):
(WebKit::NetworkProcess::cancelPrepareToSuspend):
(WebKit::NetworkProcess::processDidResume):
* NetworkProcess/NetworkResourceLoader.cpp:
* Platform/IPC/Connection.cpp:
(IPC::Connection::waitForSyncReply):
* Platform/LogInitialization.h:
* Platform/Logging.cpp:
(WebKit::initializeLogChannelsIfNecessary):
* Platform/Logging.h:
* Platform/foundation/LoggingFoundation.mm:
* Platform/unix/LoggingUnix.cpp:
* Shared/ChildProcess.cpp:
(WebKit::didCloseOnConnectionWorkQueue):
* Shared/WebKit2Initialize.cpp:
(WebKit::InitializeWebKit2):
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::releaseNetworkActivityToken):
(WebKit::NavigationState::didChangeIsLoading):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::fetchWebsiteData):
(WebKit::NetworkProcessProxy::deleteWebsiteData):
(WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
(WebKit::NetworkProcessProxy::setIsHoldingLockedFiles):
* UIProcess/ProcessThrottler.cpp:
(WebKit::ProcessThrottler::updateAssertionNow):
(WebKit::ProcessThrottler::updateAssertion):
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebProcessPool.cpp:
(WebKit::m_hiddenPageThrottlingTimer):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::fetchWebsiteData):
(WebKit::WebProcessProxy::deleteWebsiteData):
(WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
(WebKit::WebProcessProxy::didSetAssertionState):
(WebKit::WebProcessProxy::setIsHoldingLockedFiles):
* UIProcess/ios/ProcessAssertionIOS.mm:
(-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
(WebKit::ProcessAssertion::ProcessAssertion):
* WebProcess/Network/WebLoaderStrategy.cpp:
* WebProcess/Network/WebResourceLoader.cpp:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::layerVolatilityTimerFired):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::actualPrepareToSuspend):
(WebKit::WebProcess::processWillSuspendImminently):
(WebKit::WebProcess::prepareToSuspend):
(WebKit::WebProcess::cancelPrepareToSuspend):
(WebKit::WebProcess::markAllLayersVolatile):
(WebKit::WebProcess::processDidResume):
Source/WTF:
Add support for attaching a subsystem and category when logging via
the RELEASE_LOG macros. This support is provided by adding subsystem
and category information to WTFLogChannel. An os_log_t object is then
created to enacpsulate that information. When using RELEASE_LOG to log
through that channel, the associated log object is used when calling
os_log.
To help support the inclusion of the subsystem and category
information in WTFLogChannel, the DECLARE_LOG_CHANNEL,
DEFINE_LOG_CHANNEL, and LOG_CHANNEL_ADDRESS macros that were defined
in various modules are consolidated and moved to Assertions.h.
DEFINE_LOG_CHANNEL is now defined to initialize the subsystem and
category.
* wtf/Assertions.cpp:
* wtf/Assertions.h:
* wtf/RefCountedLeakCounter.cpp:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@205275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp
index cb304c4..2e5d7bc 100644
--- a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp
@@ -30,6 +30,7 @@
#include "CustomProtocolManagerProxyMessages.h"
#include "DatabaseProcessMessages.h"
#include "DownloadProxyMessages.h"
+#include "Logging.h"
#include "NetworkProcessCreationParameters.h"
#include "NetworkProcessMessages.h"
#include "SandboxExtension.h"
@@ -125,11 +126,11 @@
uint64_t callbackID = generateCallbackID();
auto token = throttler().backgroundActivityToken();
- RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), "%p - NetworkProcessProxy is taking a background assertion because the Network process is fetching Website data", this);
+ RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - NetworkProcessProxy is taking a background assertion because the Network process is fetching Website data", this);
m_pendingFetchWebsiteDataCallbacks.add(callbackID, [this, token, completionHandler, sessionID](WebsiteData websiteData) {
completionHandler(WTFMove(websiteData));
- RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), "%p - NetworkProcessProxy is releasing a background assertion because the Network process is done fetching Website data", this);
+ RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - NetworkProcessProxy is releasing a background assertion because the Network process is done fetching Website data", this);
});
send(Messages::NetworkProcess::FetchWebsiteData(sessionID, dataTypes, fetchOptions, callbackID), 0);
@@ -139,11 +140,11 @@
{
auto callbackID = generateCallbackID();
auto token = throttler().backgroundActivityToken();
- RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), "%p - NetworkProcessProxy is taking a background assertion because the Network process is deleting Website data", this);
+ RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - NetworkProcessProxy is taking a background assertion because the Network process is deleting Website data", this);
m_pendingDeleteWebsiteDataCallbacks.add(callbackID, [this, token, completionHandler, sessionID] {
completionHandler();
- RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), "%p - NetworkProcessProxy is releasing a background assertion because the Network process is done deleting Website data", this);
+ RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - NetworkProcessProxy is releasing a background assertion because the Network process is done deleting Website data", this);
});
send(Messages::NetworkProcess::DeleteWebsiteData(sessionID, dataTypes, modifiedSince, callbackID), 0);
}
@@ -154,11 +155,11 @@
uint64_t callbackID = generateCallbackID();
auto token = throttler().backgroundActivityToken();
- RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), "%p - NetworkProcessProxy is taking a background assertion because the Network process is deleting Website data for several origins", this);
+ RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - NetworkProcessProxy is taking a background assertion because the Network process is deleting Website data for several origins", this);
m_pendingDeleteWebsiteDataForOriginsCallbacks.add(callbackID, [this, token, completionHandler, sessionID] {
completionHandler();
- RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), "%p - NetworkProcessProxy is releasing a background assertion because the Network process is done deleting Website data for several origins", this);
+ RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - NetworkProcessProxy is releasing a background assertion because the Network process is done deleting Website data for several origins", this);
});
Vector<SecurityOriginData> originData;
@@ -401,12 +402,12 @@
void NetworkProcessProxy::setIsHoldingLockedFiles(bool isHoldingLockedFiles)
{
if (!isHoldingLockedFiles) {
- RELEASE_LOG("UIProcess is releasing a background assertion because the Network process is no longer holding locked files");
+ RELEASE_LOG(ProcessSuspension, "UIProcess is releasing a background assertion because the Network process is no longer holding locked files");
m_tokenForHoldingLockedFiles = nullptr;
return;
}
if (!m_tokenForHoldingLockedFiles) {
- RELEASE_LOG("UIProcess is taking a background assertion because the Network process is holding locked files");
+ RELEASE_LOG(ProcessSuspension, "UIProcess is taking a background assertion because the Network process is holding locked files");
m_tokenForHoldingLockedFiles = m_throttler.backgroundActivityToken();
}
}