Modernize API::SerializedScriptValue
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Nov 2017 19:03:23 +0000 (19:03 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Nov 2017 19:03:23 +0000 (19:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180115

Patch by Alex Christensen <achristensen@webkit.org> on 2017-11-29
Reviewed by Brady Eidson.

Also remove some SPI that hasn't been used anywhere since Mountain Lion.

* Shared/API/APISerializedScriptValue.h:
(API::SerializedScriptValue::create):
(API::SerializedScriptValue::internalRepresentation):
(API::SerializedScriptValue::SerializedScriptValue):
* Shared/API/c/WKSerializedScriptValue.cpp:
(WKSerializedScriptValueDeserialize):
(WKSerializedScriptValueCreateWithInternalRepresentation): Deleted.
(WKSerializedScriptValueGetInternalRepresentation): Deleted.
* Shared/API/c/WKSerializedScriptValuePrivate.h: Removed.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _evaluateJavaScript:forceUserGesture:completionHandler:]):
* WebKit.xcodeproj/project.pbxproj:

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

Source/WebKit/ChangeLog
Source/WebKit/Shared/API/APISerializedScriptValue.h
Source/WebKit/Shared/API/c/WKSerializedScriptValue.cpp
Source/WebKit/Shared/API/c/WKSerializedScriptValuePrivate.h [deleted file]
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
Source/WebKit/WebKit.xcodeproj/project.pbxproj

index a70e814..b0107a4 100644 (file)
@@ -1,3 +1,25 @@
+2017-11-29  Alex Christensen  <achristensen@webkit.org>
+
+        Modernize API::SerializedScriptValue
+        https://bugs.webkit.org/show_bug.cgi?id=180115
+
+        Reviewed by Brady Eidson.
+
+        Also remove some SPI that hasn't been used anywhere since Mountain Lion.
+
+        * Shared/API/APISerializedScriptValue.h:
+        (API::SerializedScriptValue::create):
+        (API::SerializedScriptValue::internalRepresentation):
+        (API::SerializedScriptValue::SerializedScriptValue):
+        * Shared/API/c/WKSerializedScriptValue.cpp:
+        (WKSerializedScriptValueDeserialize):
+        (WKSerializedScriptValueCreateWithInternalRepresentation): Deleted.
+        (WKSerializedScriptValueGetInternalRepresentation): Deleted.
+        * Shared/API/c/WKSerializedScriptValuePrivate.h: Removed.
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _evaluateJavaScript:forceUserGesture:completionHandler:]):
+        * WebKit.xcodeproj/project.pbxproj:
+
 2017-11-29  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         REGRESSION(r218064): [GTK] Broke entering fullscreen mode in debug builds
index 1cfae4a..54c34e8 100644 (file)
@@ -36,7 +36,7 @@ namespace API {
 
 class SerializedScriptValue : public API::ObjectImpl<API::Object::Type::SerializedScriptValue> {
 public:
-    static Ref<SerializedScriptValue> create(RefPtr<WebCore::SerializedScriptValue>&& serializedValue)
+    static Ref<SerializedScriptValue> create(Ref<WebCore::SerializedScriptValue>&& serializedValue)
     {
         return adoptRef(*new SerializedScriptValue(WTFMove(serializedValue)));
     }
@@ -46,7 +46,7 @@ public:
         RefPtr<WebCore::SerializedScriptValue> serializedValue = WebCore::SerializedScriptValue::create(context, value, exception);
         if (!serializedValue)
             return nullptr;
-        return adoptRef(*new SerializedScriptValue(serializedValue.get()));
+        return adoptRef(*new SerializedScriptValue(serializedValue.releaseNonNull()));
     }
     
     static Ref<SerializedScriptValue> adopt(Vector<uint8_t>&& buffer)
@@ -65,15 +65,15 @@ public:
 
     IPC::DataReference dataReference() const { return m_serializedScriptValue->data(); }
 
-    WebCore::SerializedScriptValue* internalRepresentation() { return m_serializedScriptValue.get(); }
+    WebCore::SerializedScriptValue& internalRepresentation() { return m_serializedScriptValue.get(); }
 
 private:
-    explicit SerializedScriptValue(RefPtr<WebCore::SerializedScriptValue>&& serializedScriptValue)
+    explicit SerializedScriptValue(Ref<WebCore::SerializedScriptValue>&& serializedScriptValue)
         : m_serializedScriptValue(WTFMove(serializedScriptValue))
     {
     }
 
-    RefPtr<WebCore::SerializedScriptValue> m_serializedScriptValue;
+    Ref<WebCore::SerializedScriptValue> m_serializedScriptValue;
 };
     
 }
index 862fd7f..aad8eae 100644 (file)
@@ -25,7 +25,6 @@
 
 #include "config.h"
 #include "WKSerializedScriptValue.h"
-#include "WKSerializedScriptValuePrivate.h"
 
 #include "APISerializedScriptValue.h"
 #include "WKAPICast.h"
@@ -43,18 +42,7 @@ WKSerializedScriptValueRef WKSerializedScriptValueCreate(JSContextRef context, J
     return toAPI(serializedValue.leakRef());
 }
 
-WKSerializedScriptValueRef WKSerializedScriptValueCreateWithInternalRepresentation(void* internalRepresentation)
-{
-    auto serializedValue = API::SerializedScriptValue::create(static_cast<WebCore::SerializedScriptValue*>(internalRepresentation));
-    return toAPI(&serializedValue.leakRef());
-}
-
 JSValueRef WKSerializedScriptValueDeserialize(WKSerializedScriptValueRef scriptValueRef, JSContextRef contextRef, JSValueRef* exception)
 {
     return toImpl(scriptValueRef)->deserialize(contextRef, exception);
 }
