Title: [235019] trunk/Source/WebKit
Revision
235019
Author
[email protected]
Date
2018-08-19 15:54:24 -0700 (Sun, 19 Aug 2018)

Log Message

[Cocoa] Consolidate inline "wrapper" functions in WebKit API into function templates and WrapperTraits
https://bugs.webkit.org/show_bug.cgi?id=188733

Reviewed by Sam Weinig.

Replaced all the different functions named "wrapper" that were all boilerplate doing Objective-C
casts with WrapperTraits specializations. The only thing about this that was at all tricky was
the loose mixing of the WebKit namespace, the API namespace, and the global namespace. My choice
for this first step was to put WrapperTraits into the WebKit namespace and to put the wrapper
function into both the WebKit and API namespaces with "using". This turned out pretty clean: did
not have to touch any of the code calling wrapper just to make things work, although we can now
clean up by changing call sites to get rid of unnecessary explicit use of leakRef and autorelease.
Doing this will make ARC conversion practical and easy, which is the motivation behind pursuing
this set of changes.

* Shared/Cocoa/WKObject.h: Tweaked style of the ObjectStorage structure template,
using a class name instead of "T". Added WrapperTraits structure template, checkedObjCCast
function template, and multiple wrapper functions templates that take a variety of pointer,
reference, smart pointer, and smart reference types, and return the wrapper for each one,
handling object lifetime appropriately.

* Shared/API/Cocoa/_WKFrameHandleInternal.h:
* Shared/API/Cocoa/_WKHitTestResultInternal.h:
* Shared/Cocoa/WKNSArray.h:
* Shared/Cocoa/WKNSData.h:
* Shared/Cocoa/WKNSDictionary.h:
* Shared/Cocoa/WKNSError.h:
* Shared/Cocoa/WKNSNumber.h:
* Shared/Cocoa/WKNSString.h:
* Shared/Cocoa/WKNSURL.h:
* Shared/Cocoa/WKNSURLRequest.h:
* UIProcess/API/Cocoa/WKBackForwardListInternal.h:
* UIProcess/API/Cocoa/WKBackForwardListItemInternal.h:
* UIProcess/API/Cocoa/WKBrowsingContextGroupInternal.h:
* UIProcess/API/Cocoa/WKConnectionInternal.h:
* UIProcess/API/Cocoa/WKContentRuleListInternal.h:
* UIProcess/API/Cocoa/WKContentRuleListStoreInternal.h:
* UIProcess/API/Cocoa/WKFrameInfoInternal.h:
* UIProcess/API/Cocoa/WKHTTPCookieStoreInternal.h:
* UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h:
* UIProcess/API/Cocoa/WKNavigationActionInternal.h:
* UIProcess/API/Cocoa/WKNavigationDataInternal.h:
* UIProcess/API/Cocoa/WKNavigationInternal.h:
* UIProcess/API/Cocoa/WKNavigationResponseInternal.h:
* UIProcess/API/Cocoa/WKOpenPanelParametersInternal.h:
* UIProcess/API/Cocoa/WKPreferencesInternal.h:
* UIProcess/API/Cocoa/WKProcessPoolInternal.h:
* UIProcess/API/Cocoa/WKSecurityOriginInternal.h:
* UIProcess/API/Cocoa/WKUserContentControllerInternal.h:
* UIProcess/API/Cocoa/WKUserScriptInternal.h:
* UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
* UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h:
* UIProcess/API/Cocoa/WKWindowFeaturesInternal.h:
* UIProcess/API/Cocoa/_WKApplicationManifestInternal.h:
* UIProcess/API/Cocoa/_WKAttachmentInternal.h:
* UIProcess/API/Cocoa/_WKAutomationSessionInternal.h:
* UIProcess/API/Cocoa/_WKExperimentalFeatureInternal.h:
* UIProcess/API/Cocoa/_WKGeolocationPositionInternal.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfigurationInternal.h:
* UIProcess/API/Cocoa/_WKUserContentWorldInternal.h:
* UIProcess/API/Cocoa/_WKUserInitiatedActionInternal.h:
* UIProcess/API/Cocoa/_WKUserStyleSheetInternal.h:
* UIProcess/API/Cocoa/_WKVisitedLinkStoreInternal.h:
* UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h:
* UIProcess/Cocoa/DownloadClient.mm:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrameInternal.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResultInternal.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandleInternal.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroupInternal.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorldInternal.h:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerInternal.h:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInInternal.h:
Replaced inline wrapper functions with WrapperTraits structure template
specializations. This is always in the WebKit namespace, unlike the functions,
which were in a mix of namespaces. Also deleted some unneeded "#pragma once".

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (235018 => 235019)


