<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[159881] trunk/Source/WebKit2</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/159881">159881</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2013-11-29 18:04:12 -0800 (Fri, 29 Nov 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Cocoa] Add a little template magic to the inline API::Object storage to remove the need for all the reinterpret_casts
https://bugs.webkit.org/show_bug.cgi?id=125024
Reviewed by Dan Bernstein.
Introduce API::ObjectStorage which wraps std::aligned_storage and adds some convenience functions
to reinterpret the data as the corresponding type. Deploy it everywhere we were previously using
std::aligned_storage.
* Shared/Cocoa/WKNSArray.mm:
* Shared/Cocoa/WKNSDictionary.mm:
* Shared/Cocoa/WKObject.h:
* UIProcess/API/Cocoa/WKBackForwardList.mm:
* UIProcess/API/Cocoa/WKBackForwardListItem.mm:
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
* UIProcess/API/Cocoa/WKBrowsingContextGroup.mm:
* UIProcess/API/Cocoa/WKNavigationData.mm:
* UIProcess/API/Cocoa/WKProcessGroup.mm:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedCocoaWKNSArraymm">trunk/Source/WebKit2/Shared/Cocoa/WKNSArray.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedCocoaWKNSDictionarymm">trunk/Source/WebKit2/Shared/Cocoa/WKNSDictionary.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedCocoaWKObjecth">trunk/Source/WebKit2/Shared/Cocoa/WKObject.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKBackForwardListmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardList.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKBackForwardListItemmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardListItem.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKBrowsingContextControllermm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKBrowsingContextGroupmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextGroup.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKNavigationDatamm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationData.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKProcessGroupmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessGroup.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (159880 => 159881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2013-11-30 01:46:44 UTC (rev 159880)
+++ trunk/Source/WebKit2/ChangeLog        2013-11-30 02:04:12 UTC (rev 159881)
</span><span class="lines">@@ -1,5 +1,26 @@
</span><span class="cx"> 2013-11-29 Sam Weinig <sam@webkit.org>
</span><span class="cx">
</span><ins>+ [Cocoa] Add a little template magic to the inline API::Object storage to remove the need for all the reinterpret_casts
+ https://bugs.webkit.org/show_bug.cgi?id=125024
+
+ Reviewed by Dan Bernstein.
+
+ Introduce API::ObjectStorage which wraps std::aligned_storage and adds some convenience functions
+ to reinterpret the data as the corresponding type. Deploy it everywhere we were previously using
+ std::aligned_storage.
+
+ * Shared/Cocoa/WKNSArray.mm:
+ * Shared/Cocoa/WKNSDictionary.mm:
+ * Shared/Cocoa/WKObject.h:
+ * UIProcess/API/Cocoa/WKBackForwardList.mm:
+ * UIProcess/API/Cocoa/WKBackForwardListItem.mm:
+ * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
+ * UIProcess/API/Cocoa/WKBrowsingContextGroup.mm:
+ * UIProcess/API/Cocoa/WKNavigationData.mm:
+ * UIProcess/API/Cocoa/WKProcessGroup.mm:
+
+2013-11-29 Sam Weinig <sam@webkit.org>
+
</ins><span class="cx"> Fix crashing API tests.
</span><span class="cx">
</span><span class="cx"> * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedCocoaWKNSArraymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Cocoa/WKNSArray.mm (159880 => 159881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Cocoa/WKNSArray.mm        2013-11-30 01:46:44 UTC (rev 159880)
+++ trunk/Source/WebKit2/Shared/Cocoa/WKNSArray.mm        2013-11-30 02:04:12 UTC (rev 159881)
</span><span class="lines">@@ -29,12 +29,12 @@
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">
</span><span class="cx"> @implementation WKNSArray {
</span><del>- std::aligned_storage<sizeof(API::Array), std::alignment_of<API::Array>::value>::type _array;
</del><ins>+ API::ObjectStorage<API::Array> _array;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><del>- reinterpret_cast<API::Array*>(&_array)->~Array();
</del><ins>+ _array->~Array();
</ins><span class="cx">
</span><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="lines">@@ -43,12 +43,12 @@
</span><span class="cx">
</span><span class="cx"> - (NSUInteger)count
</span><span class="cx"> {
</span><del>- return reinterpret_cast<API::Array*>(&_array)->size();
</del><ins>+ return _array->size();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (id)objectAtIndex:(NSUInteger)i
</span><span class="cx"> {
</span><del>- API::Object* object = reinterpret_cast<API::Array*>(&_array)->at(i);
</del><ins>+ API::Object* object = _array->at(i);
</ins><span class="cx"> return object ? object->wrapper() : [NSNull null];
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">
</span><span class="cx"> - (API::Object&)_apiObject
</span><span class="cx"> {
</span><del>- return *reinterpret_cast<API::Array*>(&_array);
</del><ins>+ return *_array;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedCocoaWKNSDictionarymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Cocoa/WKNSDictionary.mm (159880 => 159881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Cocoa/WKNSDictionary.mm        2013-11-30 01:46:44 UTC (rev 159880)
+++ trunk/Source/WebKit2/Shared/Cocoa/WKNSDictionary.mm        2013-11-30 02:04:12 UTC (rev 159881)
</span><span class="lines">@@ -33,12 +33,12 @@
</span><span class="cx"> using namespace WebKit;
</span><span class="cx">
</span><span class="cx"> @implementation WKNSDictionary {
</span><del>- std::aligned_storage<sizeof(ImmutableDictionary), std::alignment_of<ImmutableDictionary>::value>::type _dictionary;
</del><ins>+ API::ObjectStorage<ImmutableDictionary> _dictionary;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><del>- reinterpret_cast<ImmutableDictionary*>(&_dictionary)->~ImmutableDictionary();
</del><ins>+ _dictionary->~ImmutableDictionary();
</ins><span class="cx">
</span><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx">
</span><span class="cx"> - (NSUInteger)count
</span><span class="cx"> {
</span><del>- return reinterpret_cast<ImmutableDictionary*>(&_dictionary)->size();
</del><ins>+ return _dictionary->size();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (id)objectForKey:(id)key
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx"> return nil;
</span><span class="cx">
</span><span class="cx"> bool exists;
</span><del>- API::Object* value = reinterpret_cast<ImmutableDictionary*>(&_dictionary)->get((NSString *)key, exists);
</del><ins>+ API::Object* value = _dictionary->get((NSString *)key, exists);
</ins><span class="cx"> if (!exists)
</span><span class="cx"> return nil;
</span><span class="cx">
</span><span class="lines">@@ -71,17 +71,17 @@
</span><span class="cx">
</span><span class="cx"> - (NSEnumerator *)keyEnumerator
</span><span class="cx"> {
</span><del>- return [wrapper(*reinterpret_cast<ImmutableDictionary*>(&_dictionary)->keys()) objectEnumerator];
</del><ins>+ return [wrapper(*_dictionary->keys()) objectEnumerator];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #pragma mark NSCopying protocol implementation
</span><span class="cx">
</span><span class="cx"> - (id)copyWithZone:(NSZone *)zone
</span><span class="cx"> {
</span><del>- if (!reinterpret_cast<ImmutableDictionary*>(&_dictionary)->isMutable())
</del><ins>+ if (!_dictionary->isMutable())
</ins><span class="cx"> return [self retain];
</span><span class="cx">
</span><del>- auto map = reinterpret_cast<ImmutableDictionary*>(&_dictionary)->map();
</del><ins>+ auto map = _dictionary->map();
</ins><span class="cx"> return ImmutableDictionary::adopt(map).leakRef()->wrapper();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx">
</span><span class="cx"> - (API::Object&)_apiObject
</span><span class="cx"> {
</span><del>- return *reinterpret_cast<API::Object*>(&_dictionary);
</del><ins>+ return *_dictionary;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedCocoaWKObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Cocoa/WKObject.h (159880 => 159881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Cocoa/WKObject.h        2013-11-30 01:46:44 UTC (rev 159880)
+++ trunk/Source/WebKit2/Shared/Cocoa/WKObject.h        2013-11-30 02:04:12 UTC (rev 159881)
</span><span class="lines">@@ -27,8 +27,20 @@
</span><span class="cx">
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">
</span><ins>+#import <type_traits>
+
</ins><span class="cx"> namespace API {
</span><span class="cx"> class Object;
</span><ins>+
+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); }
+
+ typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type data;
+};
+
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @protocol WKObject <NSObject>
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKBackForwardListmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardList.mm (159880 => 159881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardList.mm        2013-11-30 01:46:44 UTC (rev 159880)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardList.mm        2013-11-30 02:04:12 UTC (rev 159881)
</span><span class="lines">@@ -34,12 +34,12 @@
</span><span class="cx"> using namespace WebKit;
</span><span class="cx">
</span><span class="cx"> @implementation WKBackForwardList {
</span><del>- std::aligned_storage<sizeof(WebBackForwardList), std::alignment_of<WebBackForwardList>::value>::type _list;
</del><ins>+ API::ObjectStorage<WebBackForwardList> _list;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><del>- reinterpret_cast<WebBackForwardList*>(&_list)->~WebBackForwardList();
</del><ins>+ _list->~WebBackForwardList();
</ins><span class="cx">
</span><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="lines">@@ -54,37 +54,37 @@
</span><span class="cx">
</span><span class="cx"> - (WKBackForwardListItem *)currentItem
</span><span class="cx"> {
</span><del>- return toWKBackForwardListItem(reinterpret_cast<WebBackForwardList*>(&_list)->currentItem());
</del><ins>+ return toWKBackForwardListItem(_list->currentItem());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (WKBackForwardListItem *)backItem
</span><span class="cx"> {
</span><del>- return toWKBackForwardListItem(reinterpret_cast<WebBackForwardList*>(&_list)->backItem());
</del><ins>+ return toWKBackForwardListItem(_list->backItem());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (WKBackForwardListItem *)forwardItem
</span><span class="cx"> {
</span><del>- return toWKBackForwardListItem(reinterpret_cast<WebBackForwardList*>(&_list)->forwardItem());
</del><ins>+ return toWKBackForwardListItem(_list->forwardItem());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (WKBackForwardListItem *)itemAtIndex:(NSInteger)index
</span><span class="cx"> {
</span><del>- return toWKBackForwardListItem(reinterpret_cast<WebBackForwardList*>(&_list)->itemAtIndex(index));
</del><ins>+ return toWKBackForwardListItem(_list->itemAtIndex(index));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSUInteger)backListCount
</span><span class="cx"> {
</span><del>- return reinterpret_cast<WebBackForwardList*>(&_list)->backListCount();
</del><ins>+ return _list->backListCount();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSUInteger)forwardListCount
</span><span class="cx"> {
</span><del>- return reinterpret_cast<WebBackForwardList*>(&_list)->forwardListCount();
</del><ins>+ return _list->forwardListCount();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSArray *)backListWithLimit:(NSUInteger)limit
</span><span class="cx"> {
</span><del>- RefPtr<API::Array> list = reinterpret_cast<WebBackForwardList*>(&_list)->backListAsAPIArrayWithLimit(limit);
</del><ins>+ RefPtr<API::Array> list = _list->backListAsAPIArrayWithLimit(limit);
</ins><span class="cx"> if (!list)
</span><span class="cx"> return nil;
</span><span class="cx">
</span><span class="lines">@@ -93,7 +93,7 @@
</span><span class="cx">
</span><span class="cx"> - (NSArray *)forwardListWithLimit:(NSUInteger)limit
</span><span class="cx"> {
</span><del>- RefPtr<API::Array> list = reinterpret_cast<WebBackForwardList*>(&_list)->forwardListAsAPIArrayWithLimit(limit);
</del><ins>+ RefPtr<API::Array> list = _list->forwardListAsAPIArrayWithLimit(limit);
</ins><span class="cx"> if (!list)
</span><span class="cx"> return nil;
</span><span class="cx">
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">
</span><span class="cx"> - (API::Object&)_apiObject
</span><span class="cx"> {
</span><del>- return *reinterpret_cast<API::Object*>(&_list);
</del><ins>+ return *_list;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKBackForwardListItemmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardListItem.mm (159880 => 159881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardListItem.mm        2013-11-30 01:46:44 UTC (rev 159880)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardListItem.mm        2013-11-30 02:04:12 UTC (rev 159881)
</span><span class="lines">@@ -33,39 +33,39 @@
</span><span class="cx"> using namespace WebKit;
</span><span class="cx">
</span><span class="cx"> @implementation WKBackForwardListItem {
</span><del>- std::aligned_storage<sizeof(WebBackForwardListItem), std::alignment_of<WebBackForwardListItem>::value>::type _item;
</del><ins>+ API::ObjectStorage<WebBackForwardListItem> _item;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><del>- reinterpret_cast<WebBackForwardListItem*>(&_item)->~WebBackForwardListItem();
</del><ins>+ _item->~WebBackForwardListItem();
</ins><span class="cx">
</span><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSURL *)URL
</span><span class="cx"> {
</span><del>- return [NSURL _web_URLWithWTFString:reinterpret_cast<WebBackForwardListItem*>(&_item)->url() relativeToURL:nil];
</del><ins>+ return [NSURL _web_URLWithWTFString:_item->url() relativeToURL:nil];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSString *)title
</span><span class="cx"> {
</span><del>- if (!reinterpret_cast<WebBackForwardListItem*>(&_item)->title())
</del><ins>+ if (!_item->title())
</ins><span class="cx"> return nil;
</span><span class="cx">
</span><del>- return reinterpret_cast<WebBackForwardListItem*>(&_item)->title();
</del><ins>+ return _item->title();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSURL *)originalURL
</span><span class="cx"> {
</span><del>- return [NSURL _web_URLWithWTFString:reinterpret_cast<WebBackForwardListItem*>(&_item)->originalURL() relativeToURL:nil];
</del><ins>+ return [NSURL _web_URLWithWTFString:_item->originalURL() relativeToURL:nil];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #pragma mark WKObject protocol implementation
</span><span class="cx">
</span><span class="cx"> - (API::Object&)_apiObject
</span><span class="cx"> {
</span><del>- return *reinterpret_cast<API::Object*>(&_item);
</del><ins>+ return *_item;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx">
</span><span class="cx"> - (WebKit::WebBackForwardListItem&)_item
</span><span class="cx"> {
</span><del>- return *reinterpret_cast<WebBackForwardListItem*>(&_item);
</del><ins>+ return *_item;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKBrowsingContextControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm (159880 => 159881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm        2013-11-30 01:46:44 UTC (rev 159880)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm        2013-11-30 02:04:12 UTC (rev 159881)
</span><span class="lines">@@ -109,7 +109,7 @@
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @implementation WKBrowsingContextController {
</span><del>- std::aligned_storage<sizeof(WebPageProxy), std::alignment_of<WebPageProxy>::value>::type _page;
</del><ins>+ API::ObjectStorage<WebPageProxy> _page;
</ins><span class="cx"> std::unique_ptr<PageLoadStateObserver> _pageLoadStateObserver;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -118,8 +118,8 @@
</span><span class="cx">
</span><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><del>- reinterpret_cast<WebPageProxy*>(&_page)->pageLoadState().removeObserver(*_pageLoadStateObserver);
- reinterpret_cast<WebPageProxy*>(&_page)->~WebPageProxy();
</del><ins>+ _page->pageLoadState().removeObserver(*_pageLoadStateObserver);
+ _page->~WebPageProxy();
</ins><span class="cx">
</span><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="lines">@@ -127,12 +127,12 @@
</span><span class="cx"> - (void)_finishInitialization
</span><span class="cx"> {
</span><span class="cx"> _pageLoadStateObserver = std::make_unique<PageLoadStateObserver>(self);
</span><del>- reinterpret_cast<WebPageProxy*>(&_page)->pageLoadState().addObserver(*_pageLoadStateObserver);
</del><ins>+ _page->pageLoadState().addObserver(*_pageLoadStateObserver);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (WKProcessGroup *)processGroup
</span><span class="cx"> {
</span><del>- WebContext* context = reinterpret_cast<WebPageProxy*>(&_page)->process()->context();
</del><ins>+ WebContext* context = _page->process()->context();
</ins><span class="cx"> if (!context)
</span><span class="cx"> return nil;
</span><span class="cx"> return wrapper(*context);
</span><span class="lines">@@ -140,7 +140,7 @@
</span><span class="cx">
</span><span class="cx"> - (WKBrowsingContextGroup *)browsingContextGroup
</span><span class="cx"> {
</span><del>- WebPageGroup* pageGroup = reinterpret_cast<WebPageProxy*>(&_page)->pageGroup();
</del><ins>+ WebPageGroup* pageGroup = _page->pageGroup();
</ins><span class="cx"> if (!pageGroup)
</span><span class="cx"> return nil;
</span><span class="cx"> return wrapper(*pageGroup);
</span><span class="lines">@@ -148,7 +148,7 @@
</span><span class="cx">
</span><span class="cx"> - (WKPageRef)_pageRef
</span><span class="cx"> {
</span><del>- return toAPI(reinterpret_cast<WebPageProxy*>(&_page));
</del><ins>+ return toAPI(_page.get());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #pragma mark Loading
</span><span class="lines">@@ -186,7 +186,7 @@
</span><span class="cx"> if (userData)
</span><span class="cx"> wkUserData = ObjCObjectGraph::create(userData);
</span><span class="cx">
</span><del>- WKPageLoadURLRequestWithUserData(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), wkRequest.get(), (WKTypeRef)wkUserData.get());
</del><ins>+ WKPageLoadURLRequestWithUserData(toAPI(_page.get()), wkRequest.get(), (WKTypeRef)wkUserData.get());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)loadFileURL:(NSURL *)URL restrictToFilesWithin:(NSURL *)allowedDirectory
</span><span class="lines">@@ -206,7 +206,7 @@
</span><span class="cx"> if (userData)
</span><span class="cx"> wkUserData = ObjCObjectGraph::create(userData);
</span><span class="cx">
</span><del>- WKPageLoadFileWithUserData(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), wkURL.get(), wkAllowedDirectory.get(), (WKTypeRef)wkUserData.get());
</del><ins>+ WKPageLoadFileWithUserData(toAPI(_page.get()), wkURL.get(), wkAllowedDirectory.get(), (WKTypeRef)wkUserData.get());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)loadHTMLString:(NSString *)HTMLString baseURL:(NSURL *)baseURL
</span><span class="lines">@@ -228,7 +228,7 @@
</span><span class="cx"> if (userData)
</span><span class="cx"> wkUserData = ObjCObjectGraph::create(userData);
</span><span class="cx">
</span><del>- WKPageLoadHTMLStringWithUserData(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), wkHTMLString.get(), wkBaseURL.get(), (WKTypeRef)wkUserData.get());
</del><ins>+ WKPageLoadHTMLStringWithUserData(toAPI(_page.get()), wkHTMLString.get(), wkBaseURL.get(), (WKTypeRef)wkUserData.get());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)loadAlternateHTMLString:(NSString *)string baseURL:(NSURL *)baseURL forUnreachableURL:(NSURL *)unreachableURL
</span><span class="lines">@@ -239,7 +239,7 @@
</span><span class="cx"> CString unreachableURLString;
</span><span class="cx"> getURLBytes((CFURLRef)unreachableURL, unreachableURLString);
</span><span class="cx">
</span><del>- reinterpret_cast<WebPageProxy*>(&_page)->loadAlternateHTMLString(string, String::fromUTF8(baseURLString), String::fromUTF8(unreachableURLString));
</del><ins>+ _page->loadAlternateHTMLString(string, String::fromUTF8(baseURLString), String::fromUTF8(unreachableURLString));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)baseURL
</span><span class="lines">@@ -276,54 +276,54 @@
</span><span class="cx"> if (userData)
</span><span class="cx"> wkUserData = ObjCObjectGraph::create(userData);
</span><span class="cx">
</span><del>- WKPageLoadDataWithUserData(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), toAPI(wkData.get()), wkMIMEType.get(), wkEncodingName.get(), wkBaseURL.get(), (WKTypeRef)wkUserData.get());
</del><ins>+ WKPageLoadDataWithUserData(toAPI(_page.get()), toAPI(wkData.get()), wkMIMEType.get(), wkEncodingName.get(), wkBaseURL.get(), (WKTypeRef)wkUserData.get());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)stopLoading
</span><span class="cx"> {
</span><del>- WKPageStopLoading(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
</del><ins>+ WKPageStopLoading(toAPI(_page.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)reload
</span><span class="cx"> {
</span><del>- WKPageReload(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
</del><ins>+ WKPageReload(toAPI(_page.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)reloadFromOrigin
</span><span class="cx"> {
</span><del>- WKPageReloadFromOrigin(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
</del><ins>+ WKPageReloadFromOrigin(toAPI(_page.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #pragma mark Back/Forward
</span><span class="cx">
</span><span class="cx"> - (void)goForward
</span><span class="cx"> {
</span><del>- WKPageGoForward(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
</del><ins>+ WKPageGoForward(toAPI(_page.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)canGoForward
</span><span class="cx"> {
</span><del>- return WKPageCanGoForward(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
</del><ins>+ return WKPageCanGoForward(toAPI(_page.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)goBack
</span><span class="cx"> {
</span><del>- WKPageGoBack(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
</del><ins>+ WKPageGoBack(toAPI(_page.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)canGoBack
</span><span class="cx"> {
</span><del>- return WKPageCanGoBack(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
</del><ins>+ return WKPageCanGoBack(toAPI(_page.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)goToBackForwardListItem:(WKBackForwardListItem *)item
</span><span class="cx"> {
</span><del>- reinterpret_cast<WebPageProxy*>(&_page)->goToBackForwardItem(&item._item);
</del><ins>+ _page->goToBackForwardItem(&item._item);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (WKBackForwardList *)backForwardList
</span><span class="cx"> {
</span><del>- WebBackForwardList* list = reinterpret_cast<WebPageProxy*>(&_page)->backForwardList();
</del><ins>+ WebBackForwardList* list = _page->backForwardList();
</ins><span class="cx"> if (!list)
</span><span class="cx"> return nil;
</span><span class="cx">
</span><span class="lines">@@ -334,56 +334,56 @@
</span><span class="cx">
</span><span class="cx"> - (NSURL *)activeURL
</span><span class="cx"> {
</span><del>- return autoreleased(WKPageCopyActiveURL(toAPI(reinterpret_cast<WebPageProxy*>(&_page))));
</del><ins>+ return autoreleased(WKPageCopyActiveURL(toAPI(_page.get())));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSURL *)provisionalURL
</span><span class="cx"> {
</span><del>- return autoreleased(WKPageCopyProvisionalURL(toAPI(reinterpret_cast<WebPageProxy*>(&_page))));
</del><ins>+ return autoreleased(WKPageCopyProvisionalURL(toAPI(_page.get())));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSURL *)committedURL
</span><span class="cx"> {
</span><del>- return autoreleased(WKPageCopyCommittedURL(toAPI(reinterpret_cast<WebPageProxy*>(&_page))));
</del><ins>+ return autoreleased(WKPageCopyCommittedURL(toAPI(_page.get())));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSURL *)unreachableURL
</span><span class="cx"> {
</span><del>- return [NSURL _web_URLWithWTFString:reinterpret_cast<WebPageProxy*>(&_page)->pageLoadState().unreachableURL() relativeToURL:nil];
</del><ins>+ return [NSURL _web_URLWithWTFString:_page->pageLoadState().unreachableURL() relativeToURL:nil];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (double)estimatedProgress
</span><span class="cx"> {
</span><del>- return reinterpret_cast<WebPageProxy*>(&_page)->estimatedProgress();
</del><ins>+ return _page->estimatedProgress();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #pragma mark Active Document Introspection
</span><span class="cx">
</span><span class="cx"> - (NSString *)title
</span><span class="cx"> {
</span><del>- return autoreleased(WKPageCopyTitle(toAPI(reinterpret_cast<WebPageProxy*>(&_page))));
</del><ins>+ return autoreleased(WKPageCopyTitle(toAPI(_page.get())));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #pragma mark Zoom
</span><span class="cx">
</span><span class="cx"> - (CGFloat)textZoom
</span><span class="cx"> {
</span><del>- return WKPageGetTextZoomFactor(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
</del><ins>+ return WKPageGetTextZoomFactor(toAPI(_page.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setTextZoom:(CGFloat)textZoom
</span><span class="cx"> {
</span><del>- return WKPageSetTextZoomFactor(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), textZoom);
</del><ins>+ return WKPageSetTextZoomFactor(toAPI(_page.get()), textZoom);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (CGFloat)pageZoom
</span><span class="cx"> {
</span><del>- return WKPageGetPageZoomFactor(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
</del><ins>+ return WKPageGetPageZoomFactor(toAPI(_page.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setPageZoom:(CGFloat)pageZoom
</span><span class="cx"> {
</span><del>- return WKPageSetPageZoomFactor(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), pageZoom);
</del><ins>+ return WKPageSetPageZoomFactor(toAPI(_page.get()), pageZoom);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static NSError *createErrorWithRecoveryAttempter(WKErrorRef wkError, WKFrameRef frame, WKBrowsingContextController *browsingContext)
</span><span class="lines">@@ -617,9 +617,9 @@
</span><span class="cx"> {
</span><span class="cx"> _loadDelegate = loadDelegate;
</span><span class="cx"> if (_loadDelegate)
</span><del>- setUpPageLoaderClient(self, toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
</del><ins>+ setUpPageLoaderClient(self, toAPI(_page.get()));
</ins><span class="cx"> else
</span><del>- WKPageSetPageLoaderClient(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), nullptr);;
</del><ins>+ WKPageSetPageLoaderClient(toAPI(_page.get()), nullptr);;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (id <WKBrowsingContextPolicyDelegate>)policyDelegate
</span><span class="lines">@@ -631,9 +631,9 @@
</span><span class="cx"> {
</span><span class="cx"> _policyDelegate = policyDelegate;
</span><span class="cx"> if (_policyDelegate)
</span><del>- setUpPagePolicyClient(self, toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
</del><ins>+ setUpPagePolicyClient(self, toAPI(_page.get()));
</ins><span class="cx"> else
</span><del>- WKPageSetPagePolicyClient(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), nullptr);;
</del><ins>+ WKPageSetPagePolicyClient(toAPI(_page.get()), nullptr);;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> + (NSMutableSet *)customSchemes
</span><span class="lines">@@ -699,12 +699,12 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- WKPageSetPaginationMode(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), mode);
</del><ins>+ WKPageSetPaginationMode(toAPI(_page.get()), mode);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (WKBrowsingContextPaginationMode)paginationMode
</span><span class="cx"> {
</span><del>- switch (WKPageGetPaginationMode(toAPI(reinterpret_cast<WebPageProxy*>(&_page)))) {
</del><ins>+ switch (WKPageGetPaginationMode(toAPI(_page.get()))) {
</ins><span class="cx"> case kWKPaginationModeUnpaginated:
</span><span class="cx"> return WKPaginationModeUnpaginated;
</span><span class="cx"> case kWKPaginationModeLeftToRight:
</span><span class="lines">@@ -723,42 +723,42 @@
</span><span class="cx">
</span><span class="cx"> - (void)setPaginationBehavesLikeColumns:(BOOL)behavesLikeColumns
</span><span class="cx"> {
</span><del>- WKPageSetPaginationBehavesLikeColumns(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), behavesLikeColumns);
</del><ins>+ WKPageSetPaginationBehavesLikeColumns(toAPI(_page.get()), behavesLikeColumns);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)paginationBehavesLikeColumns
</span><span class="cx"> {
</span><del>- return WKPageGetPaginationBehavesLikeColumns(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
</del><ins>+ return WKPageGetPaginationBehavesLikeColumns(toAPI(_page.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setPageLength:(CGFloat)pageLength
</span><span class="cx"> {
</span><del>- WKPageSetPageLength(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), pageLength);
</del><ins>+ WKPageSetPageLength(toAPI(_page.get()), pageLength);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (CGFloat)pageLength
</span><span class="cx"> {
</span><del>- return WKPageGetPageLength(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
</del><ins>+ return WKPageGetPageLength(toAPI(_page.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setGapBetweenPages:(CGFloat)gapBetweenPages
</span><span class="cx"> {
</span><del>- WKPageSetGapBetweenPages(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), gapBetweenPages);
</del><ins>+ WKPageSetGapBetweenPages(toAPI(_page.get()), gapBetweenPages);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (CGFloat)gapBetweenPages
</span><span class="cx"> {
</span><del>- return WKPageGetGapBetweenPages(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
</del><ins>+ return WKPageGetGapBetweenPages(toAPI(_page.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSUInteger)pageCount
</span><span class="cx"> {
</span><del>- return WKPageGetPageCount(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
</del><ins>+ return WKPageGetPageCount(toAPI(_page.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (WKBrowsingContextHandle *)handle
</span><span class="cx"> {
</span><del>- return [[[WKBrowsingContextHandle alloc] _initWithPageID:reinterpret_cast<WebPageProxy*>(&_page)->pageID()] autorelease];
</del><ins>+ return [[[WKBrowsingContextHandle alloc] _initWithPageID:_page->pageID()] autorelease];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKBrowsingContextGroupmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextGroup.mm (159880 => 159881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextGroup.mm        2013-11-30 01:46:44 UTC (rev 159880)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextGroup.mm        2013-11-30 02:04:12 UTC (rev 159881)
</span><span class="lines">@@ -44,12 +44,12 @@
</span><span class="cx"> using namespace WebKit;
</span><span class="cx">
</span><span class="cx"> @implementation WKBrowsingContextGroup {
</span><del>- std::aligned_storage<sizeof(WebPageGroup), std::alignment_of<WebPageGroup>::value>::type _pageGroup;
</del><ins>+ API::ObjectStorage<WebPageGroup> _pageGroup;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><del>- reinterpret_cast<WebPageGroup*>(&_pageGroup)->~WebPageGroup();
</del><ins>+ _pageGroup->~WebPageGroup();
</ins><span class="cx">
</span><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="lines">@@ -66,39 +66,39 @@
</span><span class="cx"> // don't get automatically written to the disk. The automatic writing has proven
</span><span class="cx"> // confusing to users of the API.
</span><span class="cx"> WKRetainPtr<WKPreferencesRef> preferences = adoptWK(WKPreferencesCreate());
</span><del>- WKPageGroupSetPreferences(toAPI(reinterpret_cast<WebPageGroup*>(&_pageGroup)), preferences.get());
</del><ins>+ WKPageGroupSetPreferences(toAPI(_pageGroup.get()), preferences.get());
</ins><span class="cx">
</span><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)allowsJavaScript
</span><span class="cx"> {
</span><del>- return WKPreferencesGetJavaScriptEnabled(WKPageGroupGetPreferences(toAPI(reinterpret_cast<WebPageGroup*>(&_pageGroup))));
</del><ins>+ return WKPreferencesGetJavaScriptEnabled(WKPageGroupGetPreferences(toAPI(_pageGroup.get())));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setAllowsJavaScript:(BOOL)allowsJavaScript
</span><span class="cx"> {
</span><del>- WKPreferencesSetJavaScriptEnabled(WKPageGroupGetPreferences(toAPI(reinterpret_cast<WebPageGroup*>(&_pageGroup))), allowsJavaScript);
</del><ins>+ WKPreferencesSetJavaScriptEnabled(WKPageGroupGetPreferences(toAPI(_pageGroup.get())), allowsJavaScript);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)allowsJavaScriptMarkup
</span><span class="cx"> {
</span><del>- return WKPreferencesGetJavaScriptMarkupEnabled(WKPageGroupGetPreferences(toAPI(reinterpret_cast<WebPageGroup*>(&_pageGroup))));
</del><ins>+ return WKPreferencesGetJavaScriptMarkupEnabled(WKPageGroupGetPreferences(toAPI(_pageGroup.get())));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setAllowsJavaScriptMarkup:(BOOL)allowsJavaScriptMarkup
</span><span class="cx"> {
</span><del>- WKPreferencesSetJavaScriptMarkupEnabled(WKPageGroupGetPreferences(toAPI(reinterpret_cast<WebPageGroup*>(&_pageGroup))), allowsJavaScriptMarkup);
</del><ins>+ WKPreferencesSetJavaScriptMarkupEnabled(WKPageGroupGetPreferences(toAPI(_pageGroup.get())), allowsJavaScriptMarkup);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)allowsPlugIns
</span><span class="cx"> {
</span><del>- return WKPreferencesGetPluginsEnabled(WKPageGroupGetPreferences(toAPI(reinterpret_cast<WebPageGroup*>(&_pageGroup))));
</del><ins>+ return WKPreferencesGetPluginsEnabled(WKPageGroupGetPreferences(toAPI(_pageGroup.get())));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setAllowsPlugIns:(BOOL)allowsPlugIns
</span><span class="cx"> {
</span><del>- WKPreferencesSetPluginsEnabled(WKPageGroupGetPreferences(toAPI(reinterpret_cast<WebPageGroup*>(&_pageGroup))), allowsPlugIns);
</del><ins>+ WKPreferencesSetPluginsEnabled(WKPageGroupGetPreferences(toAPI(_pageGroup.get())), allowsPlugIns);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static WKRetainPtr<WKArrayRef> createWKArray(NSArray *array)
</span><span class="lines">@@ -130,12 +130,12 @@
</span><span class="cx"> auto wkBlacklist = createWKArray(blacklist);
</span><span class="cx"> WKUserContentInjectedFrames injectedFrames = mainFrameOnly ? kWKInjectInTopFrameOnly : kWKInjectInAllFrames;
</span><span class="cx">
</span><del>- WKPageGroupAddUserStyleSheet(toAPI(reinterpret_cast<WebPageGroup*>(&_pageGroup)), wkSource.get(), wkBaseURL.get(), wkWhitelist.get(), wkBlacklist.get(), injectedFrames);
</del><ins>+ WKPageGroupAddUserStyleSheet(toAPI(_pageGroup.get()), wkSource.get(), wkBaseURL.get(), wkWhitelist.get(), wkBlacklist.get(), injectedFrames);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)removeAllUserStyleSheets
</span><span class="cx"> {
</span><del>- WKPageGroupRemoveAllUserStyleSheets(toAPI(reinterpret_cast<WebPageGroup*>(&_pageGroup)));
</del><ins>+ WKPageGroupRemoveAllUserStyleSheets(toAPI(_pageGroup.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)addUserScript:(NSString *)source baseURL:(NSURL *)baseURL whitelistedURLPatterns:(NSArray *)whitelist blacklistedURLPatterns:(NSArray *)blacklist injectionTime:(WKUserScriptInjectionTime)injectionTime mainFrameOnly:(BOOL)mainFrameOnly
</span><span class="lines">@@ -149,19 +149,19 @@
</span><span class="cx"> auto wkBlacklist = createWKArray(blacklist);
</span><span class="cx"> WKUserContentInjectedFrames injectedFrames = mainFrameOnly ? kWKInjectInTopFrameOnly : kWKInjectInAllFrames;
</span><span class="cx">
</span><del>- WKPageGroupAddUserScript(toAPI(reinterpret_cast<WebPageGroup*>(&_pageGroup)), wkSource.get(), wkBaseURL.get(), wkWhitelist.get(), wkBlacklist.get(), injectedFrames, injectionTime);
</del><ins>+ WKPageGroupAddUserScript(toAPI(_pageGroup.get()), wkSource.get(), wkBaseURL.get(), wkWhitelist.get(), wkBlacklist.get(), injectedFrames, injectionTime);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)removeAllUserScripts
</span><span class="cx"> {
</span><del>- WKPageGroupRemoveAllUserScripts(toAPI(reinterpret_cast<WebPageGroup*>(&_pageGroup)));
</del><ins>+ WKPageGroupRemoveAllUserScripts(toAPI(_pageGroup.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #pragma mark WKObject protocol implementation
</span><span class="cx">
</span><span class="cx"> - (API::Object&)_apiObject
</span><span class="cx"> {
</span><del>- return *reinterpret_cast<API::Object*>(&_pageGroup);
</del><ins>+ return *_pageGroup;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="lines">@@ -170,7 +170,7 @@
</span><span class="cx">
</span><span class="cx"> - (WKPageGroupRef)_pageGroupRef
</span><span class="cx"> {
</span><del>- return toAPI(reinterpret_cast<WebPageGroup*>(&_pageGroup));
</del><ins>+ return toAPI(_pageGroup.get());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKNavigationDatamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationData.mm (159880 => 159881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationData.mm        2013-11-30 01:46:44 UTC (rev 159880)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationData.mm        2013-11-30 02:04:12 UTC (rev 159881)
</span><span class="lines">@@ -35,41 +35,41 @@
</span><span class="cx"> using namespace WebKit;
</span><span class="cx">
</span><span class="cx"> @implementation WKNavigationData {
</span><del>- std::aligned_storage<sizeof(API::NavigationData), std::alignment_of<API::NavigationData>::value>::type _data;
</del><ins>+ API::ObjectStorage<API::NavigationData> _data;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><del>- reinterpret_cast<API::NavigationData*>(&_data)->~NavigationData();
</del><ins>+ _data->~NavigationData();
</ins><span class="cx">
</span><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSString *)title
</span><span class="cx"> {
</span><del>- return reinterpret_cast<API::NavigationData*>(&_data)->title();
</del><ins>+ return _data->title();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSURLRequest *)originalRequest
</span><span class="cx"> {
</span><del>- return reinterpret_cast<API::NavigationData*>(&_data)->originalRequest().nsURLRequest(WebCore::DoNotUpdateHTTPBody);
</del><ins>+ return _data->originalRequest().nsURLRequest(WebCore::DoNotUpdateHTTPBody);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSURL *)destinationURL
</span><span class="cx"> {
</span><del>- return [NSURL _web_URLWithWTFString:reinterpret_cast<API::NavigationData*>(&_data)->url() relativeToURL:nil];
</del><ins>+ return [NSURL _web_URLWithWTFString:_data->url() relativeToURL:nil];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSURLResponse *)response
</span><span class="cx"> {
</span><del>- return reinterpret_cast<API::NavigationData*>(&_data)->response().nsURLResponse();
</del><ins>+ return _data->response().nsURLResponse();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #pragma mark WKObject protocol implementation
</span><span class="cx">
</span><span class="cx"> - (API::Object&)_apiObject
</span><span class="cx"> {
</span><del>- return *reinterpret_cast<API::Object*>(&_data);
</del><ins>+ return *_data;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKProcessGroupmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessGroup.mm (159880 => 159881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessGroup.mm        2013-11-30 01:46:44 UTC (rev 159880)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessGroup.mm        2013-11-30 02:04:12 UTC (rev 159881)
</span><span class="lines">@@ -52,13 +52,20 @@
</span><span class="cx"> using namespace WebKit;
</span><span class="cx">
</span><span class="cx"> @implementation WKProcessGroup {
</span><del>- std::aligned_storage<sizeof(WebContext), std::alignment_of<WebContext>::value>::type _context;
</del><ins>+ API::ObjectStorage<WebContext> _context;
</ins><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> RetainPtr<WKGeolocationProviderIOS> _geolocationProvider;
</span><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (void)dealloc
+{
+ _context->~WebContext();
+
+ [super dealloc];
+}
+
</ins><span class="cx"> static void didCreateConnection(WKContextRef, WKConnectionRef connectionRef, const void* clientInfo)
</span><span class="cx"> {
</span><span class="cx"> WKProcessGroup *processGroup = (WKProcessGroup *)clientInfo;
</span><span class="lines">@@ -177,25 +184,18 @@
</span><span class="cx">
</span><span class="cx"> API::Object::constructInWrapper<WebContext>(self, bundleURL ? String([bundleURL path]) : String());
</span><span class="cx">
</span><del>- setUpConnectionClient(self, toAPI(reinterpret_cast<WebContext*>(&_context)));
- setUpInectedBundleClient(self, toAPI(reinterpret_cast<WebContext*>(&_context)));
- setUpHistoryClient(self, toAPI(reinterpret_cast<WebContext*>(&_context)));
</del><ins>+ setUpConnectionClient(self, toAPI(_context.get()));
+ setUpInectedBundleClient(self, toAPI(_context.get()));
+ setUpHistoryClient(self, toAPI(_context.get()));
</ins><span class="cx">
</span><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)dealloc
-{
- reinterpret_cast<WebContext*>(&_context)->~WebContext();
-
- [super dealloc];
-}
-
</del><span class="cx"> #pragma mark WKObject protocol implementation
</span><span class="cx">
</span><span class="cx"> - (API::Object&)_apiObject
</span><span class="cx"> {
</span><del>- return *reinterpret_cast<API::Object*>(&_context);
</del><ins>+ return *_context;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="lines">@@ -204,14 +204,14 @@
</span><span class="cx">
</span><span class="cx"> - (WKContextRef)_contextRef
</span><span class="cx"> {
</span><del>- return toAPI(reinterpret_cast<WebContext*>(&_context));
</del><ins>+ return toAPI(_context.get());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> - (WKGeolocationProviderIOS *)_geolocationProvider
</span><span class="cx"> {
</span><span class="cx"> if (!_geolocationProvider)
</span><del>- _geolocationProvider = adoptNS([[WKGeolocationProviderIOS alloc] initWithContext:reinterpret_cast<WebContext*>(&_context)]);
</del><ins>+ _geolocationProvider = adoptNS([[WKGeolocationProviderIOS alloc] initWithContext:_context.get()]);
</ins><span class="cx"> return _geolocationProvider.get();
</span><span class="cx"> }
</span><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre>
</div>
</div>
</body>
</html>