Diff
Modified: trunk/Source/WebKit2/ChangeLog (175187 => 175188)
--- trunk/Source/WebKit2/ChangeLog 2014-10-24 22:27:27 UTC (rev 175187)
+++ trunk/Source/WebKit2/ChangeLog 2014-10-24 23:01:54 UTC (rev 175188)
@@ -1,3 +1,71 @@
+2014-10-24 Jer Noble <[email protected]>
+
+ Abstractify WebOriginDataManager to support arbitrary ChildProcess supplements.
+ https://bugs.webkit.org/show_bug.cgi?id=137993
+
+ Reviewed by Brady Eidson.
+
+ To allow different ChildProcess subclasses to handle listing and deletion of origin
+ data, make WebOriginDataManager more generic by having a supplement implement the
+ details, leaving WebOriginDataManager to deal with cross-process messaging.
+
+ De-virtualize AsyncTask, allowing a task to be created by passing in a
+ function<void()>, rather than an object, method, and arguments.
+
+ * Shared/AsyncTask.h:
+ (WebKit::AsyncTask::AsyncTask):
+ (WebKit::AsyncTask::performTask):
+ (WebKit::AsyncTask::~AsyncTask): Deleted.
+
+ Add a new virtual base class, to be implemented by various ChildProcesses, which
+ WebOriginDataManager will use to implement listing and deletion requests.
+
+ * WebProcess/OriginData/WebOriginDataManager.h:
+ * WebProcess/OriginData/WebOriginDataManagerSupplement.h: Added.
+ (WebKit::WebOriginDataManagerSupplement::WebOriginDataManagerSupplement):
+ (WebKit::WebOriginDataManagerSupplement::~WebOriginDataManagerSupplement):
+ (WebKit::WebOriginDataManagerSupplement::getOrigins):
+ (WebKit::WebOriginDataManagerSupplement::deleteEntriesForOrigin):
+ (WebKit::WebOriginDataManagerSupplement::deleteEntriesModifiedBetweenDates):
+ (WebKit::WebOriginDataManagerSupplement::deleteAllEntries):
+ * WebKit2.xcodeproj/project.pbxproj:
+
+ WebOriginDataManager doesn't need to be a ChildSupplement. Remove the DatabaseProcess-
+ specific implementations for its message handlers and replace with clean, generic calls
+ to its supplement. Because these supplements may want to respond to the request
+ asynchronously, pass a completion function in to be called by the supplement once its
+ work is complete.
+
+ * WebProcess/OriginData/WebOriginDataManager.cpp:
+ (WebKit::WebOriginDataManager::WebOriginDataManager):
+ (WebKit::WebOriginDataManager::getOrigins):
+ (WebKit::WebOriginDataManager::deleteEntriesForOrigin):
+ (WebKit::WebOriginDataManager::deleteEntriesModifiedBetweenDates):
+ (WebKit::WebOriginDataManager::deleteAllEntries):
+ (WebKit::WebOriginDataManager::supplementName): Deleted.
+
+ DatabaseProcess already uses WebOriginDataManager, so it will be the first process
+ to fall under the heel of the new regime. DatabaseProcess will subclass
+ WebOriginDataManagerSupplement, and pass itself in twice to the WebOriginDataManager
+ constructor. Create a lambda-based AsyncTask for each request, and call the completion
+ function when each request is complete.
+
+ * DatabaseProcess/DatabaseProcess.cpp:
+ (WebKit::DatabaseProcess::DatabaseProcess):
+ (WebKit::DatabaseProcess::getIndexedDatabaseOrigins):
+ (WebKit::DatabaseProcess::deleteIndexedDatabaseEntriesForOrigin):
+ (WebKit::DatabaseProcess::deleteIndexedDatabaseEntriesModifiedBetweenDates):
+ (WebKit::DatabaseProcess::deleteAllIndexedDatabaseEntries):
+ (WebKit::DatabaseProcess::getOrigins):
+ (WebKit::DatabaseProcess::deleteEntriesForOrigin):
+ (WebKit::DatabaseProcess::deleteEntriesModifiedBetweenDates):
+ (WebKit::DatabaseProcess::deleteAllEntries):
+ (WebKit::DatabaseProcess::doGetIndexedDatabaseOrigins): Deleted.
+ (WebKit::DatabaseProcess::doDeleteIndexedDatabaseEntriesForOrigin): Deleted.
+ (WebKit::DatabaseProcess::doDeleteIndexedDatabaseEntriesModifiedBetweenDates): Deleted.
+ (WebKit::DatabaseProcess::doDeleteAllIndexedDatabaseEntries): Deleted.
+ * DatabaseProcess/DatabaseProcess.h:
+
2014-10-24 Beth Dakin <[email protected]>
Very large images crash in action menu code
Modified: trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp (175187 => 175188)
--- trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp 2014-10-24 22:27:27 UTC (rev 175187)
+++ trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp 2014-10-24 23:01:54 UTC (rev 175188)
@@ -54,7 +54,7 @@
DatabaseProcess::DatabaseProcess()
: m_queue(adoptRef(*WorkQueue::create("com.apple.WebKit.DatabaseProcess").leakRef()))
- , m_webOriginDataManager(std::make_unique<WebOriginDataManager>(this))
+ , m_webOriginDataManager(std::make_unique<WebOriginDataManager>(*this, *this))
{
// Make sure the UTF8Encoding encoding and the text encoding maps have been built on the main thread before a background thread needs it.
// FIXME: https://bugs.webkit.org/show_bug.cgi?id=135365 - Need a more explicit way of doing this besides accessing the UTF8Encoding.
@@ -191,18 +191,12 @@
#endif
}
-void DatabaseProcess::getIndexedDatabaseOrigins(uint64_t callbackID)
+Vector<SecurityOriginData> DatabaseProcess::getIndexedDatabaseOrigins()
{
- postDatabaseTask(createAsyncTask(*this, &DatabaseProcess::doGetIndexedDatabaseOrigins, callbackID));
-}
-
-void DatabaseProcess::doGetIndexedDatabaseOrigins(uint64_t callbackID)
-{
Vector<SecurityOriginData> results;
if (m_indexedDatabaseDirectory.isEmpty()) {
- send(Messages::WebOriginDataManagerProxy::DidGetOrigins(results, callbackID), 0);
- return;
+ return results;
}
Vector<String> originPaths = listDirectory(m_indexedDatabaseDirectory, "*");
@@ -220,7 +214,7 @@
results.append(SecurityOriginData::fromSecurityOrigin(securityOrigin.get()));
}
- send(Messages::WebOriginDataManagerProxy::DidGetOrigins(results, callbackID), 0);
+ return results;
}
static void removeAllDatabasesForOriginPath(const String& originPath, double startDate, double endDate)
@@ -252,63 +246,87 @@
deleteEmptyDirectory(originPath);
}
-void DatabaseProcess::deleteIndexedDatabaseEntriesForOrigin(const SecurityOriginData& origin, uint64_t callbackID)
+void DatabaseProcess::deleteIndexedDatabaseEntriesForOrigin(const SecurityOriginData& originData)
{
- postDatabaseTask(createAsyncTask(*this, &DatabaseProcess::doDeleteIndexedDatabaseEntriesForOrigin, origin, callbackID));
-}
-
-void DatabaseProcess::doDeleteIndexedDatabaseEntriesForOrigin(const SecurityOriginData& originData, uint64_t callbackID)
-{
- if (m_indexedDatabaseDirectory.isEmpty()) {
- send(Messages::WebOriginDataManagerProxy::DidDeleteEntries(callbackID), 0);
+ if (m_indexedDatabaseDirectory.isEmpty())
return;
- }
RefPtr<SecurityOrigin> origin = originData.securityOrigin();
String databaseIdentifier = origin->databaseIdentifier();
String originPath = pathByAppendingComponent(m_indexedDatabaseDirectory, databaseIdentifier);
removeAllDatabasesForOriginPath(originPath, std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
-
- send(Messages::WebOriginDataManagerProxy::DidDeleteEntries(callbackID), 0);
}
-void DatabaseProcess::deleteIndexedDatabaseEntriesModifiedBetweenDates(double startDate, double endDate, uint64_t callbackID)
+void DatabaseProcess::deleteIndexedDatabaseEntriesModifiedBetweenDates(double startDate, double endDate)
{
- postDatabaseTask(createAsyncTask(*this, &DatabaseProcess::doDeleteIndexedDatabaseEntriesModifiedBetweenDates, startDate, endDate, callbackID));
+ if (m_indexedDatabaseDirectory.isEmpty())
+ return;
+
+ Vector<String> originPaths = listDirectory(m_indexedDatabaseDirectory, "*");
+ for (auto& originPath : originPaths)
+ removeAllDatabasesForOriginPath(originPath, startDate, endDate);
}
-void DatabaseProcess::doDeleteIndexedDatabaseEntriesModifiedBetweenDates(double startDate, double endDate, uint64_t callbackID)
+void DatabaseProcess::deleteAllIndexedDatabaseEntries()
{
- if (m_indexedDatabaseDirectory.isEmpty()) {
- send(Messages::WebOriginDataManagerProxy::DidDeleteEntries(callbackID), 0);
+ if (m_indexedDatabaseDirectory.isEmpty())
return;
- }
Vector<String> originPaths = listDirectory(m_indexedDatabaseDirectory, "*");
for (auto& originPath : originPaths)
- removeAllDatabasesForOriginPath(originPath, startDate, endDate);
+ removeAllDatabasesForOriginPath(originPath, std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
+}
- send(Messages::WebOriginDataManagerProxy::DidDeleteEntries(callbackID), 0);
+void DatabaseProcess::getOrigins(WKOriginDataTypes types, std::function<void(const Vector<SecurityOriginData>&)> completion)
+{
+ if (!(types & kWKWebSQLDatabaseOriginData)) {
+ completion(Vector<SecurityOriginData>());
+ return;
+ }
+
+ postDatabaseTask(std::make_unique<AsyncTask>([completion, this] {
+ completion(getIndexedDatabaseOrigins());
+ }));
}
-void DatabaseProcess::deleteAllIndexedDatabaseEntries(uint64_t callbackID)
+void DatabaseProcess::deleteEntriesForOrigin(WKOriginDataTypes types, const SecurityOriginData& origin, std::function<void()> completion)
{
- postDatabaseTask(createAsyncTask(*this, &DatabaseProcess::doDeleteAllIndexedDatabaseEntries, callbackID));
+ if (!(types & kWKWebSQLDatabaseOriginData)) {
+ completion();
+ return;
+ }
+
+ postDatabaseTask(std::make_unique<AsyncTask>([this, origin, completion] {
+ deleteIndexedDatabaseEntriesForOrigin(origin);
+ completion();
+ }));
}
-void DatabaseProcess::doDeleteAllIndexedDatabaseEntries(uint64_t callbackID)
+void DatabaseProcess::deleteEntriesModifiedBetweenDates(WKOriginDataTypes types, double startDate, double endDate, std::function<void()> completion)
{
- if (m_indexedDatabaseDirectory.isEmpty()) {
- send(Messages::WebOriginDataManagerProxy::DidDeleteAllEntries(callbackID), 0);
+ if (!(types & kWKWebSQLDatabaseOriginData)) {
+ completion();
return;
}
- Vector<String> originPaths = listDirectory(m_indexedDatabaseDirectory, "*");
- for (auto& originPath : originPaths)
- removeAllDatabasesForOriginPath(originPath, std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
+ postDatabaseTask(std::make_unique<AsyncTask>([this, startDate, endDate, completion] {
+ deleteIndexedDatabaseEntriesModifiedBetweenDates(startDate, endDate);
+ completion();
+ }));
+}
- send(Messages::WebOriginDataManagerProxy::DidDeleteAllEntries(callbackID), 0);
+void DatabaseProcess::deleteAllEntries(WKOriginDataTypes types, std::function<void()> completion)
+{
+ if (!(types & kWKWebSQLDatabaseOriginData)) {
+ completion();
+ return;
+ }
+
+ postDatabaseTask(std::make_unique<AsyncTask>([this, completion] {
+ deleteAllIndexedDatabaseEntries();
+ completion();
+ }));
}
#if !PLATFORM(COCOA)
Modified: trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.h (175187 => 175188)
--- trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.h 2014-10-24 22:27:27 UTC (rev 175187)
+++ trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.h 2014-10-24 23:01:54 UTC (rev 175188)
@@ -30,6 +30,7 @@
#include "ChildProcess.h"
#include "UniqueIDBDatabaseIdentifier.h"
+#include "WebOriginDataManagerSupplement.h"
#include <wtf/NeverDestroyed.h>
class WorkQueue;
@@ -43,7 +44,7 @@
struct DatabaseProcessCreationParameters;
-class DatabaseProcess : public ChildProcess {
+class DatabaseProcess : public ChildProcess, public WebOriginDataManagerSupplement {
WTF_MAKE_NONCOPYABLE(DatabaseProcess);
friend class NeverDestroyed<DatabaseProcess>;
public:
@@ -60,11 +61,13 @@
WorkQueue& queue() { return m_queue.get(); }
- void getIndexedDatabaseOrigins(uint64_t callbackID);
- void deleteIndexedDatabaseEntriesForOrigin(const SecurityOriginData&, uint64_t callbackID);
- void deleteIndexedDatabaseEntriesModifiedBetweenDates(double startDate, double endDate, uint64_t callbackID);
- void deleteAllIndexedDatabaseEntries(uint64_t callbackID);
+ Vector<SecurityOriginData> getIndexedDatabaseOrigins();
+ void deleteIndexedDatabaseEntriesForOrigin(const SecurityOriginData&);
+ void deleteIndexedDatabaseEntriesModifiedBetweenDates(double startDate, double endDate);
+ void deleteAllIndexedDatabaseEntries();
+ void postDatabaseTask(std::unique_ptr<AsyncTask>);
+
private:
DatabaseProcess();
@@ -85,16 +88,16 @@
void initializeDatabaseProcess(const DatabaseProcessCreationParameters&);
void createDatabaseToWebProcessConnection();
- void postDatabaseTask(std::unique_ptr<AsyncTask>);
-
// For execution on work queue thread only
void performNextDatabaseTask();
void ensurePathExists(const String&);
- void doGetIndexedDatabaseOrigins(uint64_t callbackID);
- void doDeleteIndexedDatabaseEntriesForOrigin(const SecurityOriginData&, uint64_t callbackID);
- void doDeleteIndexedDatabaseEntriesModifiedBetweenDates(double startDate, double endDate, uint64_t callbackID);
- void doDeleteAllIndexedDatabaseEntries(uint64_t callbackID);
+ // WebOriginDataManagerSupplement
+ virtual void getOrigins(WKOriginDataTypes, std::function<void(const Vector<SecurityOriginData>&)> completion) override;
+ virtual void deleteEntriesForOrigin(WKOriginDataTypes, const SecurityOriginData&, std::function<void()> completion) override;
+ virtual void deleteEntriesModifiedBetweenDates(WKOriginDataTypes, double startDate, double endDate, std::function<void()> completion) override;
+ virtual void deleteAllEntries(WKOriginDataTypes, std::function<void()> completion) override;
+
Vector<RefPtr<DatabaseToWebProcessConnection>> m_databaseToWebProcessConnections;
Ref<WorkQueue> m_queue;
Modified: trunk/Source/WebKit2/Shared/AsyncTask.h (175187 => 175188)
--- trunk/Source/WebKit2/Shared/AsyncTask.h 2014-10-24 22:27:27 UTC (rev 175187)
+++ trunk/Source/WebKit2/Shared/AsyncTask.h 2014-10-24 23:01:54 UTC (rev 175188)
@@ -34,12 +34,21 @@
class AsyncTask {
WTF_MAKE_NONCOPYABLE(AsyncTask);
public:
- virtual ~AsyncTask() { }
+ AsyncTask(const std::function<void()> taskFunction)
+ : m_taskFunction(taskFunction)
+ {
+ ASSERT(taskFunction);
+ }
- virtual void performTask() = 0;
+ void performTask()
+ {
+ m_taskFunction();
+ }
protected:
- explicit AsyncTask() { }
+ AsyncTask() { }
+
+ std::function<void()> m_taskFunction;
};
template <typename T, typename... Arguments>
@@ -51,18 +60,6 @@
(callee->*method)(arguments...);
};
}
-
- virtual ~AsyncTaskImpl()
- {
- }
-
-private:
- virtual void performTask() override
- {
- m_taskFunction();
- }
-
- std::function<void()> m_taskFunction;
};
template<typename T>
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (175187 => 175188)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-10-24 22:27:27 UTC (rev 175187)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-10-24 23:01:54 UTC (rev 175188)
@@ -1594,6 +1594,7 @@
CDC3831017212440008A2FC3 /* CookieStorageShim.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC3830D1721242D008A2FC3 /* CookieStorageShim.mm */; };
CDCA85C8132ABA4E00E961DF /* WKFullScreenWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDCA85C6132ABA4E00E961DF /* WKFullScreenWindowController.mm */; };
CDCA85C9132ABA4E00E961DF /* WKFullScreenWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = CDCA85C7132ABA4E00E961DF /* WKFullScreenWindowController.h */; };
+ CDE6E2D319F731C400BA9688 /* WebOriginDataManagerSupplement.h in Headers */ = {isa = PBXBuildFile; fileRef = CDE6E2D219F731C400BA9688 /* WebOriginDataManagerSupplement.h */; };
CEDA12E2152CD1AE00D9E08D /* WebAlternativeTextClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CEDA12DF152CCAE800D9E08D /* WebAlternativeTextClient.cpp */; };
CEDA12E3152CD1B300D9E08D /* WebAlternativeTextClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CEDA12DE152CCAE800D9E08D /* WebAlternativeTextClient.h */; };
D3B9484611FF4B6500032B39 /* WebPopupMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3B9484211FF4B6500032B39 /* WebPopupMenu.cpp */; };
@@ -3693,6 +3694,7 @@
CDCA85C6132ABA4E00E961DF /* WKFullScreenWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKFullScreenWindowController.mm; sourceTree = "<group>"; };
CDCA85C7132ABA4E00E961DF /* WKFullScreenWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFullScreenWindowController.h; sourceTree = "<group>"; };
CDCA85D4132AC2B300E961DF /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
+ CDE6E2D219F731C400BA9688 /* WebOriginDataManagerSupplement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebOriginDataManagerSupplement.h; path = OriginData/WebOriginDataManagerSupplement.h; sourceTree = "<group>"; };
CEDA12DE152CCAE800D9E08D /* WebAlternativeTextClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAlternativeTextClient.h; sourceTree = "<group>"; };
CEDA12DF152CCAE800D9E08D /* WebAlternativeTextClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebAlternativeTextClient.cpp; sourceTree = "<group>"; };
D3B9484211FF4B6500032B39 /* WebPopupMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPopupMenu.cpp; sourceTree = "<group>"; };
@@ -5534,6 +5536,7 @@
755422C518064FFC0046F6A8 /* OriginData */ = {
isa = PBXGroup;
children = (
+ CDE6E2D219F731C400BA9688 /* WebOriginDataManagerSupplement.h */,
755422C618064FFC0046F6A8 /* WebOriginDataManager.cpp */,
755422C718064FFC0046F6A8 /* WebOriginDataManager.h */,
755422C818064FFC0046F6A8 /* WebOriginDataManager.messages.in */,
@@ -7024,6 +7027,7 @@
buildActionMask = 2147483647;
files = (
1ADAE12E1919A5B400F48E21 /* WKPreferences.h in Headers */,
+ CDE6E2D319F731C400BA9688 /* WebOriginDataManagerSupplement.h in Headers */,
1AF459321946559500F9D4A2 /* WKError.h in Headers */,
E19BDA8A193686A400B97F57 /* SandboxUtilities.h in Headers */,
1A7284471959ED100007BCE5 /* SessionStateConversion.h in Headers */,
Modified: trunk/Source/WebKit2/WebProcess/OriginData/WebOriginDataManager.cpp (175187 => 175188)
--- trunk/Source/WebKit2/WebProcess/OriginData/WebOriginDataManager.cpp 2014-10-24 22:27:27 UTC (rev 175187)
+++ trunk/Source/WebKit2/WebProcess/OriginData/WebOriginDataManager.cpp 2014-10-24 23:01:54 UTC (rev 175188)
@@ -34,6 +34,7 @@
#include "WebCoreArgumentCoders.h"
#include "WebOriginDataManagerMessages.h"
#include "WebOriginDataManagerProxyMessages.h"
+#include "WebOriginDataManagerSupplement.h"
#include <WebCore/SecurityOrigin.h>
#include <WebCore/SecurityOriginHash.h>
@@ -43,85 +44,39 @@
namespace WebKit {
-const char* WebOriginDataManager::supplementName()
-{
- return "WebOriginDataManager";
-}
-
-WebOriginDataManager::WebOriginDataManager(ChildProcess* childProcess)
+WebOriginDataManager::WebOriginDataManager(ChildProcess& childProcess, WebOriginDataManagerSupplement& supplement)
: m_childProcess(childProcess)
+ , m_supplement(supplement)
{
- m_childProcess->addMessageReceiver(Messages::WebOriginDataManager::messageReceiverName(), *this);
+ m_childProcess.addMessageReceiver(Messages::WebOriginDataManager::messageReceiverName(), *this);
}
void WebOriginDataManager::getOrigins(WKOriginDataTypes types, uint64_t callbackID)
{
-#if ENABLE(DATABASE_PROCESS)
- // FIXME: For now, the DatabaseProcess only handles IndexedDatabase origin data.
- // If it ever starts handling other data types (e.g. WebSQL) then it will have to aggregrate requests
- // for multiple types into the one callback.
- if (types & kWKIndexedDatabaseData) {
- DatabaseProcess::shared().getIndexedDatabaseOrigins(callbackID);
- return;
- }
-#else
- UNUSED_PARAM(types);
-#endif
-
- Vector<SecurityOriginData> results;
- m_childProcess->send(Messages::WebOriginDataManagerProxy::DidGetOrigins(results, callbackID), 0);
+ m_supplement.getOrigins(types, [this, callbackID](const Vector<SecurityOriginData>& results) {
+ m_childProcess.send(Messages::WebOriginDataManagerProxy::DidGetOrigins(results, callbackID), 0);
+ });
}
void WebOriginDataManager::deleteEntriesForOrigin(WKOriginDataTypes types, const SecurityOriginData& originData, uint64_t callbackID)
{
-#if ENABLE(DATABASE_PROCESS)
- // FIXME: For now, the DatabaseProcess only handles IndexedDatabase origin data.
- // If it ever starts handling other data types (e.g. WebSQL) then it will have to aggregrate requests
- // for multiple types into the one callback.
- if (types & kWKIndexedDatabaseData) {
- DatabaseProcess::shared().deleteIndexedDatabaseEntriesForOrigin(originData, callbackID);
- return;
- }
-#else
- UNUSED_PARAM(types);
- UNUSED_PARAM(originData);
-#endif
-
- m_childProcess->send(Messages::WebOriginDataManagerProxy::DidDeleteEntries(callbackID), 0);
+ m_supplement.deleteEntriesForOrigin(types, originData, [this, callbackID] {
+ m_childProcess.send(Messages::WebOriginDataManagerProxy::DidDeleteEntries(callbackID), 0);
+ });
}
void WebOriginDataManager::deleteEntriesModifiedBetweenDates(WKOriginDataTypes types, double startTime, double endTime, uint64_t callbackID)
{
-#if ENABLE(DATABASE_PROCESS)
- // FIXME: For now, the DatabaseProcess only handles IndexedDatabase origin data.
- // If it ever starts handling other data types (e.g. WebSQL) then it will have to aggregrate requests
- // for multiple types into the one callback.
- if (types & kWKIndexedDatabaseData) {
- DatabaseProcess::shared().deleteIndexedDatabaseEntriesModifiedBetweenDates(startTime, endTime, callbackID);
- return;
- }
-#else
- UNUSED_PARAM(types);
- UNUSED_PARAM(startTime);
- UNUSED_PARAM(endTime);
-#endif
- m_childProcess->send(Messages::WebOriginDataManagerProxy::DidDeleteEntries(callbackID), 0);
+ m_supplement.deleteEntriesModifiedBetweenDates(types, startTime, endTime, [this, callbackID] {
+ m_childProcess.send(Messages::WebOriginDataManagerProxy::DidDeleteEntries(callbackID), 0);
+ });
}
void WebOriginDataManager::deleteAllEntries(WKOriginDataTypes types, uint64_t callbackID)
{
-#if ENABLE(DATABASE_PROCESS)
- // FIXME: For now, the DatabaseProcess only handles IndexedDatabase origin data.
- // If it ever starts handling other data types (e.g. WebSQL) then it will have to aggregrate requests
- // for multiple types into the one callback.
- if (types & kWKIndexedDatabaseData) {
- DatabaseProcess::shared().deleteAllIndexedDatabaseEntries(callbackID);
- return;
- }
-#else
- UNUSED_PARAM(types);
-#endif
- m_childProcess->send(Messages::WebOriginDataManagerProxy::DidDeleteAllEntries(callbackID), 0);
+ m_supplement.deleteAllEntries(types, [this, callbackID] {
+ m_childProcess.send(Messages::WebOriginDataManagerProxy::DidDeleteAllEntries(callbackID), 0);
+ });
}
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/OriginData/WebOriginDataManager.h (175187 => 175188)
--- trunk/Source/WebKit2/WebProcess/OriginData/WebOriginDataManager.h 2014-10-24 22:27:27 UTC (rev 175187)
+++ trunk/Source/WebKit2/WebProcess/OriginData/WebOriginDataManager.h 2014-10-24 23:01:54 UTC (rev 175188)
@@ -26,24 +26,23 @@
#ifndef WebOriginDataManager_h
#define WebOriginDataManager_h
-#include "ChildProcessSupplement.h"
#include "MessageReceiver.h"
#include "WKOriginDataManager.h"
+#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
#include <wtf/text/WTFString.h>
namespace WebKit {
class ChildProcess;
+class WebOriginDataManagerSupplement;
struct SecurityOriginData;
-class WebOriginDataManager : public ChildProcessSupplement, public IPC::MessageReceiver {
+class WebOriginDataManager : public IPC::MessageReceiver {
WTF_MAKE_NONCOPYABLE(WebOriginDataManager);
public:
- WebOriginDataManager(ChildProcess*);
+ WebOriginDataManager(ChildProcess&, WebOriginDataManagerSupplement&);
- static const char* supplementName();
-
private:
void getOrigins(WKOriginDataTypes, uint64_t callbackID);
void deleteEntriesForOrigin(WKOriginDataTypes, const SecurityOriginData&, uint64_t callbackID);
@@ -53,7 +52,8 @@
// IPC::MessageReceiver
virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override;
- ChildProcess* m_childProcess;
+ ChildProcess& m_childProcess;
+ WebOriginDataManagerSupplement& m_supplement;
};
} // namespace WebKit
Added: trunk/Source/WebKit2/WebProcess/OriginData/WebOriginDataManagerSupplement.h (0 => 175188)
--- trunk/Source/WebKit2/WebProcess/OriginData/WebOriginDataManagerSupplement.h (rev 0)
+++ trunk/Source/WebKit2/WebProcess/OriginData/WebOriginDataManagerSupplement.h 2014-10-24 23:01:54 UTC (rev 175188)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2014 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebOriginDataManagerSupplement_h
+#define WebOriginDataManagerSupplement_h
+
+#include "SecurityOriginData.h"
+#include "WKOriginDataManager.h"
+#include <functional>
+
+namespace WebKit {
+
+class WebOriginDataManagerSupplement {
+public:
+ WebOriginDataManagerSupplement() { }
+ virtual ~WebOriginDataManagerSupplement() { }
+
+ virtual void getOrigins(WKOriginDataTypes, std::function<void(const Vector<SecurityOriginData>&)> completion) = 0;
+ virtual void deleteEntriesForOrigin(WKOriginDataTypes, const SecurityOriginData&, std::function<void()> completion) = 0;
+ virtual void deleteEntriesModifiedBetweenDates(WKOriginDataTypes, double startDate, double endDate, std::function<void()> completion) = 0;
+ virtual void deleteAllEntries(WKOriginDataTypes, std::function<void()> completion) = 0;
+};
+
+}
+
+#endif