[iOS] Clean up REMOTE_INSPECTOR code in OpenSource after the iOS merge
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Jan 2014 05:05:55 +0000 (05:05 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Jan 2014 05:05:55 +0000 (05:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127069

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-01-15
Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* JavaScriptCore.xcodeproj/project.pbxproj:
Export XPCConnection because it is needed by RemoteInspector.h.

* inspector/remote/RemoteInspectorXPCConnection.h:
* inspector/remote/RemoteInspector.h:
* inspector/remote/RemoteInspector.mm:
(Inspector::RemoteInspector::startDisabled):
(Inspector::RemoteInspector::shared):
Allow RemoteInspector singleton to start disabled.

Source/WebCore:

* WebCore.exp.in:

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
(+[WebView _enableRemoteInspector]):
(+[WebView _disableRemoteInspector]):
(+[WebView _disableAutoStartRemoteInspector]):
(+[WebView _isRemoteInspectorEnabled]):
(+[WebView _hasRemoteInspectorSession]):
(-[WebView allowsRemoteInspection]):
Implement with RemoteInspector.h SPIs.

(-[WebView setAllowsRemoteInspection:]):
(-[WebView setHostApplicationBundleId:name:]):
Still unimplemented, update comment.

(-[WebView _didCommitLoadForFrame:]):
Remove dead path, WebCore now pushes updates on navigations.

* WebView/WebViewData.h:
* WebView/WebViewData.mm:
(-[WebViewPrivate init]):
Remove now unused ivar.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162112 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/inspector/remote/RemoteInspector.h
Source/JavaScriptCore/inspector/remote/RemoteInspector.mm
Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/mac/WebView/WebViewData.h
Source/WebKit/mac/WebView/WebViewData.mm

index d9a8e19..2b205e3 100644 (file)
@@ -1,3 +1,20 @@
+2014-01-15  Joseph Pecoraro  <pecoraro@apple.com>
+
+        [iOS] Clean up REMOTE_INSPECTOR code in OpenSource after the iOS merge
+        https://bugs.webkit.org/show_bug.cgi?id=127069
+
+        Reviewed by Timothy Hatcher.
+
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        Export XPCConnection because it is needed by RemoteInspector.h.
+
+        * inspector/remote/RemoteInspectorXPCConnection.h:
+        * inspector/remote/RemoteInspector.h:
+        * inspector/remote/RemoteInspector.mm:
+        (Inspector::RemoteInspector::startDisabled):
+        (Inspector::RemoteInspector::shared):
+        Allow RemoteInspector singleton to start disabled.
+
 2014-01-15  Brian Burg  <bburg@apple.com>
 
         Web Inspector: capture probe samples on the backend
index 18b66ea..e8b857e 100644 (file)
                A5BA15EA182340B400A82E69 /* RemoteInspectorConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E3182340B300A82E69 /* RemoteInspectorConstants.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A5BA15EB182340B400A82E69 /* RemoteInspectorDebuggableConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E4182340B300A82E69 /* RemoteInspectorDebuggableConnection.h */; };
                A5BA15EC182340B400A82E69 /* RemoteInspectorDebuggableConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E5182340B300A82E69 /* RemoteInspectorDebuggableConnection.mm */; };
-               A5BA15ED182340B400A82E69 /* RemoteInspectorXPCConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */; };
+               A5BA15ED182340B400A82E69 /* RemoteInspectorXPCConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A5BA15EE182340B400A82E69 /* RemoteInspectorXPCConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E7182340B300A82E69 /* RemoteInspectorXPCConnection.mm */; };
                A5BA15F0182345AF00A82E69 /* RemoteInspectorDebuggable.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15EF182345AF00A82E69 /* RemoteInspectorDebuggable.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A5CEEE14187F3BAD00E55C99 /* InspectorAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5CEEE12187F3BAD00E55C99 /* InspectorAgent.cpp */; };
index 43d403b..77464cf 100644 (file)
 #ifndef RemoteInspector_h
 #define RemoteInspector_h
 
