Commit ef20809b authored by beidson@apple.com's avatar beidson@apple.com

<rdar://problem/8762095> and https://bugs.webkit.org/show_bug.cgi?id=55172

Need WK2 API to view/manage origins with LocalStorage

Reviewed by Dan Bernstein.

../WebCore: 

* storage/StorageTracker.cpp:
(WebCore::StorageTracker::initializeTracker): Make sure the TextEncoding map is initialized on the main thread
  before the StorageTracker thread can do it on the background thread.

../WebKit2: 

Hookup the existing API stubs to the WebCore implementations:
* WebProcess/KeyValueStorage/WebKeyValueStorageManager.cpp:
(WebKit::WebKeyValueStorageManager::getKeyValueStorageOrigins):
(WebKit::WebKeyValueStorageManager::deleteEntriesForOrigin):
(WebKit::WebKeyValueStorageManager::deleteAllEntries):



git-svn-id: svn://svn.chromium.org/blink/trunk@81005 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c205dd9e
2011-03-14 Brady Eidson <beidson@apple.com>
Reviewed by Dan Bernstein.
<rdar://problem/8762095> and https://bugs.webkit.org/show_bug.cgi?id=55172
Need WK2 API to view/manage origins with LocalStorage
* storage/StorageTracker.cpp:
(WebCore::StorageTracker::initializeTracker): Make sure the TextEncoding map is initialized on the main thread
before the StorageTracker thread can do it on the background thread.
2011-03-13 Anton D'Auria <adauria@apple.com> 2011-03-13 Anton D'Auria <adauria@apple.com>
Reviewed by Brady Eidson and David Levin, landed by Brady Eidson. Reviewed by Brady Eidson and David Levin, landed by Brady Eidson.
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "SQLiteStatement.h" #include "SQLiteStatement.h"
#include "SecurityOrigin.h" #include "SecurityOrigin.h"
#include "StorageTrackerClient.h" #include "StorageTrackerClient.h"
#include "TextEncoding.h"
#include <wtf/MainThread.h> #include <wtf/MainThread.h>
#include <wtf/StdLibExtras.h> #include <wtf/StdLibExtras.h>
#include <wtf/Vector.h> #include <wtf/Vector.h>
...@@ -53,6 +54,10 @@ void StorageTracker::initializeTracker(const String& storagePath) ...@@ -53,6 +54,10 @@ void StorageTracker::initializeTracker(const String& storagePath)
if (!storageTracker) if (!storageTracker)
storageTracker = new StorageTracker(storagePath); storageTracker = new StorageTracker(storagePath);
// Make sure text encoding maps have been built on the main thread, as the StorageTracker thread might try to do it there instead.
// FIXME (<rdar://problem/9127819>): Is there a more explicit way of doing this besides accessing the UTF8Encoding?
UTF8Encoding();
SQLiteFileSystem::registerSQLiteVFS(); SQLiteFileSystem::registerSQLiteVFS();
storageTracker->setIsActive(true); storageTracker->setIsActive(true);
storageTracker->m_thread->start(); storageTracker->m_thread->start();
......
2011-03-14 Brady Eidson <beidson@apple.com>
Reviewed by Dan Bernstein.
<rdar://problem/8762095> and https://bugs.webkit.org/show_bug.cgi?id=55172
Need WK2 API to view/manage origins with LocalStorage
Hookup the existing API stubs to the WebCore implementations:
* WebProcess/KeyValueStorage/WebKeyValueStorageManager.cpp:
(WebKit::WebKeyValueStorageManager::getKeyValueStorageOrigins):
(WebKit::WebKeyValueStorageManager::deleteEntriesForOrigin):
(WebKit::WebKeyValueStorageManager::deleteAllEntries):
2011-03-13 Brady Eidson <beidson@apple.com> 2011-03-13 Brady Eidson <beidson@apple.com>
Reviewed by Sam Weinig. Reviewed by Sam Weinig.
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <WebCore/NotImplemented.h> #include <WebCore/NotImplemented.h>
#include <WebCore/SecurityOrigin.h> #include <WebCore/SecurityOrigin.h>
#include <WebCore/SecurityOriginHash.h> #include <WebCore/SecurityOriginHash.h>
#include <WebCore/StorageTracker.h>
using namespace WebCore; using namespace WebCore;
...@@ -56,22 +57,20 @@ void WebKeyValueStorageManager::didReceiveMessage(CoreIPC::Connection* connectio ...@@ -56,22 +57,20 @@ void WebKeyValueStorageManager::didReceiveMessage(CoreIPC::Connection* connectio
void WebKeyValueStorageManager::getKeyValueStorageOrigins(uint64_t callbackID) void WebKeyValueStorageManager::getKeyValueStorageOrigins(uint64_t callbackID)
{ {
HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> origins; Vector<RefPtr<SecurityOrigin> > coreOrigins;
// FIXME: <rdar://problem/8762095> and https://bugs.webkit.org/show_bug.cgi?id=55172 - Actually get the origins from WebCore once https://bugs.webkit.org/show_bug.cgi?id=51878 is resolved. StorageTracker::tracker().origins(coreOrigins);
size_t size = coreOrigins.size();
Vector<SecurityOriginData> identifiers; Vector<SecurityOriginData> identifiers;
identifiers.reserveCapacity(origins.size()); identifiers.reserveCapacity(size);
HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator end = origins.end(); for (size_t i = 0; i < size; ++i) {
HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator i = origins.begin();
for (; i != end; ++i) {
RefPtr<SecurityOrigin> origin = *i;
SecurityOriginData originData; SecurityOriginData originData;
originData.protocol = origin->protocol();
originData.host = origin->host(); originData.protocol = coreOrigins[i]->protocol();
originData.port = origin->port(); originData.host = coreOrigins[i]->host();
originData.port = coreOrigins[i]->port();
identifiers.uncheckedAppend(originData); identifiers.uncheckedAppend(originData);
} }
...@@ -81,14 +80,16 @@ void WebKeyValueStorageManager::getKeyValueStorageOrigins(uint64_t callbackID) ...@@ -81,14 +80,16 @@ void WebKeyValueStorageManager::getKeyValueStorageOrigins(uint64_t callbackID)
void WebKeyValueStorageManager::deleteEntriesForOrigin(const SecurityOriginData& originData) void WebKeyValueStorageManager::deleteEntriesForOrigin(const SecurityOriginData& originData)
{ {
// FIXME: <rdar://problem/8762095> and https://bugs.webkit.org/show_bug.cgi?id=55172 - Implement once https://bugs.webkit.org/show_bug.cgi?id=51878 is resolved. RefPtr<SecurityOrigin> origin = SecurityOrigin::create(originData.protocol, originData.host, originData.port);
notImplemented(); if (!origin)
return;
StorageTracker::tracker().deleteOrigin(origin.get());
} }
void WebKeyValueStorageManager::deleteAllEntries() void WebKeyValueStorageManager::deleteAllEntries()
{ {
// FIXME: <rdar://problem/8762095> and https://bugs.webkit.org/show_bug.cgi?id=55172 - Implement once https://bugs.webkit.org/show_bug.cgi?id=51878 is resolved. StorageTracker::tracker().deleteAllOrigins();
notImplemented();
} }
} // namespace WebKit } // namespace WebKit
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment