WKMutableArrayRef should be an ImmutableArray
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Nov 2013 23:37:46 +0000 (23:37 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Nov 2013 23:37:46 +0000 (23:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=124239

Reviewed by Sam Weinig.

* Shared/API/Cocoa/WKRemoteObjectCoder.mm:
(ensureObjectStream):
* Shared/API/c/WKMutableArray.cpp:
(WKMutableArrayCreate):
* Shared/API/c/WKSharedAPICast.h:

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

12 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm
Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp
Source/WebKit2/Shared/API/c/WKMutableArray.cpp
Source/WebKit2/Shared/API/c/WKSharedAPICast.h
Source/WebKit2/Shared/MutableArray.cpp [deleted file]
Source/WebKit2/Shared/MutableArray.h [deleted file]
Source/WebKit2/Shared/WebRenderObject.h
Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.cpp
Source/WebKit2/UIProcess/WebPageContextMenuClient.cpp
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp

index da54f3d..83d3ece 100644 (file)
@@ -1,5 +1,18 @@
 2013-11-12  Anders Carlsson  <andersca@apple.com>
 
+        WKMutableArrayRef should be an ImmutableArray
+        https://bugs.webkit.org/show_bug.cgi?id=124239
+
+        Reviewed by Sam Weinig.
+
+        * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
+        (ensureObjectStream):
+        * Shared/API/c/WKMutableArray.cpp:
+        (WKMutableArrayCreate):
+        * Shared/API/c/WKSharedAPICast.h:
+
+2013-11-12  Anders Carlsson  <andersca@apple.com>
+
         Remove more functionality from MutableArray
         https://bugs.webkit.org/show_bug.cgi?id=124235
 
index 8af8dc6..374d662 100644 (file)
@@ -26,7 +26,7 @@
 #import "config.h"
 #import "WKRemoteObjectCoder.h"
 
-#import "MutableArray.h"
+#import "ImmutableArray.h"
 #import "MutableDictionary.h"
 #import "WKRemoteObjectInterfaceInternal.h"
 #import "WebData.h"
@@ -59,7 +59,7 @@ static PassRefPtr<ImmutableDictionary> createEncodedObject(WKRemoteObjectEncoder
 
 @implementation WKRemoteObjectEncoder {
     RefPtr<MutableDictionary> _rootDictionary;
-    MutableArray* _objectStream;
+    ImmutableArray* _objectStream;
 
     MutableDictionary* _currentDictionary;
 }
@@ -94,7 +94,7 @@ static void ensureObjectStream(WKRemoteObjectEncoder *encoder)
     if (encoder->_objectStream)
         return;
 
-    RefPtr<MutableArray> objectStream = MutableArray::create();
+    RefPtr<ImmutableArray> objectStream = ImmutableArray::create();
     encoder->_objectStream = objectStream.get();
 
     encoder->_rootDictionary->set(objectStreamKey, objectStream.release());
index 41134c9..5358337 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "WKContextMenuItem.h"
 
-#include "MutableArray.h"
+#include "ImmutableArray.h"
 #include "WebContextMenuItem.h"
 #include "WebContextMenuItemData.h"
 #include "WKAPICast.h"
index 505b711..55e32c3 100644 (file)
 #include "config.h"
 #include "WKMutableArray.h"
 
-#include "MutableArray.h"
+#include "ImmutableArray.h"
 #include "WKAPICast.h"
 
 using namespace WebKit;
 
 WKMutableArrayRef WKMutableArrayCreate()
 {
-    return toAPI(MutableArray::create().leakRef());
+    return const_cast<WKMutableArrayRef>(toAPI(ImmutableArray::create().leakRef()));
 }
 
 bool WKArrayIsMutable(WKArrayRef arrayRef)
index 80aea88..9f4919c 100644 (file)
@@ -100,7 +100,6 @@ WK_ADD_API_MAPPING(WKDoubleRef, WebDouble)
 WK_ADD_API_MAPPING(WKErrorRef, WebError)
 WK_ADD_API_MAPPING(WKGraphicsContextRef, WebGraphicsContext)
 WK_ADD_API_MAPPING(WKImageRef, WebImage)
-WK_ADD_API_MAPPING(WKMutableArrayRef, MutableArray)
 WK_ADD_API_MAPPING(WKMutableDictionaryRef, MutableDictionary)
 WK_ADD_API_MAPPING(WKPointRef, WebPoint)
 WK_ADD_API_MAPPING(WKRectRef, WebRect)
@@ -115,6 +114,8 @@ WK_ADD_API_MAPPING(WKURLRequestRef, WebURLRequest)
 WK_ADD_API_MAPPING(WKURLResponseRef, WebURLResponse)
 WK_ADD_API_MAPPING(WKUserContentURLPatternRef, WebUserContentURLPattern)
 
+template<> struct APITypeInfo<WKMutableArrayRef> { typedef ImmutableArray* ImplType; };
+
 #if PLATFORM(MAC)
 WK_ADD_API_MAPPING(WKWebArchiveRef, WebArchive)
 WK_ADD_API_MAPPING(WKWebArchiveResourceRef, WebArchiveResource)
diff --git a/Source/WebKit2/Shared/MutableArray.cpp b/Source/WebKit2/Shared/MutableArray.cpp
deleted file mode 100644 (file)
index 7edaa89..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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. AND ITS CONTRIBUTORS ``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 ITS 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 "MutableArray.h"
-
-namespace WebKit {
-
-MutableArray::MutableArray()
-    : ImmutableArray(Vector<RefPtr<APIObject>>())
-{
-}
-
-MutableArray::~MutableArray()
-{
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit2/Shared/MutableArray.h b/Source/WebKit2/Shared/MutableArray.h
deleted file mode 100644 (file)
index eb46714..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2010 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. AND ITS CONTRIBUTORS ``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 ITS 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.
- */
-
-#ifndef MutableArray_h
-#define MutableArray_h
-
-#include "ImmutableArray.h"
-#include <wtf/Forward.h>
-
-namespace WebKit {
-
-// MutableArray - A mutable array type suitable for vending to an API.
-
-class MutableArray : public ImmutableArray {
-public:
-    static PassRefPtr<MutableArray> create()
-    {
-        return adoptRef(new MutableArray);
-    }
-
-    ~MutableArray();
-
-    virtual bool isMutable() { return true; }
-
-private:
-    MutableArray();
-};
-
-} // namespace WebKit
-
-#endif // MutableArray_h
index e3ef486..89704fa 100644 (file)
@@ -26,8 +26,7 @@
 #ifndef WebRenderObject_h
 #define WebRenderObject_h
 
-#include "APIObject.h"
-#include "MutableArray.h"
+#include "ImmutableArray.h"
 #include <WebCore/IntRect.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
index 93c0154..521ada5 100644 (file)
@@ -26,8 +26,8 @@
 #include "config.h"
 #include "WebNotificationProvider.h"
 
+#include "ImmutableArray.h"
 #include "ImmutableDictionary.h"
-#include "MutableArray.h"
 #include "WKAPICast.h"
 #include "WebNotification.h"
 #include "WebNotificationManagerProxy.h"
index 6996d9d..898fb8b 100644 (file)
@@ -29,8 +29,8 @@
 
 #include "WebPageContextMenuClient.h"
 
+#include "ImmutableArray.h"
 #include "Logging.h"
-#include "MutableArray.h"
 #include "WebContextMenuItem.h"
 #include "WKAPICast.h"
 #include "WKSharedAPICast.h"
index 47d4ad6..1fcd657 100644 (file)
                BCAF361F16CA28CD00D4E9FC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3DE46815A91763008D26FC /* Foundation.framework */; };
                BCAF362016CA28D600D4E9FC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3DE46815A91763008D26FC /* Foundation.framework */; };
                BCAF362216CA292B00D4E9FC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3DE46815A91763008D26FC /* Foundation.framework */; };
-               BCB0AD33122F285800B1341E /* MutableArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC8049D122F0D6B00103529 /* MutableArray.cpp */; };
-               BCB0AD34122F285800B1341E /* MutableArray.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC8049E122F0D6B00103529 /* MutableArray.h */; };
                BCB0AEE9122F53E300B1341E /* MutableDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB0AEE7122F53E300B1341E /* MutableDictionary.h */; };
                BCB0AEEA122F53E300B1341E /* MutableDictionary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB0AEE8122F53E300B1341E /* MutableDictionary.cpp */; };
                BCB0B0DC12305A2500B1341E /* WebContextUserMessageCoders.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB0B0DB12305A2500B1341E /* WebContextUserMessageCoders.h */; };
                BCC56F771159957D001CCAF9 /* MachPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachPort.h; sourceTree = "<group>"; };
                BCC57159115ADAEF001CCAF9 /* WebSystemInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSystemInterface.h; sourceTree = "<group>"; };
                BCC5715A115ADAEF001CCAF9 /* WebSystemInterface.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSystemInterface.mm; sourceTree = "<group>"; };
-               BCC8049D122F0D6B00103529 /* MutableArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MutableArray.cpp; sourceTree = "<group>"; };
-               BCC8049E122F0D6B00103529 /* MutableArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MutableArray.h; sourceTree = "<group>"; };
                BCC8B373125FB69000DE46A4 /* WKGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKGeometry.h; sourceTree = "<group>"; };
                BCC938E01180DE440085E5FE /* WKContextPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContextPrivate.h; sourceTree = "<group>"; };
                BCCB75C51203A1CE00222D1B /* WebContextMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMessageKinds.h; sourceTree = "<group>"; };
                                BCBCB0CC1215E33A00DE59CA /* ImmutableDictionary.cpp */,
                                BCBCB0CA1215E32100DE59CA /* ImmutableDictionary.h */,
                                1A92DC1012F8BA460017AF65 /* LayerTreeContext.h */,
