<!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>[180585] 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/180585">180585</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2015-02-24 14:40:30 -0800 (Tue, 24 Feb 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Pass _WKWebsiteDataRecord objects to the fetchData completion handler
https://bugs.webkit.org/show_bug.cgi?id=141984
Reviewed by Andreas Kling.
* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
Create _WKWebsiteDataRecord objects for WebsiteDataRecord API objects.
* UIProcess/API/APIWebsiteDataRecord.h:
Add WebsiteDataRecord getter.
* UIProcess/API/Cocoa/_WKWebsiteDataRecord.h:
Add displayName and dataTypes properties.
* UIProcess/API/Cocoa/_WKWebsiteDataRecord.mm:
(dataTypesToString):
Helper function to convert dataTypes bit-fields to strings.
(-[_WKWebsiteDataRecord description]):
Include the display name and data types in the description.
(-[_WKWebsiteDataRecord displayName]):
Return the display name.
(-[_WKWebsiteDataRecord dataTypes]):
Return the data types.
* UIProcess/API/Cocoa/_WKWebsiteDataRecordInternal.h:
(WebKit::toWebsiteDataTypes):
Move this here from _WKWebsiteDataStore.mm.
(WebKit::toWKWebsiteDataTypes):
Add new function to convert WebsiteDataTypes to WKWebsiteDataTypes.
* UIProcess/API/Cocoa/_WKWebsiteDataStore.mm:
(-[_WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:]):
(-[_WKWebsiteDataStore removeDataOfTypes:modifiedSince:completionHandler:]):
Qualify toWebsiteDataTypes calls.
* UIProcess/WebsiteData/WebsiteDataRecord.cpp: Added.
(WebKit::WebsiteDataRecord::displayNameForOrigin):
New helper that returns a display name given an origin.
(WebKit::WebsiteDataRecord::add):
Add the origin as well as the type.
* UIProcess/WebsiteData/WebsiteDataRecord.h:
Add new members.
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::fetchData):
Loop through the entries and add them to the m_websiteDataRecords hash map, which
is keyed off of the display name. Pass the m_websiteDataRecords values to the completion handler.
* WebKit2.xcodeproj/project.pbxproj:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedCocoaAPIObjectmm">trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIWebsiteDataRecordh">trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataRecord.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKWebsiteDataRecordh">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecord.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKWebsiteDataRecordmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecord.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKWebsiteDataRecordInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecordInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKWebsiteDataStoremm">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataRecordh">trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataStorecpp">trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataRecordcpp">trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (180584 => 180585)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-02-24 22:29:50 UTC (rev 180584)
+++ trunk/Source/WebKit2/ChangeLog        2015-02-24 22:40:30 UTC (rev 180585)
</span><span class="lines">@@ -1,3 +1,62 @@
</span><ins>+2015-02-24 Anders Carlsson <andersca@apple.com>
+
+ Pass _WKWebsiteDataRecord objects to the fetchData completion handler
+ https://bugs.webkit.org/show_bug.cgi?id=141984
+
+ Reviewed by Andreas Kling.
+
+ * Shared/Cocoa/APIObject.mm:
+ (API::Object::newObject):
+ Create _WKWebsiteDataRecord objects for WebsiteDataRecord API objects.
+
+ * UIProcess/API/APIWebsiteDataRecord.h:
+ Add WebsiteDataRecord getter.
+
+ * UIProcess/API/Cocoa/_WKWebsiteDataRecord.h:
+ Add displayName and dataTypes properties.
+
+ * UIProcess/API/Cocoa/_WKWebsiteDataRecord.mm:
+ (dataTypesToString):
+ Helper function to convert dataTypes bit-fields to strings.
+
+ (-[_WKWebsiteDataRecord description]):
+ Include the display name and data types in the description.
+
+ (-[_WKWebsiteDataRecord displayName]):
+ Return the display name.
+
+ (-[_WKWebsiteDataRecord dataTypes]):
+ Return the data types.
+
+ * UIProcess/API/Cocoa/_WKWebsiteDataRecordInternal.h:
+ (WebKit::toWebsiteDataTypes):
+ Move this here from _WKWebsiteDataStore.mm.
+
+ (WebKit::toWKWebsiteDataTypes):
+ Add new function to convert WebsiteDataTypes to WKWebsiteDataTypes.
+
+ * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm:
+ (-[_WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:]):
+ (-[_WKWebsiteDataStore removeDataOfTypes:modifiedSince:completionHandler:]):
+ Qualify toWebsiteDataTypes calls.
+
+ * UIProcess/WebsiteData/WebsiteDataRecord.cpp: Added.
+ (WebKit::WebsiteDataRecord::displayNameForOrigin):
+ New helper that returns a display name given an origin.
+
+ (WebKit::WebsiteDataRecord::add):
+ Add the origin as well as the type.
+
+ * UIProcess/WebsiteData/WebsiteDataRecord.h:
+ Add new members.
+
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::fetchData):
+ Loop through the entries and add them to the m_websiteDataRecords hash map, which
+ is keyed off of the display name. Pass the m_websiteDataRecords values to the completion handler.
+
+ * WebKit2.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2015-02-24 Csaba Osztrogonác <ossy@webkit.org>
</span><span class="cx">
</span><span class="cx"> One more buildfix after r180575.
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedCocoaAPIObjectmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm (180584 => 180585)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm        2015-02-24 22:29:50 UTC (rev 180584)
+++ trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm        2015-02-24 22:40:30 UTC (rev 180585)
</span><span class="lines">@@ -61,6 +61,7 @@
</span><span class="cx"> #import "_WKFrameHandleInternal.h"
</span><span class="cx"> #import "_WKProcessPoolConfigurationInternal.h"
</span><span class="cx"> #import "_WKVisitedLinkProviderInternal.h"
</span><ins>+#import "_WKWebsiteDataRecordInternal.h"
</ins><span class="cx"> #import "_WKWebsiteDataStoreInternal.h"
</span><span class="cx"> #import <objc/objc-auto.h>
</span><span class="cx">
</span><span class="lines">@@ -193,6 +194,10 @@
</span><span class="cx"> wrapper = [_WKVisitedLinkProvider alloc];
</span><span class="cx"> break;
</span><span class="cx">
</span><ins>+ case Type::WebsiteDataRecord:
+ wrapper = [_WKWebsiteDataRecord alloc];
+ break;
+
</ins><span class="cx"> case Type::WebsiteDataStore:
</span><span class="cx"> wrapper = [_WKWebsiteDataStore alloc];
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIWebsiteDataRecordh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataRecord.h (180584 => 180585)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataRecord.h        2015-02-24 22:29:50 UTC (rev 180584)
+++ trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataRecord.h        2015-02-24 22:40:30 UTC (rev 180585)
</span><span class="lines">@@ -36,6 +36,8 @@
</span><span class="cx"> static Ref<WebsiteDataRecord> create(WebKit::WebsiteDataRecord&&);
</span><span class="cx"> virtual ~WebsiteDataRecord();
</span><span class="cx">
</span><ins>+ const WebKit::WebsiteDataRecord& websiteDataRecord() const { return m_websiteDataRecord; }
+
</ins><span class="cx"> private:
</span><span class="cx"> explicit WebsiteDataRecord(WebKit::WebsiteDataRecord&&);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKWebsiteDataRecordh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecord.h (180584 => 180585)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecord.h        2015-02-24 22:29:50 UTC (rev 180584)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecord.h        2015-02-24 22:40:30 UTC (rev 180585)
</span><span class="lines">@@ -40,6 +40,10 @@
</span><span class="cx">
</span><span class="cx"> WK_CLASS_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA)
</span><span class="cx"> @interface _WKWebsiteDataRecord : NSObject
</span><ins>+
+@property (nonatomic, readonly, copy) NSString *displayName;
+
+@property (nonatomic, readonly) WKWebsiteDataTypes dataTypes;
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKWebsiteDataRecordmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecord.mm (180584 => 180585)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecord.mm        2015-02-24 22:29:50 UTC (rev 180584)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecord.mm        2015-02-24 22:40:30 UTC (rev 180585)
</span><span class="lines">@@ -37,6 +37,37 @@
</span><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static NSString *dataTypesToString(WKWebsiteDataTypes dataTypes)
+{
+ auto array = adoptNS([[NSMutableArray alloc] init]);
+
+ if (dataTypes & WKWebsiteDataTypeCookies)
+ [array addObject:@"Cookies"];
+ if (dataTypes & WKWebsiteDataTypeDiskCache)
+ [array addObject:@"Disk Cache"];
+ if (dataTypes & WKWebsiteDataTypeMemoryCache)
+ [array addObject:@"Memory Cache"];
+ if (dataTypes & WKWebsiteDataTypeLocalStorage)
+ [array addObject:@"Local Storage"];
+
+ return [array componentsJoinedByString:@", "];
+}
+
+- (NSString *)description
+{
+ return [NSString stringWithFormat:@"<%@: %p; displayName = %@; dataTypes = { %@ }>", NSStringFromClass(self.class), self, self.displayName, dataTypesToString(self.dataTypes)];
+}
+
+- (NSString *)displayName
+{
+ return _websiteDataRecord->websiteDataRecord().displayName;
+}
+
+- (WKWebsiteDataTypes)dataTypes
+{
+ return WebKit::toWKWebsiteDataTypes(_websiteDataRecord->websiteDataRecord().types);
+}
+
</ins><span class="cx"> #pragma mark WKObject protocol implementation
</span><span class="cx">
</span><span class="cx"> - (API::Object&)_apiObject
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKWebsiteDataRecordInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecordInternal.h (180584 => 180585)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecordInternal.h        2015-02-24 22:29:50 UTC (rev 180584)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecordInternal.h        2015-02-24 22:40:30 UTC (rev 180585)
</span><span class="lines">@@ -38,8 +38,44 @@
</span><span class="cx"> return (_WKWebsiteDataRecord *)websiteDataRecord.wrapper();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static inline WebKit::WebsiteDataTypes toWebsiteDataTypes(WKWebsiteDataTypes wkWebsiteDataTypes)
+{
+ using WebsiteDataTypes = WebKit::WebsiteDataTypes;
+
+ int websiteDataTypes = 0;
+
+ if (wkWebsiteDataTypes & WKWebsiteDataTypeCookies)
+ websiteDataTypes |= WebsiteDataTypes::WebsiteDataTypeCookies;
+ if (wkWebsiteDataTypes & WKWebsiteDataTypeDiskCache)
+ websiteDataTypes |= WebsiteDataTypes::WebsiteDataTypeDiskCache;
+ if (wkWebsiteDataTypes & WKWebsiteDataTypeMemoryCache)
+ websiteDataTypes |= WebsiteDataTypes::WebsiteDataTypeMemoryCache;
+ if (wkWebsiteDataTypes & WKWebsiteDataTypeLocalStorage)
+ websiteDataTypes |= WebsiteDataTypes::WebsiteDataTypeLocalStorage;
+
+ return static_cast<WebsiteDataTypes>(websiteDataTypes);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+static inline WKWebsiteDataTypes toWKWebsiteDataTypes(int websiteDataTypes)
+{
+ using WebsiteDataTypes = WebKit::WebsiteDataTypes;
+
+ WKWebsiteDataTypes wkWebsiteDataTypes = 0;
+
+ if (websiteDataTypes & WebsiteDataTypes::WebsiteDataTypeCookies)
+ wkWebsiteDataTypes |= WKWebsiteDataTypeCookies;
+ if (websiteDataTypes & WebsiteDataTypes::WebsiteDataTypeDiskCache)
+ wkWebsiteDataTypes |= WKWebsiteDataTypeDiskCache;
+ if (websiteDataTypes & WebsiteDataTypes::WebsiteDataTypeMemoryCache)
+ wkWebsiteDataTypes |= WKWebsiteDataTypeMemoryCache;
+ if (websiteDataTypes & WebsiteDataTypes::WebsiteDataTypeLocalStorage)
+ wkWebsiteDataTypes |= WKWebsiteDataTypeLocalStorage;
+
+ return wkWebsiteDataTypes;
+}
+
+}
+
</ins><span class="cx"> @interface _WKWebsiteDataRecord () <WKObject> {
</span><span class="cx"> @package
</span><span class="cx"> API::ObjectStorage<API::WebsiteDataRecord> _websiteDataRecord;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKWebsiteDataStoremm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.mm (180584 => 180585)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.mm        2015-02-24 22:29:50 UTC (rev 180584)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.mm        2015-02-24 22:40:30 UTC (rev 180585)
</span><span class="lines">@@ -29,8 +29,8 @@
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">
</span><span class="cx"> #import "APIArray.h"
</span><del>-#import "APIWebsiteDataRecord.h"
</del><span class="cx"> #import "WKNSArray.h"
</span><ins>+#import "_WKWebsiteDataRecordInternal.h"
</ins><span class="cx">
</span><span class="cx"> @implementation _WKWebsiteDataStore
</span><span class="cx">
</span><span class="lines">@@ -56,24 +56,6 @@
</span><span class="cx"> return _websiteDataStore->isNonPersistent();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static WebKit::WebsiteDataTypes toWebsiteDataTypes(WKWebsiteDataTypes wkWebsiteDataTypes)
-{
- using WebsiteDataTypes = WebKit::WebsiteDataTypes;
-
- int websiteDataTypes = 0;
-
- if (wkWebsiteDataTypes & WKWebsiteDataTypeCookies)
- websiteDataTypes |= WebsiteDataTypes::WebsiteDataTypeCookies;
- if (wkWebsiteDataTypes & WKWebsiteDataTypeDiskCache)
- websiteDataTypes |= WebsiteDataTypes::WebsiteDataTypeDiskCache;
- if (wkWebsiteDataTypes & WKWebsiteDataTypeMemoryCache)
- websiteDataTypes |= WebsiteDataTypes::WebsiteDataTypeMemoryCache;
- if (wkWebsiteDataTypes & WKWebsiteDataTypeLocalStorage)
- websiteDataTypes |= WebsiteDataTypes::WebsiteDataTypeLocalStorage;
-
- return static_cast<WebsiteDataTypes>(websiteDataTypes);
-}
-
</del><span class="cx"> static std::chrono::system_clock::time_point toSystemClockTime(NSDate *date)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(date);
</span><span class="lines">@@ -86,7 +68,7 @@
</span><span class="cx"> {
</span><span class="cx"> auto completionHandlerCopy = Block_copy(completionHandler);
</span><span class="cx">
</span><del>- _websiteDataStore->websiteDataStore().fetchData(toWebsiteDataTypes(websiteDataTypes), [completionHandlerCopy](Vector<WebKit::WebsiteDataRecord> websiteDataRecords) {
</del><ins>+ _websiteDataStore->websiteDataStore().fetchData(WebKit::toWebsiteDataTypes(websiteDataTypes), [completionHandlerCopy](Vector<WebKit::WebsiteDataRecord> websiteDataRecords) {
</ins><span class="cx"> Vector<RefPtr<API::Object>> elements;
</span><span class="cx"> elements.reserveInitialCapacity(websiteDataRecords.size());
</span><span class="cx">
</span><span class="lines">@@ -102,7 +84,7 @@
</span><span class="cx"> - (void)removeDataOfTypes:(WKWebsiteDataTypes)websiteDataTypes modifiedSince:(NSDate *)date completionHandler:(void (^)())completionHandler
</span><span class="cx"> {
</span><span class="cx"> auto completionHandlerCopy = Block_copy(completionHandler);
</span><del>- _websiteDataStore->websiteDataStore().removeData(toWebsiteDataTypes(websiteDataTypes), toSystemClockTime(date ? date : [NSDate distantPast]), [completionHandlerCopy] {
</del><ins>+ _websiteDataStore->websiteDataStore().removeData(WebKit::toWebsiteDataTypes(websiteDataTypes), toSystemClockTime(date ? date : [NSDate distantPast]), [completionHandlerCopy] {
</ins><span class="cx"> completionHandlerCopy();
</span><span class="cx"> Block_release(completionHandlerCopy);
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataRecordcppfromrev180579trunkSourceWebKit2UIProcessAPIAPIWebsiteDataRecordh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.cpp (from rev 180579, trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataRecord.h) (0 => 180585)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.cpp         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.cpp        2015-02-24 22:40:30 UTC (rev 180585)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebsiteDataRecord.h"
+
+#include <WebCore/PublicSuffix.h>
+#include <WebCore/SecurityOrigin.h>
+
+namespace WebKit {
+
+String WebsiteDataRecord::displayNameForOrigin(const WebCore::SecurityOrigin& securityOrigin)
+{
+ const auto& protocol = securityOrigin.protocol();
+
+ if (protocol == "file") {
+ // FIXME: Handle this. Return a localized display name.
+ ASSERT_NOT_REACHED();
+ }
+
+ if (protocol == "http" || protocol == "https")
+ return WebCore::topPrivatelyControlledDomain(securityOrigin.host());
+
+ return String();
+}
+
+void WebsiteDataRecord::add(WebsiteDataTypes type, RefPtr<WebCore::SecurityOrigin>&& origin)
+{
+ types |= type;
+
+ origins.add(WTF::move(origin));
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataRecordh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.h (180584 => 180585)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.h        2015-02-24 22:29:50 UTC (rev 180584)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.h        2015-02-24 22:40:30 UTC (rev 180585)
</span><span class="lines">@@ -26,10 +26,25 @@
</span><span class="cx"> #ifndef WebsiteDataRecord_h
</span><span class="cx"> #define WebsiteDataRecord_h
</span><span class="cx">
</span><ins>+#include "WebsiteDataTypes.h"
+#include <WebCore/SecurityOriginHash.h>
+#include <wtf/HashSet.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+class SecurityOrigin;
+}
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><span class="cx"> struct WebsiteDataRecord {
</span><del>- // FIXME: Fill this in.
</del><ins>+ static String displayNameForOrigin(const WebCore::SecurityOrigin&);
+
+ void add(WebsiteDataTypes, RefPtr<WebCore::SecurityOrigin>&&);
+
+ String displayName;
+ unsigned types;
+ HashSet<RefPtr<WebCore::SecurityOrigin>> origins;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp (180584 => 180585)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp        2015-02-24 22:29:50 UTC (rev 180584)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp        2015-02-24 22:40:30 UTC (rev 180585)
</span><span class="lines">@@ -133,7 +133,18 @@
</span><span class="cx"> ASSERT(pendingCallbacks);
</span><span class="cx"> --pendingCallbacks;
</span><span class="cx">
</span><del>- // FIXME: Do something with the website data.
</del><ins>+ for (auto& entry : websiteData.entries) {
+ auto displayName = WebsiteDataRecord::displayNameForOrigin(*entry.origin);
+ if (!displayName)
+ continue;
+
+ auto& record = m_websiteDataRecords.add(displayName, WebsiteDataRecord { }).iterator->value;
+ if (!record.displayName)
+ record.displayName = WTF::move(displayName);
+
+ record.add(entry.type, WTF::move(entry.origin));
+ }
+
</ins><span class="cx"> callIfNeeded();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -144,13 +155,21 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<CallbackAggregator> callbackAggregator(this);
</span><span class="cx"> RunLoop::main().dispatch([callbackAggregator] {
</span><del>- // FIXME: Pass data records to the completion handler.
- callbackAggregator->completionHandler({ });
</del><ins>+
+ WTF::Vector<WebsiteDataRecord> records;
+ records.reserveInitialCapacity(callbackAggregator->m_websiteDataRecords.size());
+
+ for (auto& record : callbackAggregator->m_websiteDataRecords.values())
+ records.uncheckedAppend(WTF::move(record));
+
+ callbackAggregator->completionHandler(WTF::move(records));
</ins><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> unsigned pendingCallbacks = 0;
</span><span class="cx"> std::function<void (Vector<WebsiteDataRecord>)> completionHandler;
</span><ins>+
+ HashMap<String, WebsiteDataRecord> m_websiteDataRecords;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> RefPtr<CallbackAggregator> callbackAggregator = adoptRef(new CallbackAggregator(WTF::move(completionHandler)));
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (180584 => 180585)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2015-02-24 22:29:50 UTC (rev 180584)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2015-02-24 22:40:30 UTC (rev 180585)
</span><span class="lines">@@ -256,6 +256,7 @@
</span><span class="cx">                 1A4832D11A9BDC2F008B4DFE /* WebsiteDataRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4832CF1A9BD821008B4DFE /* WebsiteDataRecord.h */; };
</span><span class="cx">                 1A4832D61A9CDF96008B4DFE /* WebsiteData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4832D41A9CDF96008B4DFE /* WebsiteData.cpp */; };
</span><span class="cx">                 1A4832D71A9CDF96008B4DFE /* WebsiteData.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4832D51A9CDF96008B4DFE /* WebsiteData.h */; };
</span><ins>+                1A4832D91A9D1FD2008B4DFE /* WebsiteDataRecord.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4832D81A9D1FD2008B4DFE /* WebsiteDataRecord.cpp */; };
</ins><span class="cx">                 1A4A9C5512B816CF008FE984 /* NetscapePluginModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9C5312B816CF008FE984 /* NetscapePluginModule.cpp */; };
</span><span class="cx">                 1A4A9C5612B816CF008FE984 /* NetscapePluginModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A9C5412B816CF008FE984 /* NetscapePluginModule.h */; };
</span><span class="cx">                 1A4A9C9A12B821CD008FE984 /* NetscapePluginModuleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9C9912B821CD008FE984 /* NetscapePluginModuleMac.mm */; };
</span><span class="lines">@@ -2336,6 +2337,7 @@
</span><span class="cx">                 1A4832CF1A9BD821008B4DFE /* WebsiteDataRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteDataRecord.h; sourceTree = "<group>"; };
</span><span class="cx">                 1A4832D41A9CDF96008B4DFE /* WebsiteData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebsiteData.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 1A4832D51A9CDF96008B4DFE /* WebsiteData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteData.h; sourceTree = "<group>"; };
</span><ins>+                1A4832D81A9D1FD2008B4DFE /* WebsiteDataRecord.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebsiteDataRecord.cpp; sourceTree = "<group>"; };
</ins><span class="cx">                 1A4A9C5312B816CF008FE984 /* NetscapePluginModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePluginModule.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 1A4A9C5412B816CF008FE984 /* NetscapePluginModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetscapePluginModule.h; sourceTree = "<group>"; };
</span><span class="cx">                 1A4A9C9912B821CD008FE984 /* NetscapePluginModuleMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetscapePluginModuleMac.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -4481,6 +4483,7 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 1A4832C01A965A33008B4DFE /* Cocoa */,
</span><ins>+                                1A4832D81A9D1FD2008B4DFE /* WebsiteDataRecord.cpp */,
</ins><span class="cx">                                 1A4832CF1A9BD821008B4DFE /* WebsiteDataRecord.h */,
</span><span class="cx">                                 1A53C2A41A32569F004E8C70 /* WebsiteDataStore.cpp */,
</span><span class="cx">                                 1A53C2A51A32569F004E8C70 /* WebsiteDataStore.h */,
</span><span class="lines">@@ -9858,6 +9861,7 @@
</span><span class="cx">                                 BC4BEFE2120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp in Sources */,
</span><span class="cx">                                 BC20528211C94284008F3375 /* WKBundlePage.cpp in Sources */,
</span><span class="cx">                                 7CF47FF617275B71008ACB91 /* WKBundlePageBanner.cpp in Sources */,
</span><ins>+                                1A4832D91A9D1FD2008B4DFE /* WebsiteDataRecord.cpp in Sources */,
</ins><span class="cx">                                 7CF47FFE17276AE3008ACB91 /* WKBundlePageBannerMac.mm in Sources */,
</span><span class="cx">                                 BC7B633E12A45D1200D174A4 /* WKBundlePageGroup.cpp in Sources */,
</span><span class="cx">                                 EDCA71B7128DDA8C00201B26 /* WKBundlePageOverlay.cpp in Sources */,
</span></span></pre>
</div>
</div>
</body>
</html>