--- trunk/Source/WebKit/ChangeLog	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/ChangeLog	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,3 +1,82 @@
+2018-08-19  Darin Adler  <[email protected]>
+
+        [Cocoa] Consolidate inline "wrapper" functions in WebKit API into function templates and WrapperTraits
+        https://bugs.webkit.org/show_bug.cgi?id=188733
+
+        Reviewed by Sam Weinig.
+
+        Replaced all the different functions named "wrapper" that were all boilerplate doing Objective-C
+        casts with WrapperTraits specializations. The only thing about this that was at all tricky was
+        the loose mixing of the WebKit namespace, the API namespace, and the global namespace. My choice
+        for this first step was to put WrapperTraits into the WebKit namespace and to put the wrapper
+        function into both the WebKit and API namespaces with "using". This turned out pretty clean: did
+        not have to touch any of the code calling wrapper just to make things work, although we can now
+        clean up by changing call sites to get rid of unnecessary explicit use of leakRef and autorelease.
+        Doing this will make ARC conversion practical and easy, which is the motivation behind pursuing
+        this set of changes.
+
+        * Shared/Cocoa/WKObject.h: Tweaked style of the ObjectStorage structure template,
+        using a class name instead of "T". Added WrapperTraits structure template, checkedObjCCast
+        function template, and multiple wrapper functions templates that take a variety of pointer,
+        reference, smart pointer, and smart reference types, and return the wrapper for each one,
+        handling object lifetime appropriately.
+
+        * Shared/API/Cocoa/_WKFrameHandleInternal.h:
+        * Shared/API/Cocoa/_WKHitTestResultInternal.h:
+        * Shared/Cocoa/WKNSArray.h:
+        * Shared/Cocoa/WKNSData.h:
+        * Shared/Cocoa/WKNSDictionary.h:
+        * Shared/Cocoa/WKNSError.h:
+        * Shared/Cocoa/WKNSNumber.h:
+        * Shared/Cocoa/WKNSString.h:
+        * Shared/Cocoa/WKNSURL.h:
+        * Shared/Cocoa/WKNSURLRequest.h:
+        * UIProcess/API/Cocoa/WKBackForwardListInternal.h:
+        * UIProcess/API/Cocoa/WKBackForwardListItemInternal.h:
+        * UIProcess/API/Cocoa/WKBrowsingContextGroupInternal.h:
+        * UIProcess/API/Cocoa/WKConnectionInternal.h:
+        * UIProcess/API/Cocoa/WKContentRuleListInternal.h:
+        * UIProcess/API/Cocoa/WKContentRuleListStoreInternal.h:
+        * UIProcess/API/Cocoa/WKFrameInfoInternal.h:
+        * UIProcess/API/Cocoa/WKHTTPCookieStoreInternal.h:
+        * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h:
+        * UIProcess/API/Cocoa/WKNavigationActionInternal.h:
+        * UIProcess/API/Cocoa/WKNavigationDataInternal.h:
+        * UIProcess/API/Cocoa/WKNavigationInternal.h:
+        * UIProcess/API/Cocoa/WKNavigationResponseInternal.h:
+        * UIProcess/API/Cocoa/WKOpenPanelParametersInternal.h:
+        * UIProcess/API/Cocoa/WKPreferencesInternal.h:
+        * UIProcess/API/Cocoa/WKProcessPoolInternal.h:
+        * UIProcess/API/Cocoa/WKSecurityOriginInternal.h:
+        * UIProcess/API/Cocoa/WKUserContentControllerInternal.h:
+        * UIProcess/API/Cocoa/WKUserScriptInternal.h:
+        * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
+        * UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h:
+        * UIProcess/API/Cocoa/WKWindowFeaturesInternal.h:
+        * UIProcess/API/Cocoa/_WKApplicationManifestInternal.h:
+        * UIProcess/API/Cocoa/_WKAttachmentInternal.h:
+        * UIProcess/API/Cocoa/_WKAutomationSessionInternal.h:
+        * UIProcess/API/Cocoa/_WKExperimentalFeatureInternal.h:
+        * UIProcess/API/Cocoa/_WKGeolocationPositionInternal.h:
+        * UIProcess/API/Cocoa/_WKProcessPoolConfigurationInternal.h:
+        * UIProcess/API/Cocoa/_WKUserContentWorldInternal.h:
+        * UIProcess/API/Cocoa/_WKUserInitiatedActionInternal.h:
+        * UIProcess/API/Cocoa/_WKUserStyleSheetInternal.h:
+        * UIProcess/API/Cocoa/_WKVisitedLinkStoreInternal.h:
+        * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h:
+        * UIProcess/Cocoa/DownloadClient.mm:
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrameInternal.h:
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResultInternal.h:
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandleInternal.h:
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroupInternal.h:
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h:
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorldInternal.h:
+        * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerInternal.h:
+        * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInInternal.h:
+        Replaced inline wrapper functions with WrapperTraits structure template
+        specializations. This is always in the WebKit namespace, unlike the functions,
+        which were in a mix of namespaces. Also deleted some unneeded "#pragma once".
+
 2018-08-19  David Kilzer  <[email protected]>
 
         REGRESSION (r234396): Leak of CFURLRef in WebKit::NetworkProcess::deleteHSTSCacheForHostNames()

Modified: trunk/Source/WebKit/Shared/API/Cocoa/_WKFrameHandleInternal.h (235018 => 235019)


--- trunk/Source/WebKit/Shared/API/Cocoa/_WKFrameHandleInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/Shared/API/Cocoa/_WKFrameHandleInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline _WKFrameHandle *wrapper(API::FrameHandle& frameHandle)
-{
-    ASSERT([frameHandle.wrapper() isKindOfClass:[_WKFrameHandle self]]);
-    return (_WKFrameHandle *)frameHandle.wrapper();
-}
+template<> struct WrapperTraits<API::FrameHandle> {
+    using WrapperClass = _WKFrameHandle;
+};
 
 }
 

Modified: trunk/Source/WebKit/Shared/API/Cocoa/_WKHitTestResultInternal.h (235018 => 235019)


--- trunk/Source/WebKit/Shared/API/Cocoa/_WKHitTestResultInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/Shared/API/Cocoa/_WKHitTestResultInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,17 +30,14 @@
 #import "APIHitTestResult.h"
 #import "WKObject.h"
 