-                               BCC8049D122F0D6B00103529 /* MutableArray.cpp */,
-                               BCC8049E122F0D6B00103529 /* MutableArray.h */,
                                BCB0AEE8122F53E300B1341E /* MutableDictionary.cpp */,
                                BCB0AEE7122F53E300B1341E /* MutableDictionary.h */,
                                C02BFF1512514FD8009CCBEA /* NativeWebKeyboardEvent.h */,
                                1A3EED0F161A535400AEB4F5 /* MessageReceiverMap.h in Headers */,
                                1A119A95127B796200A9ECB1 /* MessageSender.h in Headers */,
                                C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */,
-                               BCB0AD34122F285800B1341E /* MutableArray.h in Headers */,
                                BCB0AEE9122F53E300B1341E /* MutableDictionary.h in Headers */,
                                1A6FBA2A11E6862700DB1371 /* NetscapeBrowserFuncs.h in Headers */,
                                1A6FBD2811E69BC200DB1371 /* NetscapePlugin.h in Headers */,
                                C0E3AA7B1209E83500A49D01 /* Module.cpp in Sources */,
                                C0E3AA7A1209E83000A49D01 /* ModuleMac.mm in Sources */,
                                370F34A21829BE1E009027C8 /* WKNavigationData.mm in Sources */,
-                               BCB0AD33122F285800B1341E /* MutableArray.cpp in Sources */,
                                BCB0AEEA122F53E300B1341E /* MutableDictionary.cpp in Sources */,
                                C02BFF1E1251502E009CCBEA /* NativeWebKeyboardEventMac.mm in Sources */,
                                31EA25D2134F78C0005B1452 /* NativeWebMouseEventMac.mm in Sources */,
index 73c235d..6917c4c 100644 (file)
@@ -32,7 +32,6 @@
 #include "ImmutableArray.h"
 #include "InjectedBundleHitTestResult.h"
 #include "Logging.h"
-#include "MutableArray.h"
 #include "WebContextMenuItem.h"
 #include "WKAPICast.h"
 #include "WKBundleAPICast.h"