-#import "RemoteInspectorDebuggableConnection.h"
 #import "RemoteInspectorXPCConnection.h"
 #import <wtf/Forward.h>
 #import <wtf/HashMap.h>
 #import <wtf/NeverDestroyed.h>
 #import <wtf/Threading.h>
 
-OBJC_CLASS NSString;
 OBJC_CLASS NSDictionary;
+OBJC_CLASS NSString;
 
 namespace Inspector {
 
 class RemoteInspectorDebuggable;
+class RemoteInspectorDebuggableConnection;
 struct RemoteInspectorDebuggableInfo;
 
 class JS_EXPORT_PRIVATE RemoteInspector FINAL : public RemoteInspectorXPCConnection::Client {
 public:
+    static void startDisabled();
     static RemoteInspector& shared();
     friend class NeverDestroyed<RemoteInspector>;
 
@@ -83,6 +84,8 @@ private:
     void receivedIndicateMessage(NSDictionary *userInfo);
     void receivedConnectionDiedMessage(NSDictionary *userInfo);
 
+    static bool startEnabled;
+
     // Debuggables can be registered from any thread at any time.
     // Any debuggable can send messages over the XPC connection.
     // So lock access to all maps and state as they can change
@@ -101,6 +104,6 @@ private:
 
 } // namespace Inspector
 
-#endif // ENABLE(REMOTE_INSPECTOR)
+#endif // RemoteInspector_h
 
-#endif // WebInspectorServer_h
+#endif // ENABLE(REMOTE_INSPECTOR)
index d6f0ae3..9c337ac 100644 (file)
 #import "InitializeThreading.h"
 #import "RemoteInspectorConstants.h"
 #import "RemoteInspectorDebuggable.h"
-#import <notify.h>
-#import <xpc/xpc.h>
+#import "RemoteInspectorDebuggableConnection.h"
 #import <Foundation/Foundation.h>
+#import <notify.h>
 #import <wtf/Assertions.h>
 #import <wtf/MainThread.h>
 #import <wtf/text/WTFString.h>
+#import <xpc/xpc.h>
 
 #if PLATFORM(IOS)
 #import <wtf/ios/WebCoreThread.h>
@@ -56,6 +57,13 @@ static void dispatchAsyncOnQueueSafeForAnyDebuggable(void (^block)())
     dispatch_async(dispatch_get_main_queue(), block);
 }
 
