browser(webkit): fix assertion unsafe to ref/deref from different threads (#6163)

This commit is contained in:
Yury Semikhatsky 2021-04-09 11:36:01 -07:00 committed by GitHub
parent e26d98d6de
commit 5fe3ee13f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 11 deletions

View File

@ -1,2 +1,2 @@
1461 1462
Changed: yurys@chromium.org Thu, Apr 8, 2021 2:02:23 AM Changed: yurys@chromium.org Fri 09 Apr 2021 11:32:50 AM PDT

View File

@ -10774,10 +10774,10 @@ index fe3c63e61f778762dc2c2080c74ec53fdf8c2e5f..c43a8226c9be702e248f1712e465efa3
ID3D11DeviceContext1* immediateContext { nullptr }; ID3D11DeviceContext1* immediateContext { nullptr };
diff --git a/Source/WebKit/UIProcess/BrowserInspectorPipe.cpp b/Source/WebKit/UIProcess/BrowserInspectorPipe.cpp diff --git a/Source/WebKit/UIProcess/BrowserInspectorPipe.cpp b/Source/WebKit/UIProcess/BrowserInspectorPipe.cpp
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..dc8af6fe1c57bcd62d605fd1daa3da13361858bb index 0000000000000000000000000000000000000000..cfb57a48ce387b79613b757e2eb4de2c378aac30
--- /dev/null --- /dev/null
+++ b/Source/WebKit/UIProcess/BrowserInspectorPipe.cpp +++ b/Source/WebKit/UIProcess/BrowserInspectorPipe.cpp
@@ -0,0 +1,57 @@ @@ -0,0 +1,61 @@
+/* +/*
+ * Copyright (C) 2019 Microsoft Corporation. + * Copyright (C) 2019 Microsoft Corporation.
+ * + *
@ -10809,14 +10809,18 @@ index 0000000000000000000000000000000000000000..dc8af6fe1c57bcd62d605fd1daa3da13
+#if ENABLE(REMOTE_INSPECTOR) +#if ENABLE(REMOTE_INSPECTOR)
+ +
+#include "InspectorPlaywrightAgent.h" +#include "InspectorPlaywrightAgent.h"
+#include "RemoteInspectorPipe.h"
+#include <wtf/NeverDestroyed.h>
+#include "InspectorPlaywrightAgentClient.h" +#include "InspectorPlaywrightAgentClient.h"
+#include "RemoteInspectorPipe.h"
+#include "WebKit2Initialize.h"
+#include <wtf/NeverDestroyed.h>
+ +
+namespace WebKit { +namespace WebKit {
+ +
+void initializeBrowserInspectorPipe(std::unique_ptr<InspectorPlaywrightAgentClient> client) +void initializeBrowserInspectorPipe(std::unique_ptr<InspectorPlaywrightAgentClient> client)
+{ +{
+ // Initialize main loop before creating inspecor agent and pipe queues.
+ WebKit::InitializeWebKit2();
+
+ class BrowserInspectorPipe { + class BrowserInspectorPipe {
+ public: + public:
+ BrowserInspectorPipe(std::unique_ptr<InspectorPlaywrightAgentClient> client) + BrowserInspectorPipe(std::unique_ptr<InspectorPlaywrightAgentClient> client)
@ -14193,10 +14197,10 @@ index dc95430a8ab5f1ec789b5400af005553c7023f9a..70171e5523d35e235df6ca04c0d7d406
virtual void didNotHandleTapAsClick(const WebCore::IntPoint&) = 0; virtual void didNotHandleTapAsClick(const WebCore::IntPoint&) = 0;
diff --git a/Source/WebKit/UIProcess/RemoteInspectorPipe.cpp b/Source/WebKit/UIProcess/RemoteInspectorPipe.cpp diff --git a/Source/WebKit/UIProcess/RemoteInspectorPipe.cpp b/Source/WebKit/UIProcess/RemoteInspectorPipe.cpp
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..1d1eb4591ab865688bec7505334a208e00918701 index 0000000000000000000000000000000000000000..dd8b28e692dca4078eb710b2a97e61716126a4cb
--- /dev/null --- /dev/null
+++ b/Source/WebKit/UIProcess/RemoteInspectorPipe.cpp +++ b/Source/WebKit/UIProcess/RemoteInspectorPipe.cpp
@@ -0,0 +1,226 @@ @@ -0,0 +1,224 @@
+/* +/*
+ * Copyright (C) 2019 Microsoft Corporation. + * Copyright (C) 2019 Microsoft Corporation.
+ * + *
@ -14338,8 +14342,6 @@ index 0000000000000000000000000000000000000000..1d1eb4591ab865688bec7505334a208e
+RemoteInspectorPipe::RemoteInspectorPipe(InspectorPlaywrightAgent& playwrightAgent) +RemoteInspectorPipe::RemoteInspectorPipe(InspectorPlaywrightAgent& playwrightAgent)
+ : m_playwrightAgent(playwrightAgent) + : m_playwrightAgent(playwrightAgent)
+{ +{
+ // Initialize main loop before creating WorkQueue
+ WTF::initializeMainThread();
+ m_remoteFrontendChannel = makeUnique<RemoteFrontendChannel>(); + m_remoteFrontendChannel = makeUnique<RemoteFrontendChannel>();
+ start(); + start();
+} +}
@ -14406,7 +14408,7 @@ index 0000000000000000000000000000000000000000..1d1eb4591ab865688bec7505334a208e
+ +
+ if (end > start) { + if (end > start) {
+ String message = String::fromUTF8(line.data() + start, end - start); + String message = String::fromUTF8(line.data() + start, end - start);
+ RunLoop::main().dispatch([this, message] { + RunLoop::main().dispatch([this, message = WTFMove(message)] {
+ if (!m_terminated) + if (!m_terminated)
+ m_playwrightAgent.dispatchMessageFromFrontend(message); + m_playwrightAgent.dispatchMessageFromFrontend(message);
+ }); + });