-
-void* WKSerializedScriptValueGetInternalRepresentation(WKSerializedScriptValueRef scriptValueRef)
-{
-    return toImpl(scriptValueRef)->internalRepresentation();
-}
diff --git a/Source/WebKit/Shared/API/c/WKSerializedScriptValuePrivate.h b/Source/WebKit/Shared/API/c/WKSerializedScriptValuePrivate.h
deleted file mode 100644 (file)
index 837067f..0000000
+++ /dev/null
@@ -1,42 +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 WKSerializedScriptValuePrivate_h
-#define WKSerializedScriptValuePrivate_h
-
-#include <WebKit/WKBase.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-WK_EXPORT void* WKSerializedScriptValueGetInternalRepresentation(WKSerializedScriptValueRef scriptValueRef);
-WK_EXPORT WKSerializedScriptValueRef WKSerializedScriptValueCreateWithInternalRepresentation(void*);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* WKSerializedScriptValuePrivate_h */
index cb1fdb2..3b46204 100644 (file)
@@ -1028,7 +1028,7 @@ static WKErrorCode callbackErrorCode(WebKit::CallbackBase::Error error)
             return;
         }
 
-        id body = API::SerializedScriptValue::deserialize(*serializedScriptValue->internalRepresentation(), 0);
+        id body = API::SerializedScriptValue::deserialize(serializedScriptValue->internalRepresentation(), 0);
         rawHandler(body, nil);
     });
 }
index c79cdaa..6f9ad2a 100644 (file)
@@ -3277,7 +3277,7 @@ static void webkitWebViewRunJavaScriptCallback(API::SerializedScriptValue* wkSer
 
     auto* jsContext = webkit_web_view_get_javascript_global_context(WEBKIT_WEB_VIEW(g_task_get_source_object(task)));
     g_task_return_pointer(task, webkitJavascriptResultCreate(jsContext,
-        *wkSerializedScriptValue->internalRepresentation()),
+        wkSerializedScriptValue->internalRepresentation()),
         reinterpret_cast<GDestroyNotify>(webkit_javascript_result_unref));
 }
 
index a6eaf43..bf1f9c6 100644 (file)
                F6113E28126CE19B0057D0A7 /* WKUserContentURLPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6113E26126CE19B0057D0A7 /* WKUserContentURLPattern.cpp */; };
                F6113E29126CE19B0057D0A7 /* WKUserContentURLPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = F6113E27126CE19B0057D0A7 /* WKUserContentURLPattern.h */; settings = {ATTRIBUTES = (Private, ); }; };
                F634445612A885C8000612D8 /* APISecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = F634445512A885C8000612D8 /* APISecurityOrigin.h */; };
-               F67DD7BA125E40D9007BDCB8 /* WKSerializedScriptValuePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F67DD7B9125E40D9007BDCB8 /* WKSerializedScriptValuePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                F6A90813133C20510082C3F4 /* WebCookieManagerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6A90811133C1F3D0082C3F4 /* WebCookieManagerMac.mm */; };
                F6D632BC133D198200743D77 /* WebCookieManagerProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6D632BA133D181B00743D77 /* WebCookieManagerProxyMac.mm */; };
                FED3C1DC1B447EAC00E0EB7F /* APISerializedScriptValueCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = FED3C1DA1B447AE800E0EB7F /* APISerializedScriptValueCocoa.mm */; };
                F6113E27126CE19B0057D0A7 /* WKUserContentURLPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentURLPattern.h; sourceTree = "<group>"; };
                F634445512A885C8000612D8 /* APISecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APISecurityOrigin.h; sourceTree = "<group>"; };
                F638954F133BEF38008941D5 /* HTTPCookieAcceptPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPCookieAcceptPolicy.h; sourceTree = "<group>"; };
-               F67DD7B9125E40D9007BDCB8 /* WKSerializedScriptValuePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKSerializedScriptValuePrivate.h; sourceTree = "<group>"; };
                F6A0C13F13281E6E0070430F /* ResourceCachesToClear.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceCachesToClear.h; sourceTree = "<group>"; };
                F6A90811133C1F3D0082C3F4 /* WebCookieManagerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCookieManagerMac.mm; sourceTree = "<group>"; };
                F6D632BA133D181B00743D77 /* WebCookieManagerProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCookieManagerProxyMac.mm; sourceTree = "<group>"; };
                                51CD1C5A1B3493A900142CA5 /* WKSecurityOriginRef.h */,
                                BC4075E7124FF0270068F20A /* WKSerializedScriptValue.cpp */,
                                BC4075E8124FF0270068F20A /* WKSerializedScriptValue.h */,
-                               F67DD7B9125E40D9007BDCB8 /* WKSerializedScriptValuePrivate.h */,
                                BCDDB32A124EC2AB0048D13C /* WKSharedAPICast.h */,
                                BC4075E9124FF0270068F20A /* WKString.cpp */,
                                BC4075EA124FF0270068F20A /* WKString.h */,
                                51CD1C671B34B9DF00142CA5 /* WKSecurityOriginInternal.h in Headers */,
                                51CD1C5E1B3493B400142CA5 /* WKSecurityOriginRef.h in Headers */,
                                BC407604124FF0270068F20A /* WKSerializedScriptValue.h in Headers */,
-                               F67DD7BA125E40D9007BDCB8 /* WKSerializedScriptValuePrivate.h in Headers */,
                                1ADE46B31954EC61000F7985 /* WKSessionStateRef.h in Headers */,
                                BCDDB32B124EC2AB0048D13C /* WKSharedAPICast.h in Headers */,
                                513E462D1AD837560016234A /* WKSharingServicePickerDelegate.h in Headers */,