+bool RemoteInspector::startEnabled = true;
+
+void RemoteInspector::startDisabled()
+{
+    RemoteInspector::startEnabled = false;
+}
+
 RemoteInspector& RemoteInspector::shared()
 {
     static NeverDestroyed<RemoteInspector> shared;
@@ -64,7 +72,8 @@ RemoteInspector& RemoteInspector::shared()
     dispatch_once(&once, ^{
         JSC::initializeThreading();
         WTF::initializeMainThread();
-        shared.get().start();
+        if (RemoteInspector::startEnabled)
+            shared.get().start();
     });
 
     return shared;
index 0bf36ad..b6b38c4 100644 (file)
@@ -32,8 +32,8 @@
 #import <wtf/Noncopyable.h>
 #import <xpc/xpc.h>
 
-OBJC_CLASS NSString;
 OBJC_CLASS NSDictionary;
+OBJC_CLASS NSString;
 
 namespace Inspector {
 
index a7da22b..cb4dcbf 100644 (file)
@@ -1,3 +1,12 @@
+2014-01-15  Joseph Pecoraro  <pecoraro@apple.com>
+
+        [iOS] Clean up REMOTE_INSPECTOR code in OpenSource after the iOS merge
+        https://bugs.webkit.org/show_bug.cgi?id=127069
+
+        Reviewed by Timothy Hatcher.
+
+        * WebCore.exp.in:
+
 2014-01-15  Sam Weinig  <sam@webkit.org>
 
         TextBreakIterator's should support Latin-1 for all iterator types (Part 2)
index 9317479..4ca47d7 100644 (file)
@@ -2932,8 +2932,9 @@ __ZN7WebCore34registerQLPreviewConverterIfNeededEP5NSURLP8NSStringP6NSData
 #endif
 
 #if ENABLE(REMOTE_INSPECTOR)
-__ZN7WebCore4Page26setRemoteInspectionAllowedEb
 __ZN7WebCore19InspectorController27dispatchMessageFromFrontendERKN3WTF6StringE
+__ZN7WebCore4Page26setRemoteInspectionAllowedEb
+__ZNK7WebCore4Page23remoteInspectionAllowedEv
 #endif
 
 #if ENABLE(REQUEST_ANIMATION_FRAME)
index 1651f28..56e0235 100644 (file)
@@ -1,3 +1,32 @@
+2014-01-15  Joseph Pecoraro  <pecoraro@apple.com>
+
+        [iOS] Clean up REMOTE_INSPECTOR code in OpenSource after the iOS merge
+        https://bugs.webkit.org/show_bug.cgi?id=127069
+
+        Reviewed by Timothy Hatcher.
+
+        * WebView/WebView.mm:
+        (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
+        (+[WebView _enableRemoteInspector]):
+        (+[WebView _disableRemoteInspector]):
+        (+[WebView _disableAutoStartRemoteInspector]):
+        (+[WebView _isRemoteInspectorEnabled]):
+        (+[WebView _hasRemoteInspectorSession]):
+        (-[WebView allowsRemoteInspection]):
+        Implement with RemoteInspector.h SPIs.
+
+        (-[WebView setAllowsRemoteInspection:]):
+        (-[WebView setHostApplicationBundleId:name:]):
+        Still unimplemented, update comment.
+
+        (-[WebView _didCommitLoadForFrame:]):
+        Remove dead path, WebCore now pushes updates on navigations.
+
+        * WebView/WebViewData.h:
+        * WebView/WebViewData.mm:
+        (-[WebViewPrivate init]):
+        Remove now unused ivar.
+
 2014-01-15  Alexey Proskuryakov  <ap@apple.com>
 
         More iOS build fixing.
index f0a8566..189e8e8 100644 (file)
 #endif
 
 #if ENABLE(REMOTE_INSPECTOR)
+#import <JavaScriptCore/RemoteInspector.h>
 #if PLATFORM(IOS)
 #import "WebIndicateLayer.h"
 #endif
 @end
 #endif
 
-using namespace WebCore;
 using namespace JSC;
+using namespace Inspector;
+using namespace WebCore;
 
 #if defined(__ppc__) || defined(__ppc64__)
 #define PROCESSOR "PPC"
@@ -1183,7 +1185,7 @@ static bool shouldUseLegacyBackgroundSizeShorthandBehavior()
 }
 
 - (id)initSimpleHTMLDocumentWithStyle:(NSString *)style frame:(CGRect)frame preferences:(WebPreferences *)preferences groupName:(NSString *)groupName
-{    
+{
     self = [super initWithFrame:frame];
     if (!self)
         return nil;
@@ -1207,13 +1209,10 @@ static bool shouldUseLegacyBackgroundSizeShorthandBehavior()
     // Production installs always disallow debugging simple HTML documents.
     // Internal installs allow debugging simple HTML documents (TextFields) if the Internal Setting is enabled.
     if (!isInternalInstall())
-        _private->allowsRemoteInspection = NO;
+        _private->page->setRemoteInspectionAllowed(false);
     else {
         static BOOL textFieldInspectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitTextFieldRemoteInspectionEnabledPreferenceKey];
-        _private->allowsRemoteInspection = textFieldInspectionEnabled;
-        BOOL autoStartRemoteInspector = YES; // FIXME: <rdar://problem/15810991>
-        if (_private->allowsRemoteInspection && autoStartRemoteInspector)
-            [WebView _enableRemoteInspector];
+        _private->page->setRemoteInspectionAllowed(textFieldInspectionEnabled);
     }
 #endif
     
@@ -1923,40 +1922,37 @@ static bool fastDocumentTeardownEnabled()
 #if ENABLE(REMOTE_INSPECTOR)
 + (void)_enableRemoteInspector
 {
-    // FIXME: Move this to a new Inspector::RemoteInspectorServer interface or remove it.
+    RemoteInspector::shared().start();
 }
 
 + (void)_disableRemoteInspector
 {
-    // FIXME: Move this to a new Inspector::RemoteInspectorServer interface or remove it.
+    RemoteInspector::shared().stop();
 }
 
 + (void)_disableAutoStartRemoteInspector
 {
-    // FIXME: Move this to a new Inspector::RemoteInspectorServer interface or remove it.
+    RemoteInspector::startDisabled();
 }
 
 + (BOOL)_isRemoteInspectorEnabled
 {
-    // FIXME: Move this to a new Inspector::RemoteInspectorServer interface or remove it.
-    return NO;
+    return RemoteInspector::shared().enabled();
 }
 
 + (BOOL)_hasRemoteInspectorSession
 {
-    // FIXME: Move this to a new Inspector::RemoteInspectorServer interface or remove it.
-    return NO;
+    return RemoteInspector::shared().hasActiveDebugSession();
 }
 
 - (BOOL)allowsRemoteInspection
 {
-    // FIXME: Move this to a new API.
-    return NO;
+    return _private->page->remoteInspectionAllowed();
 }
 
 - (void)setAllowsRemoteInspection:(BOOL)allow
 {
-    // FIXME: Move this to a new API.
+    _private->page->setRemoteInspectionAllowed(allow);
 }
 
 - (void)setIndicatingForRemoteInspector:(BOOL)enabled
@@ -1983,8 +1979,6 @@ static bool fastDocumentTeardownEnabled()
 #if PLATFORM(IOS)
 - (void)setHostApplicationBundleId:(NSString *)bundleId name:(NSString *)name
 {
-    // FIXME: This has not yet been ported to Inspector::RemoteInspectorServer.
-
     if (![_private->hostApplicationBundleId isEqualToString:bundleId]) {
         [_private->hostApplicationBundleId release];
         _private->hostApplicationBundleId = [bundleId copy];
@@ -1995,8 +1989,7 @@ static bool fastDocumentTeardownEnabled()
         _private->hostApplicationName = [name copy];
     }
 
-    // FIXME: <rdar://problem/15810991>
-    // [[WebView sharedWebInspectorServer] pushListing];
+    // FIXME: This has not yet been ported to Inspector::RemoteInspectorServer.
 }
 
 - (NSString *)hostApplicationBundleId
@@ -3032,13 +3025,8 @@ static inline IMP getMethod(id o, SEL s)
 
 - (void)_didCommitLoadForFrame:(WebFrame *)frame
 {
-    if (frame == [self mainFrame]) {
+    if (frame == [self mainFrame])
         _private->didDrawTiles = 0;
-#if ENABLE(REMOTE_INSPECTOR)
-        // FIXME: <rdar://problem/15810991>
-        // [[WebView sharedWebInspectorServer] pushListing];
-#endif
-    }
 }
 
 #endif // PLATFORM(IOS)
index 9e6bdaf..9027479 100644 (file)
@@ -255,7 +255,6 @@ private:
 #endif
 
 #if ENABLE(REMOTE_INSPECTOR)
-    BOOL allowsRemoteInspection;
 #if PLATFORM(IOS)
     WebIndicateLayer *indicateLayer;
     NSString *hostApplicationBundleId;
index 86d117b..0ab373f 100644 (file)
@@ -105,10 +105,6 @@ WebViewLayerFlushScheduler::WebViewLayerFlushScheduler(LayerFlushController* flu
     dashboardBehaviorAllowWheelScrolling = YES;
 #endif
 
-#if ENABLE(REMOTE_INSPECTOR)
-    allowsRemoteInspection = YES;
-#endif
-
 #if PLATFORM(IOS)
     isStopping = NO;
     _geolocationProvider = [WebGeolocationProviderIOS sharedGeolocationProvider];