WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
WIP patch
wip-remote-inspector-refactor.diff (text/plain), 27.16 KB, created by
Carlos Garcia Campos
on 2017-01-04 05:25:32 PST
(
hide
)
Description:
WIP patch
Filename:
MIME Type:
Creator:
Carlos Garcia Campos
Created:
2017-01-04 05:25:32 PST
Size:
27.16 KB
patch
obsolete
>diff --git a/Source/JavaScriptCore/API/JSRemoteInspector.cpp b/Source/JavaScriptCore/API/JSRemoteInspector.cpp >index faebc5de3e1..3be61d09272 100644 >--- a/Source/JavaScriptCore/API/JSRemoteInspector.cpp >+++ b/Source/JavaScriptCore/API/JSRemoteInspector.cpp >@@ -50,9 +50,9 @@ void JSRemoteInspectorStart(void) > #endif > } > >-void JSRemoteInspectorSetParentProcessInformation(pid_t pid, const UInt8* auditData, size_t auditLength) >+void JSRemoteInspectorSetParentProcessInformation(pid_t pid, const uint8_t* auditData, size_t auditLength) > { >-#if ENABLE(REMOTE_INSPECTOR) >+#if ENABLE(REMOTE_INSPECTOR) && PLATFORM(COCOA) > RetainPtr<CFDataRef> auditDataRef = adoptCF(CFDataCreate(kCFAllocatorDefault, auditData, auditLength)); > RemoteInspector::singleton().setParentProcessInformation(pid, auditDataRef); > #else >diff --git a/Source/JavaScriptCore/PlatformMac.cmake b/Source/JavaScriptCore/PlatformMac.cmake >index 2e6b15b9c6e..d7405a86d29 100644 >--- a/Source/JavaScriptCore/PlatformMac.cmake >+++ b/Source/JavaScriptCore/PlatformMac.cmake >@@ -10,11 +10,14 @@ list(APPEND JavaScriptCore_SOURCES > API/ObjCCallbackFunction.mm > > inspector/remote/RemoteAutomationTarget.cpp >- inspector/remote/RemoteConnectionToTarget.mm > inspector/remote/RemoteControllableTarget.cpp > inspector/remote/RemoteInspectionTarget.cpp >- inspector/remote/RemoteInspector.mm >+ inspector/remote/RemoteInspector.cpp > inspector/remote/RemoteInspectorXPCConnection.mm >+ >+ inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm >+ inspector/remote/cocoa/RemoteInspectorCocoa.mm >+ inspector/remote/cocoa/RemoteInspectorXPCConnection.mm > ) > add_definitions(-DSTATICALLY_LINKED_WITH_WTF -D__STDC_WANT_LIB_EXT1__) > >@@ -26,6 +29,7 @@ list(APPEND JavaScriptCore_LIBRARIES > list(APPEND JavaScriptCore_INCLUDE_DIRECTORIES > ${JAVASCRIPTCORE_DIR}/disassembler/udis86 > ${JAVASCRIPTCORE_DIR}/icu >+ ${JAVASCRIPTCORE_DIR}/inspector/remote/cocoa > ) > > set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-compatibility_version 1 -current_version ${WEBKIT_MAC_VERSION}") >diff --git a/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h b/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h >index dba0601799a..89aa7bc5e77 100644 >--- a/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h >+++ b/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h >@@ -27,67 +27,82 @@ > > #if ENABLE(REMOTE_INSPECTOR) > >-#import "InspectorFrontendChannel.h" >-#import "RemoteConnectionToTarget.h" >-#import "RemoteInspector.h" >-#import <mutex> >-#import <wtf/BlockPtr.h> >-#import <wtf/Lock.h> >-#import <wtf/RetainPtr.h> >-#import <wtf/ThreadSafeRefCounted.h> >+#include "InspectorFrontendChannel.h" >+#include <wtf/Lock.h> >+#include <wtf/ThreadSafeRefCounted.h> >+ >+#if PLATFORM(COCOA) >+#include <wtf/BlockPtr.h> >+#include <wtf/RetainPtr.h> > > OBJC_CLASS NSString; >+#endif > > namespace Inspector { > >+class RemoteControllableTarget; >+ >+#if PLATFORM(COCOA) > typedef Vector<BlockPtr<void ()>> RemoteTargetQueue; >+#endif > > class RemoteConnectionToTarget final : public ThreadSafeRefCounted<RemoteConnectionToTarget>, public FrontendChannel { > public: >- RemoteConnectionToTarget(RemoteControllableTarget*, NSString *connectionIdentifier, NSString *destination); >+#if PLATFORM(COCOA) >+ RemoteConnectionToTarget(RemoteControllableTarget*, NSString* connectionIdentifier, NSString* destination); >+#endif > virtual ~RemoteConnectionToTarget(); > > // Main API. > bool setup(bool isAutomaticInspection = false, bool automaticallyPause = false); >- void sendMessageToTarget(NSString *); >+ void sendMessageToTarget(const String&); > void close(); > void targetClosed(); > > std::optional<unsigned> targetIdentifier() const; >+#if PLATFORM(COCOA) > NSString *connectionIdentifier() const; > NSString *destination() const; > > Lock& queueMutex() { return m_queueMutex; } > const RemoteTargetQueue& queue() const { return m_queue; } > void clearQueue() { m_queue.clear(); } >+#endif > > // FrontendChannel overrides. > ConnectionType connectionType() const override { return ConnectionType::Remote; } > void sendMessageToFrontend(const String&) override; > > private: >+#if PLATFORM(COCOA) > void dispatchAsyncOnTarget(void (^block)()); > > void setupRunLoop(); > void teardownRunLoop(); > void queueTaskOnPrivateRunLoop(void (^block)()); >+#endif > > // This connection from the RemoteInspector singleton to the InspectionTarget > // can be used on multiple threads. So any access to the target > // itself must take this mutex to ensure m_target is valid. > Lock m_targetMutex; > >+#if PLATFORM(COCOA) > // If a target has a specific run loop it wants to evaluate on > // we setup our run loop sources on that specific run loop. > RetainPtr<CFRunLoopRef> m_runLoop; > RetainPtr<CFRunLoopSourceRef> m_runLoopSource; > RemoteTargetQueue m_queue; > Lock m_queueMutex; >+#endif > > RemoteControllableTarget* m_target { nullptr }; >+ bool m_connected { false }; >+ >+#if PLATFORM(COCOA) > RetainPtr<NSString> m_connectionIdentifier; > RetainPtr<NSString> m_destination; >- bool m_connected { false }; >+#endif > }; > > } // namespace Inspector >diff --git a/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h b/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h >index d65faead95d..afae369ae1f 100644 >--- a/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h >+++ b/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h >@@ -27,10 +27,13 @@ > > #if ENABLE(REMOTE_INSPECTOR) > >-#include <CoreFoundation/CFRunLoop.h> > #include <wtf/TypeCasts.h> > #include <wtf/text/WTFString.h> > >+#if USE(CF) >+#include <CoreFoundation/CFRunLoop.h> >+#endif >+ > namespace Inspector { > > class FrontendChannel; >@@ -53,8 +56,10 @@ public: > virtual bool remoteControlAllowed() const = 0; > virtual void dispatchMessageFromRemote(const String& message) = 0; > >+#if USE(CF) > // The dispatch block will be scheduled on a global run loop if null is returned. > virtual CFRunLoopRef targetRunLoop() { return nullptr; } >+#endif > private: > unsigned m_identifier {0}; > }; >diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h b/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h >index 3852fccd831..45329f6d62f 100644 >--- a/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h >+++ b/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h >@@ -41,8 +41,10 @@ public: > bool remoteDebuggingAllowed() const { return m_allowed; } > void setRemoteDebuggingAllowed(bool); > >+#if USE(CF) > CFRunLoopRef targetRunLoop() override { return m_runLoop.get(); } > void setTargetRunLoop(CFRunLoopRef runLoop) { m_runLoop = runLoop; } >+#endif > > virtual String name() const { return String(); } // JavaScript and Web > virtual String url() const { return String(); } // Web >@@ -59,7 +61,9 @@ public: > bool remoteControlAllowed() const override; > private: > bool m_allowed {false}; >+#if USE(CF) > RetainPtr<CFRunLoopRef> m_runLoop; >+#endif > }; > > } // namespace Inspector >diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspector.cpp b/Source/JavaScriptCore/inspector/remote/RemoteInspector.cpp >new file mode 100644 >index 00000000000..1577bebb7d0 >--- /dev/null >+++ b/Source/JavaScriptCore/inspector/remote/RemoteInspector.cpp >@@ -0,0 +1,224 @@ >+/* >+ * Copyright (C) 2013-2016 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. ``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 >+ * 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 "RemoteInspector.h" >+ >+#if ENABLE(REMOTE_INSPECTOR) >+ >+#include "RemoteAutomationTarget.h" >+#include "RemoteConnectionToTarget.h" >+#include "RemoteInspectionTarget.h" >+#include "RemoteInspectorConstants.h" >+#include <wtf/MainThread.h> >+#include <wtf/text/WTFString.h> >+ >+namespace Inspector { >+ >+bool RemoteInspector::startEnabled = true; >+ >+void RemoteInspector::startDisabled() >+{ >+ RemoteInspector::startEnabled = false; >+} >+ >+unsigned RemoteInspector::nextAvailableTargetIdentifier() >+{ >+ unsigned nextValidTargetIdentifier; >+ do { >+ nextValidTargetIdentifier = m_nextAvailableTargetIdentifier++; >+ } while (!nextValidTargetIdentifier || nextValidTargetIdentifier == std::numeric_limits<unsigned>::max() || m_targetMap.contains(nextValidTargetIdentifier)); >+ return nextValidTargetIdentifier; >+} >+ >+void RemoteInspector::registerTarget(RemoteControllableTarget* target) >+{ >+ ASSERT_ARG(target, target); >+ >+ std::lock_guard<Lock> lock(m_mutex); >+ >+ unsigned targetIdentifier = nextAvailableTargetIdentifier(); >+ target->setTargetIdentifier(targetIdentifier); >+ >+ { >+ auto result = m_targetMap.set(targetIdentifier, target); >+ ASSERT_UNUSED(result, result.isNewEntry); >+ } >+ >+ // If remote control is not allowed, a null listing is returned. >+ if (auto targetListing = listingForTarget(*target)) { >+ auto result = m_targetListingMap.set(targetIdentifier, targetListing); >+ ASSERT_UNUSED(result, result.isNewEntry); >+ } >+ >+ pushListingsSoon(); >+} >+ >+void RemoteInspector::unregisterTarget(RemoteControllableTarget* target) >+{ >+ ASSERT_ARG(target, target); >+ >+ std::lock_guard<Lock> lock(m_mutex); >+ >+ unsigned targetIdentifier = target->targetIdentifier(); >+ if (!targetIdentifier) >+ return; >+ >+ bool wasRemoved = m_targetMap.remove(targetIdentifier); >+ ASSERT_UNUSED(wasRemoved, wasRemoved); >+ >+ // The listing may never have been added if remote control isn't allowed. >+ m_targetListingMap.remove(targetIdentifier); >+ >+ if (auto connectionToTarget = m_targetConnectionMap.take(targetIdentifier)) >+ connectionToTarget->targetClosed(); >+ >+ pushListingsSoon(); >+} >+ >+void RemoteInspector::updateTarget(RemoteControllableTarget* target) >+{ >+ ASSERT_ARG(target, target); >+ >+ std::lock_guard<Lock> lock(m_mutex); >+ >+ unsigned targetIdentifier = target->targetIdentifier(); >+ if (!targetIdentifier) >+ return; >+ >+ { >+ auto result = m_targetMap.set(targetIdentifier, target); >+ ASSERT_UNUSED(result, !result.isNewEntry); >+ } >+ >+ // If the target has just allowed remote control, then the listing won't exist yet. >+ // If the target has no identifier remove the old listing. >+ if (auto targetListing = listingForTarget(*target)) >+ m_targetListingMap.set(targetIdentifier, targetListing); >+ else >+ m_targetListingMap.remove(targetIdentifier); >+ >+ pushListingsSoon(); >+} >+ >+void RemoteInspector::updateClientCapabilities() >+{ >+ ASSERT(isMainThread()); >+ >+ std::lock_guard<Lock> lock(m_mutex); >+ >+ if (!m_client) >+ m_clientCapabilities = std::nullopt; >+ else { >+ RemoteInspector::Client::Capabilities updatedCapabilities = { >+ m_client->remoteAutomationAllowed() // remoteAutomationAllowed >+ }; >+ >+ m_clientCapabilities = updatedCapabilities; >+ } >+} >+ >+void RemoteInspector::setRemoteInspectorClient(RemoteInspector::Client* client) >+{ >+ ASSERT_ARG(client, client); >+ ASSERT(!m_client); >+ >+ { >+ std::lock_guard<Lock> lock(m_mutex); >+ m_client = client; >+ } >+ >+ // Send an updated listing that includes whether the client allows remote automation. >+ updateClientCapabilities(); >+ pushListingsSoon(); >+} >+ >+void RemoteInspector::setupFailed(unsigned targetIdentifier) >+{ >+ std::lock_guard<Lock> lock(m_mutex); >+ >+ m_targetConnectionMap.remove(targetIdentifier); >+ >+ updateHasActiveDebugSession(); >+ >+ if (targetIdentifier == m_automaticInspectionCandidateTargetIdentifier) >+ m_automaticInspectionPaused = false; >+ >+ pushListingsSoon(); >+} >+ >+void RemoteInspector::setupCompleted(unsigned targetIdentifier) >+{ >+ std::lock_guard<Lock> lock(m_mutex); >+ >+ if (targetIdentifier == m_automaticInspectionCandidateTargetIdentifier) >+ m_automaticInspectionPaused = false; >+} >+ >+bool RemoteInspector::waitingForAutomaticInspection(unsigned) >+{ >+ // We don't take the lock to check this because we assume it will be checked repeatedly. >+ return m_automaticInspectionPaused; >+} >+ >+void RemoteInspector::clientCapabilitiesDidChange() >+{ >+ updateClientCapabilities(); >+ pushListingsSoon(); >+} >+ >+void RemoteInspector::stop() >+{ >+ std::lock_guard<Lock> lock(m_mutex); >+ >+ stopInternal(StopSource::API); >+} >+ >+TargetListing RemoteInspector::listingForTarget(const RemoteControllableTarget& target) const >+{ >+ if (is<RemoteInspectionTarget>(target)) >+ return listingForInspectionTarget(downcast<RemoteInspectionTarget>(target)); >+ if (is<RemoteAutomationTarget>(target)) >+ return listingForAutomationTarget(downcast<RemoteAutomationTarget>(target)); >+ >+ ASSERT_NOT_REACHED(); >+ return nullptr; >+} >+ >+void RemoteInspector::updateHasActiveDebugSession() >+{ >+ bool hasActiveDebuggerSession = !m_targetConnectionMap.isEmpty(); >+ if (hasActiveDebuggerSession == m_hasActiveDebugSession) >+ return; >+ >+ m_hasActiveDebugSession = hasActiveDebuggerSession; >+ >+ // FIXME: Expose some way to access this state in an embedder. >+ // Legacy iOS WebKit 1 had a notification. This will need to be smarter with WebKit2. >+} >+ >+} // namespace Inspector >+ >+#endif // ENABLE(REMOTE_INSPECTOR) >diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspector.h b/Source/JavaScriptCore/inspector/remote/RemoteInspector.h >index 93fd1a7d7c0..21a7e13f115 100644 >--- a/Source/JavaScriptCore/inspector/remote/RemoteInspector.h >+++ b/Source/JavaScriptCore/inspector/remote/RemoteInspector.h >@@ -27,14 +27,18 @@ > > #if ENABLE(REMOTE_INSPECTOR) > >-#import "RemoteInspectorXPCConnection.h" >-#import <wtf/Forward.h> >-#import <wtf/HashMap.h> >-#import <wtf/Lock.h> >-#import <wtf/RetainPtr.h> >+#include <wtf/Forward.h> >+#include <wtf/HashMap.h> >+#include <wtf/Lock.h> >+ >+#if PLATFORM(COCOA) >+#include "RemoteInspectorXPCConnection.h" >+#include <wtf/RetainPtr.h> > > OBJC_CLASS NSDictionary; > OBJC_CLASS NSString; >+typedef RetainPtr<NSDictionary> TargetListing; >+#endif > > namespace Inspector { > >@@ -44,7 +48,11 @@ class RemoteControllableTarget; > class RemoteInspectionTarget; > class RemoteInspectorClient; > >-class JS_EXPORT_PRIVATE RemoteInspector final : public RemoteInspectorXPCConnection::Client { >+class JS_EXPORT_PRIVATE RemoteInspector final >+#if PLATFORM(COCOA) >+ : public RemoteInspectorXPCConnection::Client >+#endif >+{ > public: > class Client { > public: >@@ -80,11 +88,13 @@ public: > void start(); > void stop(); > >+#if PLATFORM(COCOA) > bool hasParentProcessInformation() const { return m_parentProcessIdentifier != 0; } > pid_t parentProcessIdentifier() const { return m_parentProcessIdentifier; } > RetainPtr<CFDataRef> parentProcessAuditData() const { return m_parentProcessAuditData; } > void setParentProcessInformation(pid_t, RetainPtr<CFDataRef> auditData); > void setParentProcessInfomationIsDelayed(); >+#endif > > private: > RemoteInspector(); >@@ -94,11 +104,14 @@ private: > enum class StopSource { API, XPCMessage }; > void stopInternal(StopSource); > >+#if PLATFORM(COCOA) > void setupXPCConnectionIfNeeded(); >+#endif >+ >+ TargetListing listingForTarget(const RemoteControllableTarget&) const; >+ TargetListing listingForInspectionTarget(const RemoteInspectionTarget&) const; >+ TargetListing listingForAutomationTarget(const RemoteAutomationTarget&) const; > >- RetainPtr<NSDictionary> listingForTarget(const RemoteControllableTarget&) const; >- RetainPtr<NSDictionary> listingForInspectionTarget(const RemoteInspectionTarget&) const; >- RetainPtr<NSDictionary> listingForAutomationTarget(const RemoteAutomationTarget&) const; > void pushListingsNow(); > void pushListingsSoon(); > >@@ -107,6 +120,7 @@ private: > > void sendAutomaticInspectionCandidateMessage(); > >+#if PLATFORM(COCOA) > void xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*, NSString *messageName, NSDictionary *userInfo) override; > void xpcConnectionFailed(RemoteInspectorXPCConnection*) override; > void xpcConnectionUnhandledMessage(RemoteInspectorXPCConnection*, xpc_object_t) override; >@@ -121,6 +135,7 @@ private: > void receivedAutomaticInspectionConfigurationMessage(NSDictionary *userInfo); > void receivedAutomaticInspectionRejectMessage(NSDictionary *userInfo); > void receivedAutomationSessionRequestMessage(NSDictionary *userInfo); >+#endif > > static bool startEnabled; > >@@ -131,15 +146,19 @@ private: > Lock m_mutex; > > HashMap<unsigned, RemoteControllableTarget*> m_targetMap; >- HashMap<unsigned, RetainPtr<NSDictionary>> m_targetListingMap; > HashMap<unsigned, RefPtr<RemoteConnectionToTarget>> m_targetConnectionMap; >+ HashMap<unsigned, TargetListing> m_targetListingMap; > >+#if PLATFORM(COCOA) > RefPtr<RemoteInspectorXPCConnection> m_relayConnection; >+#endif > > RemoteInspector::Client* m_client { nullptr }; > std::optional<RemoteInspector::Client::Capabilities> m_clientCapabilities; > >+#if PLATFORM(COCOA) > dispatch_queue_t m_xpcQueue; >+#endif > unsigned m_nextAvailableTargetIdentifier { 1 }; > int m_notifyToken { 0 }; > bool m_enabled { false }; >@@ -147,7 +166,9 @@ private: > bool m_pushScheduled { false }; > > pid_t m_parentProcessIdentifier { 0 }; >+#if PLATFORM(COCOA) > RetainPtr<CFDataRef> m_parentProcessAuditData; >+#endif > bool m_shouldSendParentProcessInformation { false }; > bool m_automaticInspectionEnabled { false }; > bool m_automaticInspectionPaused { false }; >diff --git a/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.mm b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm >similarity index 99% >rename from Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.mm >rename to Source/JavaScriptCore/inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm >index d60da48afa8..eba469dab10 100644 >--- a/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.mm >+++ b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm >@@ -31,6 +31,7 @@ > #import "EventLoop.h" > #import "RemoteAutomationTarget.h" > #import "RemoteInspectionTarget.h" >+#import "RemoteInspector.h" > #import <dispatch/dispatch.h> > #import <wtf/Optional.h> > >diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm >similarity index 83% >rename from Source/JavaScriptCore/inspector/remote/RemoteInspector.mm >rename to Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm >index 21cb232d8c4..bef5bbae59f 100644 >--- a/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm >+++ b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm >@@ -61,13 +61,6 @@ static bool globalAutomaticInspectionState() > return automaticInspectionEnabled == 1; > } > >-bool RemoteInspector::startEnabled = true; >- >-void RemoteInspector::startDisabled() >-{ >- RemoteInspector::startEnabled = false; >-} >- > RemoteInspector& RemoteInspector::singleton() > { > static NeverDestroyed<RemoteInspector> shared; >@@ -101,85 +94,6 @@ RemoteInspector::RemoteInspector() > { > } > >-unsigned RemoteInspector::nextAvailableTargetIdentifier() >-{ >- unsigned nextValidTargetIdentifier; >- do { >- nextValidTargetIdentifier = m_nextAvailableTargetIdentifier++; >- } while (!nextValidTargetIdentifier || nextValidTargetIdentifier == std::numeric_limits<unsigned>::max() || m_targetMap.contains(nextValidTargetIdentifier)); >- return nextValidTargetIdentifier; >-} >- >-void RemoteInspector::registerTarget(RemoteControllableTarget* target) >-{ >- ASSERT_ARG(target, target); >- >- std::lock_guard<Lock> lock(m_mutex); >- >- unsigned targetIdentifier = nextAvailableTargetIdentifier(); >- target->setTargetIdentifier(targetIdentifier); >- >- { >- auto result = m_targetMap.set(targetIdentifier, target); >- ASSERT_UNUSED(result, result.isNewEntry); >- } >- >- // If remote control is not allowed, a null listing is returned. >- if (RetainPtr<NSDictionary> targetListing = listingForTarget(*target)) { >- auto result = m_targetListingMap.set(targetIdentifier, targetListing); >- ASSERT_UNUSED(result, result.isNewEntry); >- } >- >- pushListingsSoon(); >-} >- >-void RemoteInspector::unregisterTarget(RemoteControllableTarget* target) >-{ >- ASSERT_ARG(target, target); >- >- std::lock_guard<Lock> lock(m_mutex); >- >- unsigned targetIdentifier = target->targetIdentifier(); >- if (!targetIdentifier) >- return; >- >- bool wasRemoved = m_targetMap.remove(targetIdentifier); >- ASSERT_UNUSED(wasRemoved, wasRemoved); >- >- // The listing may never have been added if remote control isn't allowed. >- m_targetListingMap.remove(targetIdentifier); >- >- if (auto connectionToTarget = m_targetConnectionMap.take(targetIdentifier)) >- connectionToTarget->targetClosed(); >- >- pushListingsSoon(); >-} >- >-void RemoteInspector::updateTarget(RemoteControllableTarget* target) >-{ >- ASSERT_ARG(target, target); >- >- std::lock_guard<Lock> lock(m_mutex); >- >- unsigned targetIdentifier = target->targetIdentifier(); >- if (!targetIdentifier) >- return; >- >- { >- auto result = m_targetMap.set(targetIdentifier, target); >- ASSERT_UNUSED(result, !result.isNewEntry); >- } >- >- // If the target has just allowed remote control, then the listing won't exist yet. >- // If the target has no identifier remove the old listing. >- if (RetainPtr<NSDictionary> targetListing = listingForTarget(*target)) >- m_targetListingMap.set(targetIdentifier, targetListing); >- else >- m_targetListingMap.remove(targetIdentifier); >- >- pushListingsSoon(); >-} >- > void RemoteInspector::updateAutomaticInspectionCandidate(RemoteInspectionTarget* target) > { > ASSERT_ARG(target, target); >@@ -249,38 +163,6 @@ void RemoteInspector::updateAutomaticInspectionCandidate(RemoteInspectionTarget* > } > } > >-void RemoteInspector::updateClientCapabilities() >-{ >- ASSERT(isMainThread()); >- >- std::lock_guard<Lock> lock(m_mutex); >- >- if (!m_client) >- m_clientCapabilities = std::nullopt; >- else { >- RemoteInspector::Client::Capabilities updatedCapabilities = { >- m_client->remoteAutomationAllowed() // remoteAutomationAllowed >- }; >- >- m_clientCapabilities = updatedCapabilities; >- } >-} >- >-void RemoteInspector::setRemoteInspectorClient(RemoteInspector::Client* client) >-{ >- ASSERT_ARG(client, client); >- ASSERT(!m_client); >- >- { >- std::lock_guard<Lock> lock(m_mutex); >- m_client = client; >- } >- >- // Send an updated listing that includes whether the client allows remote automation. >- updateClientCapabilities(); >- pushListingsSoon(); >-} >- > void RemoteInspector::sendAutomaticInspectionCandidateMessage() > { > ASSERT(m_enabled); >@@ -313,40 +195,6 @@ void RemoteInspector::sendMessageToRemote(unsigned targetIdentifier, const Strin > m_relayConnection->sendMessage(WIRRawDataMessage, userInfo); > } > >-void RemoteInspector::setupFailed(unsigned targetIdentifier) >-{ >- std::lock_guard<Lock> lock(m_mutex); >- >- m_targetConnectionMap.remove(targetIdentifier); >- >- updateHasActiveDebugSession(); >- >- if (targetIdentifier == m_automaticInspectionCandidateTargetIdentifier) >- m_automaticInspectionPaused = false; >- >- pushListingsSoon(); >-} >- >-void RemoteInspector::setupCompleted(unsigned targetIdentifier) >-{ >- std::lock_guard<Lock> lock(m_mutex); >- >- if (targetIdentifier == m_automaticInspectionCandidateTargetIdentifier) >- m_automaticInspectionPaused = false; >-} >- >-bool RemoteInspector::waitingForAutomaticInspection(unsigned) >-{ >- // We don't take the lock to check this because we assume it will be checked repeatedly. >- return m_automaticInspectionPaused; >-} >- >-void RemoteInspector::clientCapabilitiesDidChange() >-{ >- updateClientCapabilities(); >- pushListingsSoon(); >-} >- > void RemoteInspector::start() > { > std::lock_guard<Lock> lock(m_mutex); >@@ -369,13 +217,6 @@ void RemoteInspector::start() > notify_post(WIRServiceAvailabilityCheckNotification); > } > >-void RemoteInspector::stop() >-{ >- std::lock_guard<Lock> lock(m_mutex); >- >- stopInternal(StopSource::API); >-} >- > void RemoteInspector::stopInternal(StopSource source) > { > if (!m_enabled) >@@ -615,21 +456,6 @@ void RemoteInspector::pushListingsSoon() > }); > } > >-#pragma mark - Active Debugger Sessions >- >-void RemoteInspector::updateHasActiveDebugSession() >-{ >- bool hasActiveDebuggerSession = !m_targetConnectionMap.isEmpty(); >- if (hasActiveDebuggerSession == m_hasActiveDebugSession) >- return; >- >- m_hasActiveDebugSession = hasActiveDebuggerSession; >- >- // FIXME: Expose some way to access this state in an embedder. >- // Legacy iOS WebKit 1 had a notification. This will need to be smarter with WebKit2. >-} >- >- > #pragma mark - Received XPC Messages > > void RemoteInspector::receivedSetupMessage(NSDictionary *userInfo) >diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.h >similarity index 100% >rename from Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h >rename to Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.h >diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.mm b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.mm >similarity index 100% >rename from Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.mm >rename to Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.mm >diff --git a/Source/WebKit2/WebProcess/WebProcess.cpp b/Source/WebKit2/WebProcess/WebProcess.cpp >index c1280183035..4da34752a21 100644 >--- a/Source/WebKit2/WebProcess/WebProcess.cpp >+++ b/Source/WebKit2/WebProcess/WebProcess.cpp >@@ -377,7 +377,7 @@ void WebProcess::initializeWebProcess(WebProcessCreationParameters&& parameters) > setEnabledServices(parameters.hasImageServices, parameters.hasSelectionServices, parameters.hasRichContentServices); > #endif > >-#if ENABLE(REMOTE_INSPECTOR) >+#if ENABLE(REMOTE_INSPECTOR) && PLATFORM(COCOA) > audit_token_t auditToken; > if (parentProcessConnection()->getAuditToken(auditToken)) { > RetainPtr<CFDataRef> auditData = adoptCF(CFDataCreate(nullptr, (const UInt8*)&auditToken, sizeof(auditToken)));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 166681
:
298005
|
298008
|
298462
|
298469
|
298470
|
298472
|
298474
|
298557
|
301717