Title: [253900] trunk/Source
Revision
253900
Author
[email protected]
Date
2019-12-24 10:10:53 -0800 (Tue, 24 Dec 2019)

Log Message

[Media in GPU process] Enable media player proxy logging
https://bugs.webkit.org/show_bug.cgi?id=205557
<rdar://problem/58160932>

Reviewed by Youenn Fablet.

Source/WebKit:

* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::create):
(WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess):
(WebKit::GPUConnectionToWebProcess::logger):
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::createGPUConnectionToWebProcess):
* GPUProcess/GPUProcess.h:
* GPUProcess/GPUProcess.messages.in:
* GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
(WebKit::RemoteMediaPlayerManagerProxy::logger const):
(WebKit::nullLogger): Deleted.
* Platform/Logging.h:
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::openGPUProcessConnection):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::logChannel const):

Source/WTF:

* wtf/Logger.h:
(WTF::Logger::willLog const): Minor optimization: don't check m_enabled unnecessarily.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (253899 => 253900)


--- trunk/Source/WTF/ChangeLog	2019-12-24 14:41:20 UTC (rev 253899)
+++ trunk/Source/WTF/ChangeLog	2019-12-24 18:10:53 UTC (rev 253900)
@@ -1,3 +1,14 @@
+2019-12-24  Eric Carlson  <[email protected]>
+
+        [Media in GPU process] Enable media player proxy logging
+        https://bugs.webkit.org/show_bug.cgi?id=205557
+        <rdar://problem/58160932>
+
+        Reviewed by Youenn Fablet.
+
+        * wtf/Logger.h:
+        (WTF::Logger::willLog const): Minor optimization: don't check m_enabled unnecessarily.
+
 2019-12-23  Keith Miller  <[email protected]>
 
         DFG/FTL should be able to exit to the middle of a bytecode

Modified: trunk/Source/WTF/wtf/Logger.h (253899 => 253900)


--- trunk/Source/WTF/wtf/Logger.h	2019-12-24 14:41:20 UTC (rev 253899)
+++ trunk/Source/WTF/wtf/Logger.h	2019-12-24 18:10:53 UTC (rev 253900)
@@ -185,7 +185,7 @@
         if (channel.state == WTFLogChannelState::Off || level > channel.level)
             return false;
 
-        return m_enabled;
+        return true;
     }
 
     bool enabled() const { return m_enabled; }

Modified: trunk/Source/WebKit/ChangeLog (253899 => 253900)


--- trunk/Source/WebKit/ChangeLog	2019-12-24 14:41:20 UTC (rev 253899)
+++ trunk/Source/WebKit/ChangeLog	2019-12-24 18:10:53 UTC (rev 253900)
@@ -1,3 +1,29 @@
+2019-12-24  Eric Carlson  <[email protected]>
+
+        [Media in GPU process] Enable media player proxy logging
+        https://bugs.webkit.org/show_bug.cgi?id=205557
+        <rdar://problem/58160932>
+
+        Reviewed by Youenn Fablet.
+
+        * GPUProcess/GPUConnectionToWebProcess.cpp:
+        (WebKit::GPUConnectionToWebProcess::create):
+        (WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess):
+        (WebKit::GPUConnectionToWebProcess::logger):
+        * GPUProcess/GPUConnectionToWebProcess.h:
+        * GPUProcess/GPUProcess.cpp:
+        (WebKit::GPUProcess::createGPUConnectionToWebProcess):
+        * GPUProcess/GPUProcess.h:
+        * GPUProcess/GPUProcess.messages.in:
+        * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
+        (WebKit::RemoteMediaPlayerManagerProxy::logger const):
+        (WebKit::nullLogger): Deleted.
+        * Platform/Logging.h:
+        * UIProcess/GPU/GPUProcessProxy.cpp:
+        (WebKit::GPUProcessProxy::openGPUProcessConnection):
+        * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
+        (WebKit::MediaPlayerPrivateRemote::logChannel const):
+
 2019-12-24  youenn fablet  <[email protected]>
 
         Service Worker doesn't terminate after a period of time when thread blocking

Modified: trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp (253899 => 253900)


--- trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp	2019-12-24 14:41:20 UTC (rev 253899)
+++ trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp	2019-12-24 18:10:53 UTC (rev 253900)
@@ -67,15 +67,16 @@
 };
 #endif
 
-Ref<GPUConnectionToWebProcess> GPUConnectionToWebProcess::create(GPUProcess& gpuProcess, WebCore::ProcessIdentifier webProcessIdentifier, IPC::Connection::Identifier connectionIdentifier)
+Ref<GPUConnectionToWebProcess> GPUConnectionToWebProcess::create(GPUProcess& gpuProcess, WebCore::ProcessIdentifier webProcessIdentifier, IPC::Connection::Identifier connectionIdentifier, PAL::SessionID sessionID)
 {
-    return adoptRef(*new GPUConnectionToWebProcess(gpuProcess, webProcessIdentifier, connectionIdentifier));
+    return adoptRef(*new GPUConnectionToWebProcess(gpuProcess, webProcessIdentifier, connectionIdentifier, sessionID));
 }
 
-GPUConnectionToWebProcess::GPUConnectionToWebProcess(GPUProcess& gpuProcess, WebCore::ProcessIdentifier webProcessIdentifier, IPC::Connection::Identifier connectionIdentifier)
+GPUConnectionToWebProcess::GPUConnectionToWebProcess(GPUProcess& gpuProcess, WebCore::ProcessIdentifier webProcessIdentifier, IPC::Connection::Identifier connectionIdentifier, PAL::SessionID sessionID)
     : m_connection(IPC::Connection::createServerConnection(connectionIdentifier, *this))
     , m_gpuProcess(gpuProcess)
     , m_webProcessIdentifier(webProcessIdentifier)