-namespace API {
+namespace WebKit {
 
-inline _WKHitTestResult *wrapper(API::HitTestResult& hitTestResult)
-{
-    ASSERT([hitTestResult.wrapper() isKindOfClass:[_WKHitTestResult class]]);
+template<> struct WrapperTraits<API::HitTestResult> {
+    using WrapperClass = _WKHitTestResult;
+};
 
-    return (_WKHitTestResult *)hitTestResult.wrapper();
 }
 
-}
-
 @interface _WKHitTestResult () <WKObject> {
 @package
     API::ObjectStorage<API::HitTestResult> _hitTestResult;

Modified: trunk/Source/WebKit/Shared/Cocoa/WKNSArray.h (235018 => 235019)


--- trunk/Source/WebKit/Shared/Cocoa/WKNSArray.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/Shared/Cocoa/WKNSArray.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,11 +30,12 @@
 #import "APIArray.h"
 #import "WKObject.h"
 
-inline NSArray *wrapper(API::Array& array)
-{
-    ASSERT([array.wrapper() isKindOfClass:[NSArray class]]);
+namespace WebKit {
 
-    return (NSArray *)array.wrapper();
+template<> struct WrapperTraits<API::Array> {
+    using WrapperClass = NSArray;
+};
+
 }
 
 @interface WKNSArray : NSArray <WKObject>

Modified: trunk/Source/WebKit/Shared/Cocoa/WKNSData.h (235018 => 235019)


--- trunk/Source/WebKit/Shared/Cocoa/WKNSData.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/Shared/Cocoa/WKNSData.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,13 +30,11 @@
 #import "APIData.h"
 #import "WKObject.h"
 
-namespace API {
+namespace WebKit {
 
-inline NSData *wrapper(API::Data& data)
-{
-    ASSERT([data.wrapper() isKindOfClass:[NSData self]]);
-    return (NSData *)data.wrapper();
-}
+template<> struct WrapperTraits<API::Data> {
+    using WrapperClass = NSData;
+};
 
 }
 

Modified: trunk/Source/WebKit/Shared/Cocoa/WKNSDictionary.h (235018 => 235019)


--- trunk/Source/WebKit/Shared/Cocoa/WKNSDictionary.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/Shared/Cocoa/WKNSDictionary.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,7 +31,11 @@
 #import "WKObject.h"
 
 namespace WebKit {
-inline NSDictionary *wrapper(API::Dictionary& dictionary) { ASSERT([dictionary.wrapper() isKindOfClass:[NSDictionary class]]); return (NSDictionary *)dictionary.wrapper(); }
+
+template<> struct WrapperTraits<API::Dictionary> {
+    using WrapperClass = NSDictionary;
+};
+
 }
 
 @interface WKNSDictionary : NSDictionary <WKObject>

Modified: trunk/Source/WebKit/Shared/Cocoa/WKNSError.h (235018 => 235019)


--- trunk/Source/WebKit/Shared/Cocoa/WKNSError.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/Shared/Cocoa/WKNSError.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline NSError *wrapper(API::Error& error)
-{
-    ASSERT([error.wrapper() isKindOfClass:[NSError self]]);
-    return (NSError *)error.wrapper();
-}
+template<> struct WrapperTraits<API::Error> {
+    using WrapperClass = NSError;
+};
 
 }
 

Modified: trunk/Source/WebKit/Shared/Cocoa/WKNSNumber.h (235018 => 235019)


--- trunk/Source/WebKit/Shared/Cocoa/WKNSNumber.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/Shared/Cocoa/WKNSNumber.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,8 +31,11 @@
 #import "WKObject.h"
 
 namespace WebKit {
-template<typename NumberType, API::Object::Type APIObjectType>
-inline NSNumber *wrapper(API::Number<NumberType, APIObjectType>& number) { ASSERT([number.wrapper() isKindOfClass:[NSNumber class]]); return (NSNumber *)number.wrapper(); }
+
+template<typename NumberType, API::Object::Type APIObjectType> struct WrapperTraits<API::Number<NumberType, APIObjectType>> {
+    using WrapperClass = NSNumber;
+};
+
 }
 
 @interface WKNSNumber : NSNumber <WKObject> {

Modified: trunk/Source/WebKit/Shared/Cocoa/WKNSString.h (235018 => 235019)


--- trunk/Source/WebKit/Shared/Cocoa/WKNSString.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/Shared/Cocoa/WKNSString.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,7 +31,11 @@
 #import "WKObject.h"
 
 namespace WebKit {
-inline NSString *wrapper(API::String& string) { ASSERT([string.wrapper() isKindOfClass:[NSString class]]); return (NSString *)string.wrapper(); }
+
+template<> struct WrapperTraits<API::String> {
+    using WrapperClass = NSString;
+};
+
 }
 
 @interface WKNSString : WKObject <NSCopying>

Modified: trunk/Source/WebKit/Shared/Cocoa/WKNSURL.h (235018 => 235019)


--- trunk/Source/WebKit/Shared/Cocoa/WKNSURL.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/Shared/Cocoa/WKNSURL.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline NSURL *wrapper(API::URL& url)
-{
-    ASSERT([url.wrapper() isKindOfClass:[NSURL class]]);
-    return (NSURL *)url.wrapper();
-}
+template<> struct WrapperTraits<API::URL> {
+    using WrapperClass = NSURL;
+};
 
 }
 

Modified: trunk/Source/WebKit/Shared/Cocoa/WKNSURLRequest.h (235018 => 235019)


--- trunk/Source/WebKit/Shared/Cocoa/WKNSURLRequest.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/Shared/Cocoa/WKNSURLRequest.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,10 +32,9 @@
 
 namespace WebKit {
 
-inline NSURLRequest *wrapper(API::URLRequest& request)
-{
-    return (NSURLRequest *)request.wrapper();
-}
+template<> struct WrapperTraits<API::URLRequest> {
+    using WrapperClass = NSURLRequest;
+};
 
 }
 

Modified: trunk/Source/WebKit/Shared/Cocoa/WKObject.h (235018 => 235019)


--- trunk/Source/WebKit/Shared/Cocoa/WKObject.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/Shared/Cocoa/WKObject.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,17 +28,18 @@
 #if WK_API_ENABLED
 
 #import <type_traits>
+#import <wtf/RefPtr.h>
 
 namespace API {
+
 class Object;
 
-template<typename T>
-struct ObjectStorage {
-    T* get() { return reinterpret_cast<T*>(&data); }
-    T& operator*() { return *reinterpret_cast<T*>(&data); }
-    T* operator->() { return reinterpret_cast<T*>(&data); }
+template<typename ObjectClass> struct ObjectStorage {
+    ObjectClass* get() { return reinterpret_cast<ObjectClass*>(&data); }
+    ObjectClass& operator*() { return *get(); }
+    ObjectClass* operator->() { return get(); }
 
-    typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type data;
+    typename std::aligned_storage<sizeof(ObjectClass), std::alignment_of<ObjectClass>::value>::type data;
 };
 
 API::Object* unwrap(void*);
@@ -46,6 +47,54 @@
 
 }
 
+namespace WebKit {
+
+template<typename WrappedObjectClass> struct WrapperTraits;
+
+template<typename DestinationClass, typename SourceClass> inline DestinationClass *checkedObjCCast(SourceClass *source)
+{
+    ASSERT([source isKindOfClass:[DestinationClass class]]);
+    return (DestinationClass *)source;
+}
+
+template<typename ObjectClass> inline typename WrapperTraits<ObjectClass>::WrapperClass *wrapper(ObjectClass& object)
+{
+    return checkedObjCCast<typename WrapperTraits<ObjectClass>::WrapperClass>(object.wrapper());
+}
+
+template<typename ObjectClass> inline typename WrapperTraits<ObjectClass>::WrapperClass *wrapper(ObjectClass* object)
+{
+    return object ? wrapper(*object) : nil;
+}
+
+template<typename ObjectClass> inline typename WrapperTraits<ObjectClass>::WrapperClass *wrapper(const Ref<ObjectClass>& object)
+{
+    return wrapper(object.get());
+}
+
+template<typename ObjectClass> inline typename WrapperTraits<ObjectClass>::WrapperClass *wrapper(const RefPtr<ObjectClass>& object)
+{
+    return wrapper(object.get());
+}
+
+template<typename ObjectClass> inline typename WrapperTraits<ObjectClass>::WrapperClass *wrapper(Ref<ObjectClass>&& object)
+{
+    return [wrapper(object.leakRef()) autorelease];
+}
+
+template<typename ObjectClass> inline typename WrapperTraits<ObjectClass>::WrapperClass *wrapper(RefPtr<ObjectClass>&& object)
+{
+    return object ? wrapper(object.releaseNonNull()) : nil;
+}
+
+}
+
+namespace API {
+
+using WebKit::wrapper;
+
+}
+
 @protocol WKObject <NSObject>
 
 @property (readonly) API::Object& _apiObject;

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,7 +31,11 @@
 #import "WebBackForwardList.h"
 
 namespace WebKit {
-inline WKBackForwardList *wrapper(WebBackForwardList& list) { ASSERT([list.wrapper() isKindOfClass:[WKBackForwardList class]]); return (WKBackForwardList *)list.wrapper(); }
+
+template<> struct WrapperTraits<WebBackForwardList> {
+    using WrapperClass = WKBackForwardList;
+};
+
 }
 
 @interface WKBackForwardList () <WKObject>

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListItemInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListItemInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListItemInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,7 +31,11 @@
 #import "WebBackForwardListItem.h"
 
 namespace WebKit {
-inline WKBackForwardListItem *wrapper(WebBackForwardListItem& item) { ASSERT([item.wrapper() isKindOfClass:[WKBackForwardListItem class]]); return (WKBackForwardListItem *)item.wrapper(); }
+
+template<> struct WrapperTraits<WebBackForwardListItem> {
+    using WrapperClass = WKBackForwardListItem;
+};
+
 }
 
 @interface WKBackForwardListItem () <WKObject>

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextGroupInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextGroupInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextGroupInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline WKBrowsingContextGroup *wrapper(WebPageGroup& pageGroup)
-{
-    ASSERT([pageGroup.wrapper() isKindOfClass:[WKBrowsingContextGroup class]]);
-    return (WKBrowsingContextGroup *)pageGroup.wrapper();
-}
+template<> struct WrapperTraits<WebPageGroup> {
+    using WrapperClass = WKBrowsingContextGroup;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKConnectionInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKConnectionInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKConnectionInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline WKConnection *wrapper(WebConnection& connection)
-{
-    ASSERT([connection.wrapper() isKindOfClass:[WKConnection class]]);
-    return (WKConnection *)connection.wrapper();
-}
+template<> struct WrapperTraits<WebConnection> {
+    using WrapperClass = WKConnection;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline WKContentRuleList *wrapper(API::ContentRuleList& contentRuleList)
-{
-    ASSERT([contentRuleList.wrapper() isKindOfClass:[WKContentRuleList class]]);
-    return (WKContentRuleList *)contentRuleList.wrapper();
-}
+template<> struct WrapperTraits<API::ContentRuleList> {
+    using WrapperClass = WKContentRuleList;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStoreInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStoreInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStoreInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline WKContentRuleListStore *wrapper(API::ContentRuleListStore& store)
-{
-    ASSERT([store.wrapper() isKindOfClass:[WKContentRuleListStore class]]);
-    return (WKContentRuleListStore *)store.wrapper();
-}
+template<> struct WrapperTraits<API::ContentRuleListStore> {
+    using WrapperClass = WKContentRuleListStore;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKFrameInfoInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKFrameInfoInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKFrameInfoInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,17 +30,14 @@
 #import "APIFrameInfo.h"
 #import "WKObject.h"
 
-namespace API {
+namespace WebKit {
 
-inline WKFrameInfo *wrapper(API::FrameInfo& frameInfo)
-{
-    ASSERT([frameInfo.wrapper() isKindOfClass:[WKFrameInfo class]]);
+template<> struct WrapperTraits<API::FrameInfo> {
+    using WrapperClass = WKFrameInfo;
+};
 
-    return (WKFrameInfo *)frameInfo.wrapper();
 }
 
-}
-
 @interface WKFrameInfo () <WKObject> {
 @package
     API::ObjectStorage<API::FrameInfo> _frameInfo;

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStoreInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStoreInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStoreInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline WKHTTPCookieStore *wrapper(API::HTTPCookieStore& cookieStore)
-{
-    ASSERT([cookieStore.wrapper() isKindOfClass:[WKHTTPCookieStore class]]);
-    return (WKHTTPCookieStore *)cookieStore.wrapper();
-}
+template<> struct WrapperTraits<API::HTTPCookieStore> {
+    using WrapperClass = WKHTTPCookieStore;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline NSURLAuthenticationChallenge *wrapper(AuthenticationChallengeProxy& challenge)
-{
-    ASSERT([challenge.wrapper() isKindOfClass:[NSURLAuthenticationChallenge self]]);
-    return (NSURLAuthenticationChallenge *)challenge.wrapper();
-}
+template<> struct WrapperTraits<AuthenticationChallengeProxy> {
+    using WrapperClass = NSURLAuthenticationChallenge;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationActionInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationActionInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationActionInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,17 +30,14 @@
 #import "APINavigationAction.h"
 #import "WKObject.h"
 
-namespace API {
+namespace WebKit {
 
-inline WKNavigationAction *wrapper(API::NavigationAction& navigationAction)
-{
-    ASSERT([navigationAction.wrapper() isKindOfClass:[WKNavigationAction class]]);
+template<> struct WrapperTraits<API::NavigationAction> {
+    using WrapperClass = WKNavigationAction;
+};
 
-    return (WKNavigationAction *)navigationAction.wrapper();
 }
 
-}
-
 @interface WKNavigationAction () <WKObject> {
 @package
     API::ObjectStorage<API::NavigationAction> _navigationAction;

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDataInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDataInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDataInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,15 +32,12 @@
 
 namespace WebKit {
 
-inline WKNavigationData *wrapper(API::NavigationData& data)
-{
-    ASSERT([data.wrapper() isKindOfClass:[WKNavigationData class]]);
+template<> struct WrapperTraits<API::NavigationData> {
+    using WrapperClass = WKNavigationData;
+};
 
-    return (WKNavigationData *)data.wrapper();
 }
 
-}
-
 @interface WKNavigationData () <WKObject>
 @end
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,17 +30,14 @@
 #import "APINavigation.h"
 #import "WKObject.h"
 
-namespace API {
+namespace WebKit {
 
-inline WKNavigation *wrapper(API::Navigation& navigation)
-{
-    ASSERT([navigation.wrapper() isKindOfClass:[WKNavigation class]]);
+template<> struct WrapperTraits<API::Navigation> {
+    using WrapperClass = WKNavigation;
+};
 
-    return (WKNavigation *)navigation.wrapper();
 }
 
-}
-
 @interface WKNavigation () <WKObject>
 @end
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationResponseInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationResponseInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationResponseInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,17 +30,14 @@
 #import "APINavigationResponse.h"
 #import "WKObject.h"
 
-namespace API {
+namespace WebKit {
 
-inline WKNavigationResponse *wrapper(API::NavigationResponse& navigationResponse)
-{
-    ASSERT([navigationResponse.wrapper() isKindOfClass:[WKNavigationResponse class]]);
+template<> struct WrapperTraits<API::NavigationResponse> {
+    using WrapperClass = WKNavigationResponse;
+};
 
-    return (WKNavigationResponse *)navigationResponse.wrapper();
 }
 
-}
-
 @interface WKNavigationResponse () <WKObject> {
 @package
     API::ObjectStorage<API::NavigationResponse> _navigationResponse;

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKOpenPanelParametersInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKOpenPanelParametersInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKOpenPanelParametersInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,17 +30,14 @@
 #import "APIOpenPanelParameters.h"
 #import "WKObject.h"
 
-namespace API {
+namespace WebKit {
 
-inline WKOpenPanelParameters *wrapper(OpenPanelParameters& openPanelParameters)
-{
-    ASSERT([openPanelParameters.wrapper() isKindOfClass:[WKOpenPanelParameters class]]);
+template<> struct WrapperTraits<API::OpenPanelParameters> {
+    using WrapperClass = WKOpenPanelParameters;
+};
 
-    return (WKOpenPanelParameters *)openPanelParameters.wrapper();
 }
 
-}
-
 @interface WKOpenPanelParameters () <WKObject> {
 @package
     API::ObjectStorage<API::OpenPanelParameters> _openPanelParameters;

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline WKPreferences *wrapper(WebPreferences& preferences)
-{
-    ASSERT([preferences.wrapper() isKindOfClass:[WKPreferences class]]);
-    return (WKPreferences *)preferences.wrapper();
-}
+template<> struct WrapperTraits<WebPreferences> {
+    using WrapperClass = WKPreferences;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -36,11 +36,9 @@
 
 namespace WebKit {
 
-inline WKProcessPool *wrapper(WebProcessPool& processPool)
-{
-    ASSERT([processPool.wrapper() isKindOfClass:[WKProcessPool class]]);
-    return (WKProcessPool *)processPool.wrapper();
-}
+template<> struct WrapperTraits<WebProcessPool> {
+    using WrapperClass = WKProcessPool;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKSecurityOriginInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKSecurityOriginInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKSecurityOriginInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -29,13 +29,11 @@
 
 #import "APISecurityOrigin.h"
 
-namespace API {
+namespace WebKit {
 
-inline WKSecurityOrigin *wrapper(API::SecurityOrigin& securityOrigin)
-{
-    ASSERT([securityOrigin.wrapper() isKindOfClass:[WKSecurityOrigin self]]);
-    return (WKSecurityOrigin *)securityOrigin.wrapper();
-}
+template<> struct WrapperTraits<API::SecurityOrigin> {
+    using WrapperClass = WKSecurityOrigin;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserContentControllerInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserContentControllerInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserContentControllerInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,16 +32,12 @@
 
 namespace WebKit {
 
-class WebUserContentControllerProxy;
+template<> struct WrapperTraits<WebUserContentControllerProxy> {
+    using WrapperClass = WKUserContentController;
+};
 
-inline WKUserContentController *wrapper(WebUserContentControllerProxy& userContentController)
-{
-    ASSERT([userContentController.wrapper() isKindOfClass:[WKUserContentController class]]);
-    return (WKUserContentController *)userContentController.wrapper();
 }
 
-}
-
 @interface WKUserContentController () <WKObject> {
 @package
     API::ObjectStorage<WebKit::WebUserContentControllerProxy> _userContentControllerProxy;

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserScriptInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserScriptInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserScriptInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -29,14 +29,16 @@
 
 #import "APIUserScript.h"
 
-namespace API {
+namespace WebKit {
 
-inline WKUserScript *wrapper(UserScript& userScript)
-{
-    ASSERT([userScript.wrapper() isKindOfClass:[WKUserScript class]]);
-    return (WKUserScript *)userScript.wrapper();
+template<> struct WrapperTraits<API::UserScript> {
+    using WrapperClass = WKUserScript;
+};
+
 }
 
+namespace API {
+
 inline WebCore::UserScriptInjectionTime toWebCoreUserScriptInjectionTime(WKUserScriptInjectionTime injectionTime)
 {
     switch (injectionTime) {

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -34,11 +34,9 @@
 
 namespace WebKit {
 
-inline WKWebsiteDataRecord *wrapper(API::WebsiteDataRecord& websiteDataRecord)
-{
-    ASSERT([websiteDataRecord.wrapper() isKindOfClass:[WKWebsiteDataRecord class]]);
-    return (WKWebsiteDataRecord *)websiteDataRecord.wrapper();
-}
+template<> struct WrapperTraits<API::WebsiteDataRecord> {
+    using WrapperClass = WKWebsiteDataRecord;
+};
 
 static inline std::optional<WebsiteDataType> toWebsiteDataType(NSString *websiteDataType)
 {

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline WKWebsiteDataStore *wrapper(API::WebsiteDataStore& websiteDataStore)
-{
-    ASSERT([websiteDataStore.wrapper() isKindOfClass:[WKWebsiteDataStore class]]);
-    return (WKWebsiteDataStore *)websiteDataStore.wrapper();
-}
+template<> struct WrapperTraits<API::WebsiteDataStore> {
+    using WrapperClass = WKWebsiteDataStore;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWindowFeaturesInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWindowFeaturesInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWindowFeaturesInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,14 +32,12 @@
 
 namespace WebKit {
 
-inline WKWindowFeatures *wrapper(API::WindowFeatures& windowFeatures)
-{
-    ASSERT([windowFeatures.wrapper() isKindOfClass:[WKWindowFeatures class]]);
+template<> struct WrapperTraits<API::WindowFeatures> {
+    using WrapperClass = WKWindowFeatures;
+};
 
-    return (WKWindowFeatures *)windowFeatures.wrapper();
 }
 
-}
 @interface WKWindowFeatures () <WKObject> {
 @package
     API::ObjectStorage<API::WindowFeatures> _windowFeatures;

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifestInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifestInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifestInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -23,8 +23,6 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#pragma once
-
 #import <WebKit/WKFoundation.h>
 
 #if WK_API_ENABLED
@@ -31,17 +29,15 @@
 
 #import "APIApplicationManifest.h"
 #import "_WKApplicationManifest.h"
-#import <WebCore/ApplicationManifest.h>
 
 #if ENABLE(APPLICATION_MANIFEST)
-namespace API {
 
-inline _WKApplicationManifest *wrapper(API::ApplicationManifest& applicationManifest)
-{
-    ASSERT([applicationManifest.wrapper() isKindOfClass:[_WKApplicationManifest class]]);
-    return (_WKApplicationManifest *)applicationManifest.wrapper();
-}
+namespace WebKit {
 
+template<> struct WrapperTraits<API::ApplicationManifest> {
+    using WrapperClass = _WKApplicationManifest;
+};
+
 }
 
 @interface _WKApplicationManifest () <WKObject> {

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAttachmentInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAttachmentInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAttachmentInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -23,18 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#pragma once
-
 #import "APIAttachment.h"
 #import "_WKAttachment.h"
 
-namespace API {
+namespace WebKit {
 
-inline _WKAttachment *wrapper(API::Attachment& attachment)
-{
-    ASSERT([attachment.wrapper() isKindOfClass:[_WKAttachment class]]);
-    return (_WKAttachment *)attachment.wrapper();
-}
+template<> struct WrapperTraits<API::Attachment> {
+    using WrapperClass = _WKAttachment;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,10 +30,12 @@
 #import "WKObject.h"
 #import "WebAutomationSession.h"
 
-inline _WKAutomationSession *wrapper(WebKit::WebAutomationSession& session)
-{
-    ASSERT([session.wrapper() isKindOfClass:[_WKAutomationSession class]]);
-    return (_WKAutomationSession *)session.wrapper();
+namespace WebKit {
+
+template<> struct WrapperTraits<WebAutomationSession> {
+    using WrapperClass = _WKAutomationSession;
+};
+
 }
 
 @interface _WKAutomationSession () <WKObject> {

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKExperimentalFeatureInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKExperimentalFeatureInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKExperimentalFeatureInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline _WKExperimentalFeature *wrapper(API::ExperimentalFeature& experimentalFeature)
-{
-    ASSERT([experimentalFeature.wrapper() isKindOfClass:[_WKExperimentalFeature class]]);
-    return (_WKExperimentalFeature *)experimentalFeature.wrapper();
-}
+template<> struct WrapperTraits<API::ExperimentalFeature> {
+    using WrapperClass = _WKExperimentalFeature;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKGeolocationPositionInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKGeolocationPositionInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKGeolocationPositionInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,11 +31,9 @@
 
 namespace WebKit {
 
-inline _WKGeolocationPosition *wrapper(WebKit::WebGeolocationPosition &position)
-{
-    ASSERT([position.wrapper() isKindOfClass:[_WKGeolocationPosition class]]);
-    return (_WKGeolocationPosition *)position.wrapper();
-}
+template<> struct WrapperTraits<WebGeolocationPosition> {
+    using WrapperClass = _WKGeolocationPosition;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfigurationInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfigurationInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfigurationInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,13 +30,11 @@
 #import "APIProcessPoolConfiguration.h"
 #import "WKObject.h"
 
-namespace API {
+namespace WebKit {
 
-inline _WKProcessPoolConfiguration *wrapper(API::ProcessPoolConfiguration& processPoolConfiguration)
-{
-    ASSERT([processPoolConfiguration.wrapper() isKindOfClass:[_WKProcessPoolConfiguration class]]);
-    return (_WKProcessPoolConfiguration *)processPoolConfiguration.wrapper();
-}
+template<> struct WrapperTraits<API::ProcessPoolConfiguration> {
+    using WrapperClass = _WKProcessPoolConfiguration;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentWorldInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentWorldInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentWorldInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,14 +32,16 @@
 #import <wtf/Vector.h>
 #import <wtf/text/WTFString.h>
 
-namespace API {
+namespace WebKit {
 
-inline _WKUserContentWorld *wrapper(UserContentWorld& userContentWorld)
-{
-    ASSERT([userContentWorld.wrapper() isKindOfClass:[_WKUserContentWorld class]]);
-    return (_WKUserContentWorld *)userContentWorld.wrapper();
+template<> struct WrapperTraits<API::UserContentWorld> {
+    using WrapperClass = _WKUserContentWorld;
+};
+
 }
 
+namespace API {
+
 inline Vector<WTF::String> toStringVector(NSArray *input)
 {
     Vector<WTF::String> vector;

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserInitiatedActionInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserInitiatedActionInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserInitiatedActionInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -29,15 +29,12 @@
 
 #import "APIUserInitiatedAction.h"
 #import "WKObject.h"
-#import <wtf/text/WTFString.h>
 
-namespace API {
+namespace WebKit {
 
-inline _WKUserInitiatedAction *wrapper(UserInitiatedAction& userInitiatedAction)
-{
-    ASSERT([userInitiatedAction.wrapper() isKindOfClass:[_WKUserInitiatedAction class]]);
-    return (_WKUserInitiatedAction *)userInitiatedAction.wrapper();
-}
+template<> struct WrapperTraits<API::UserInitiatedAction> {
+    using WrapperClass = _WKUserInitiatedAction;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserStyleSheetInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserStyleSheetInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserStyleSheetInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -29,13 +29,11 @@
 
 #import "APIUserStyleSheet.h"
 
-namespace API {
+namespace WebKit {
 
-inline _WKUserStyleSheet *wrapper(UserStyleSheet& userStyleSheet)
-{
-    ASSERT([userStyleSheet.wrapper() isKindOfClass:[_WKUserStyleSheet class]]);
-    return (_WKUserStyleSheet *)userStyleSheet.wrapper();
-}
+template<> struct WrapperTraits<API::UserStyleSheet> {
+    using WrapperClass = _WKUserStyleSheet;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKVisitedLinkStoreInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKVisitedLinkStoreInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKVisitedLinkStoreInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline _WKVisitedLinkStore *wrapper(VisitedLinkStore& visitedLinkStore)
-{
-    ASSERT([visitedLinkStore.wrapper() isKindOfClass:[_WKVisitedLinkStore class]]);
-    return (_WKVisitedLinkStore *)visitedLinkStore.wrapper();
-}
+template<> struct WrapperTraits<VisitedLinkStore> {
+    using WrapperClass = _WKVisitedLinkStore;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -30,13 +30,11 @@
 #import "APIWebsitePolicies.h"
 #import "WKObject.h"
 
-namespace API {
+namespace WebKit {
 
-inline _WKWebsitePolicies *wrapper(WebsitePolicies& websitePolicies)
-{
-    ASSERT([websitePolicies.wrapper() isKindOfClass:[_WKWebsitePolicies class]]);
-    return (_WKWebsitePolicies *)websitePolicies.wrapper();
-}
+template<> struct WrapperTraits<API::WebsitePolicies> {
+    using WrapperClass = _WKWebsitePolicies;
+};
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm (235018 => 235019)


--- trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -48,11 +48,9 @@
 
 namespace WebKit {
 
-static inline _WKDownload *wrapper(DownloadProxy& download)
-{
-    ASSERT([download.wrapper() isKindOfClass:[_WKDownload class]]);
-    return (_WKDownload *)download.wrapper();
-}
+template<> struct WrapperTraits<DownloadProxy> {
+    using WrapperClass = _WKDownload;
+};
 
 DownloadClient::DownloadClient(id <_WKDownloadDelegate> delegate)
     : m_delegate(delegate)

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrameInternal.h (235018 => 235019)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrameInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrameInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -33,10 +33,10 @@
 
 namespace WebKit {
 
-inline WKWebProcessPlugInFrame *wrapper(WebFrame& frame)
-{
-    ASSERT([frame.wrapper() isKindOfClass:[WKWebProcessPlugInFrame class]]);
-    return (WKWebProcessPlugInFrame *)frame.wrapper(); }
+template<> struct WrapperTraits<WebFrame> {
+    using WrapperClass = WKWebProcessPlugInFrame;
+};
+
 }
 
 @interface WKWebProcessPlugInFrame () <WKObject>

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResultInternal.h (235018 => 235019)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResultInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResultInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline WKWebProcessPlugInHitTestResult *wrapper(InjectedBundleHitTestResult& hitTestResult)
-{
-    ASSERT([hitTestResult.wrapper() isKindOfClass:[WKWebProcessPlugInHitTestResult class]]);
-    return (WKWebProcessPlugInHitTestResult *)hitTestResult.wrapper();
-}
+template<> struct WrapperTraits<InjectedBundleHitTestResult> {
+    using WrapperClass = WKWebProcessPlugInHitTestResult;
+};
 
 }
 

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandleInternal.h (235018 => 235019)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandleInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandleInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline WKWebProcessPlugInNodeHandle *wrapper(InjectedBundleNodeHandle& nodeHandle)
-{
-    ASSERT([nodeHandle.wrapper() isKindOfClass:[WKWebProcessPlugInNodeHandle class]]);
-    return (WKWebProcessPlugInNodeHandle *)nodeHandle.wrapper();
-}
+template<> struct WrapperTraits<InjectedBundleNodeHandle> {
+    using WrapperClass = WKWebProcessPlugInNodeHandle;
+};
 
 }
 

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroupInternal.h (235018 => 235019)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroupInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroupInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,13 +32,11 @@
 
 namespace WebKit {
 
-inline WKWebProcessPlugInPageGroup *wrapper(WebPageGroupProxy& pageGroup)
-{
-    ASSERT([pageGroup.wrapper() isKindOfClass:[WKWebProcessPlugInPageGroup class]]);
-    return (WKWebProcessPlugInPageGroup *)pageGroup.wrapper();
+template<> struct WrapperTraits<WebPageGroupProxy> {
+    using WrapperClass = WKWebProcessPlugInPageGroup;
+};
+
 }
-    
-}
 
 @interface WKWebProcessPlugInPageGroup () <WKObject>
 @end

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h (235018 => 235019)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline WKWebProcessPlugInRangeHandle *wrapper(InjectedBundleRangeHandle& rangeHandle)
-{
-    ASSERT([rangeHandle.wrapper() isKindOfClass:[WKWebProcessPlugInRangeHandle class]]);
-    return (WKWebProcessPlugInRangeHandle *)rangeHandle.wrapper();
-}
+template<> struct WrapperTraits<InjectedBundleRangeHandle> {
+    using WrapperClass = WKWebProcessPlugInRangeHandle;
+};
 
 }
 

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorldInternal.h (235018 => 235019)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorldInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorldInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline WKWebProcessPlugInScriptWorld *wrapper(InjectedBundleScriptWorld& world)
-{
-    ASSERT([world.wrapper() isKindOfClass:[WKWebProcessPlugInScriptWorld class]]);
-    return (WKWebProcessPlugInScriptWorld *)world.wrapper();
-}
+template<> struct WrapperTraits<InjectedBundleScriptWorld> {
+    using WrapperClass = WKWebProcessPlugInScriptWorld;
+};
 
 }
 

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerInternal.h (235018 => 235019)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline WKWebProcessPlugInBrowserContextController *wrapper(WebPage& page)
-{
-    ASSERT([page.wrapper() isKindOfClass:[WKWebProcessPlugInBrowserContextController class]]);
-    return (WKWebProcessPlugInBrowserContextController *)page.wrapper();
-}
+template<> struct WrapperTraits<WebPage> {
+    using WrapperClass = WKWebProcessPlugInBrowserContextController;
+};
 
 }
 

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInInternal.h (235018 => 235019)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInInternal.h	2018-08-19 22:50:05 UTC (rev 235018)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInInternal.h	2018-08-19 22:54:24 UTC (rev 235019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,11 +32,9 @@
 
 namespace WebKit {
 
-inline WKWebProcessPlugInController *wrapper(InjectedBundle& bundle)
-{
-    ASSERT([bundle.wrapper() isKindOfClass:[WKWebProcessPlugInController class]]);
-    return (WKWebProcessPlugInController *)bundle.wrapper();
-}
+template<> struct WrapperTraits<InjectedBundle> {
+    using WrapperClass = WKWebProcessPlugInController;
+};
 
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to