+    , m_sessionID(sessionID)
 {
     RELEASE_ASSERT(RunLoop::isMain());
     m_connection->open();
@@ -92,6 +93,16 @@
 {
 }
 
+Logger& GPUConnectionToWebProcess::logger()
+{
+    if (!m_logger) {
+        m_logger = Logger::create(this);
+        m_logger->setEnabled(this, m_sessionID.isAlwaysOnLoggingAllowed());
+    }
+
+    return *m_logger;
+}
+
 void GPUConnectionToWebProcess::didReceiveInvalidMessage(IPC::Connection& connection, IPC::StringReference messageReceiverName, IPC::StringReference messageName)
 {
     WTFLogAlways("Received an invalid message \"%s.%s\" from the web process.\n", messageReceiverName.toString().data(), messageName.toString().data());

Modified: trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h (253899 => 253900)


--- trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h	2019-12-24 14:41:20 UTC (rev 253899)
+++ trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h	2019-12-24 18:10:53 UTC (rev 253900)
@@ -31,6 +31,8 @@
 #include "GPUConnectionToWebProcessMessagesReplies.h"
 #include <WebCore/DisplayListItems.h>
 #include <WebCore/ProcessIdentifier.h>
+#include <pal/SessionID.h>
+#include <wtf/Logger.h>
 #include <wtf/RefCounted.h>
 #include <wtf/UniqueRef.h>
 
@@ -44,7 +46,7 @@
     : public RefCounted<GPUConnectionToWebProcess>
     , IPC::Connection::Client {
 public:
-    static Ref<GPUConnectionToWebProcess> create(GPUProcess&, WebCore::ProcessIdentifier, IPC::Connection::Identifier);
+    static Ref<GPUConnectionToWebProcess> create(GPUProcess&, WebCore::ProcessIdentifier, IPC::Connection::Identifier, PAL::SessionID);
     virtual ~GPUConnectionToWebProcess();
 
     IPC::Connection& connection() { return m_connection.get(); }
@@ -55,8 +57,10 @@
 
     WebCore::ProcessIdentifier webProcessIdentifier() const { return m_webProcessIdentifier; }
 
+    Logger& logger();
+
 private:
-    GPUConnectionToWebProcess(GPUProcess&, WebCore::ProcessIdentifier, IPC::Connection::Identifier);
+    GPUConnectionToWebProcess(GPUProcess&, WebCore::ProcessIdentifier, IPC::Connection::Identifier, PAL::SessionID);
 
     RemoteMediaPlayerManagerProxy& remoteMediaPlayerManagerProxy();
 #if PLATFORM(COCOA) && ENABLE(MEDIA_STREAM)
@@ -69,10 +73,13 @@
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
     void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) final;
 
+    RefPtr<Logger> m_logger;
+
     Ref<IPC::Connection> m_connection;
     Ref<GPUProcess> m_gpuProcess;
     const WebCore::ProcessIdentifier m_webProcessIdentifier;
     std::unique_ptr<RemoteMediaPlayerManagerProxy> m_remoteMediaPlayerManagerProxy;
+    PAL::SessionID m_sessionID;
 #if PLATFORM(COCOA) && ENABLE(MEDIA_STREAM)
     std::unique_ptr<UserMediaCaptureManagerProxy> m_userMediaCaptureManagerProxy;
 #endif

Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.cpp (253899 => 253900)


--- trunk/Source/WebKit/GPUProcess/GPUProcess.cpp	2019-12-24 14:41:20 UTC (rev 253899)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.cpp	2019-12-24 18:10:53 UTC (rev 253900)
@@ -60,7 +60,7 @@
 {
 }
 
-void GPUProcess::createGPUConnectionToWebProcess(ProcessIdentifier identifier, CompletionHandler<void(Optional<IPC::Attachment>&&)>&& completionHandler)
+void GPUProcess::createGPUConnectionToWebProcess(ProcessIdentifier identifier, PAL::SessionID sessionID, CompletionHandler<void(Optional<IPC::Attachment>&&)>&& completionHandler)
 {
     auto ipcConnection = createIPCConnectionPair();
     if (!ipcConnection) {
@@ -68,7 +68,7 @@
         return;
     }
 
-    auto newConnection = GPUConnectionToWebProcess::create(*this, identifier, ipcConnection->first);
+    auto newConnection = GPUConnectionToWebProcess::create(*this, identifier, ipcConnection->first, sessionID);
 
     ASSERT(!m_webProcessConnections.contains(identifier));
     m_webProcessConnections.add(identifier, WTFMove(newConnection));

Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.h (253899 => 253900)


--- trunk/Source/WebKit/GPUProcess/GPUProcess.h	2019-12-24 14:41:20 UTC (rev 253899)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.h	2019-12-24 18:10:53 UTC (rev 253900)
@@ -29,6 +29,7 @@
 
 #include "AuxiliaryProcess.h"
 #include "WebPageProxyIdentifier.h"
+#include <pal/SessionID.h>
 #include <wtf/Function.h>
 #include <wtf/MemoryPressureHandler.h>
 #include <wtf/WeakPtr.h>
@@ -70,7 +71,7 @@
 
     // Message Handlers
     void initializeGPUProcess(GPUProcessCreationParameters&&);
-    void createGPUConnectionToWebProcess(WebCore::ProcessIdentifier, CompletionHandler<void(Optional<IPC::Attachment>&&)>&&);
+    void createGPUConnectionToWebProcess(WebCore::ProcessIdentifier, PAL::SessionID, CompletionHandler<void(Optional<IPC::Attachment>&&)>&&);
 
     void processDidTransitionToForeground();
     void processDidTransitionToBackground();

Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in (253899 => 253900)


--- trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in	2019-12-24 14:41:20 UTC (rev 253899)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in	2019-12-24 18:10:53 UTC (rev 253900)
@@ -27,7 +27,7 @@
     InitializeGPUProcess(struct WebKit::GPUProcessCreationParameters processCreationParameters)
 
     # Creates a connection for communication with a WebProcess
-    CreateGPUConnectionToWebProcess(WebCore::ProcessIdentifier processIdentifier) -> (Optional<IPC::Attachment> connectionIdentifier) Async
+    CreateGPUConnectionToWebProcess(WebCore::ProcessIdentifier processIdentifier, PAL::SessionID sessionID) -> (Optional<IPC::Attachment> connectionIdentifier) Async
 
     ProcessDidTransitionToForeground()
     ProcessDidTransitionToBackground()

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp (253899 => 253900)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp	2019-12-24 14:41:20 UTC (rev 253899)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp	2019-12-24 18:10:53 UTC (rev 253900)
@@ -43,14 +43,6 @@
 namespace WebKit {
 using namespace WebCore;
 
-#if !RELEASE_LOG_DISABLED
-static RefPtr<Logger>& nullLogger()
-{
-    static NeverDestroyed<RefPtr<Logger>> logger;
-    return logger;
-}
-#endif
-
 RemoteMediaPlayerManagerProxy::RemoteMediaPlayerManagerProxy(GPUConnectionToWebProcess& connection)
     : m_gpuConnectionToWebProcess(connection)
 #if !RELEASE_LOG_DISABLED
@@ -253,13 +245,7 @@
 #if !RELEASE_LOG_DISABLED
 const Logger& RemoteMediaPlayerManagerProxy::logger() const
 {
-    // FIXME: use a real logger
-    if (!nullLogger().get()) {
-        nullLogger() = Logger::create(this);
-        nullLogger()->setEnabled(this, false);
-    }
-
-    return *nullLogger().get();
+    return m_gpuConnectionToWebProcess.logger();
 }
 
 WTFLogChannel& RemoteMediaPlayerManagerProxy::logChannel() const

Modified: trunk/Source/WebKit/Platform/Logging.h (253899 => 253900)


--- trunk/Source/WebKit/Platform/Logging.h	2019-12-24 14:41:20 UTC (rev 253899)
+++ trunk/Source/WebKit/Platform/Logging.h	2019-12-24 18:10:53 UTC (rev 253900)
@@ -62,6 +62,7 @@
     M(Layout) \
     M(Loading) \
     M(LocalStorageDatabaseTracker) \
+    M(Media) \
     M(MouseHandling) \
     M(Network) \
     M(NetworkCache) \

Modified: trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp (253899 => 253900)


--- trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp	2019-12-24 14:41:20 UTC (rev 253899)
+++ trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp	2019-12-24 18:10:53 UTC (rev 253900)
@@ -112,7 +112,7 @@
 
 void GPUProcessProxy::openGPUProcessConnection(ConnectionRequestIdentifier connectionRequestIdentifier, WebProcessProxy& webProcessProxy)
 {
-    connection()->sendWithAsyncReply(Messages::GPUProcess::CreateGPUConnectionToWebProcess { webProcessProxy.coreProcessIdentifier() }, [this, weakThis = makeWeakPtr(this), webProcessProxy = makeWeakPtr(webProcessProxy), connectionRequestIdentifier](auto&& connectionIdentifier) mutable {
+    connection()->sendWithAsyncReply(Messages::GPUProcess::CreateGPUConnectionToWebProcess { webProcessProxy.coreProcessIdentifier(), webProcessProxy.sessionID() }, [this, weakThis = makeWeakPtr(this), webProcessProxy = makeWeakPtr(webProcessProxy), connectionRequestIdentifier](auto&& connectionIdentifier) mutable {
         if (!weakThis)
             return;
 

Modified: trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp (253899 => 253900)


--- trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp	2019-12-24 14:41:20 UTC (rev 253899)
+++ trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp	2019-12-24 18:10:53 UTC (rev 253900)
@@ -40,10 +40,17 @@
 #include <wtf/URL.h>
 #include <wtf/text/CString.h>
 
+#if !RELEASE_LOG_DISABLED
+namespace WebCore {
+extern WTFLogChannel LogMedia;
+}
+#endif
+
 namespace WebKit {
 using namespace PAL;
 using namespace WebCore;
 
+#ifdef ALWAYS_LOG_UNIMPLEMENTED_METHODS
 #undef notImplemented
 #define notImplemented() do { \
     static bool havePrinted = false; \
@@ -52,6 +59,7 @@
         havePrinted = true; \
     } \
 } while (0)
+#endif
 
 MediaPlayerPrivateRemote::MediaPlayerPrivateRemote(MediaPlayer* player, MediaPlayerEnums::MediaEngineIdentifier engineIdentifier, MediaPlayerPrivateRemoteIdentifier playerIdentifier, RemoteMediaPlayerManager& manager, const RemoteMediaPlayerConfiguration& configuration)
     : m_player(player)
@@ -794,7 +802,7 @@
 #if !RELEASE_LOG_DISABLED
 WTFLogChannel& MediaPlayerPrivateRemote::logChannel() const
 {
-    return WebKit2LogWebRTC;
+    return LogMedia;
 }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to