Title: [121395] trunk/Source
Revision
121395
Author
charles....@torchmobile.com.cn
Date
2012-06-27 18:58:22 -0700 (Wed, 27 Jun 2012)

Log Message

IndexedDB: should make the LevelDB persistant to the directory indicated in PageGroupSettings::indexedDBDataBasePath
https://bugs.webkit.org/show_bug.cgi?id=88338

Reviewed by David Levin.

Source/WebCore:

If the indexedDB runs in main thread it can access the GroupSettings via the document;
otherwise, we need to pass the page GroupSettings to the worker thread so that accessible
to the indexedDB running in WorkerContext.

* Modules/indexeddb/IDBFactory.cpp:
(WebCore::IDBFactory::open):
* workers/DedicatedWorkerThread.cpp:
(WebCore::DedicatedWorkerThread::create):
(WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
* workers/DedicatedWorkerThread.h:
(DedicatedWorkerThread):
* workers/DefaultSharedWorkerRepository.cpp:
(SharedWorkerProxy):
(WebCore::SharedWorkerProxy::groupSettings):
(WebCore):
(WebCore::DefaultSharedWorkerRepository::workerScriptLoaded):
* workers/SharedWorkerThread.cpp:
(WebCore::SharedWorkerThread::create):
(WebCore::SharedWorkerThread::SharedWorkerThread):
* workers/SharedWorkerThread.h:
(SharedWorkerThread):
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::startWorkerContext):
* workers/WorkerThread.cpp:
(WebCore::WorkerThreadStartupData::create):
(WorkerThreadStartupData):
(WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
(WebCore::WorkerThread::WorkerThread):
(WebCore::WorkerThread::groupSettings):
(WebCore):
* workers/WorkerThread.h:
(WorkerThread):

Source/WebKit/chromium:

* src/WebSharedWorkerImpl.cpp:
(WebKit::WebSharedWorkerImpl::startWorkerContext):
* src/WebWorkerClientImpl.cpp:
(WebKit::WebWorkerClientImpl::startWorkerContext):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (121394 => 121395)


--- trunk/Source/WebCore/ChangeLog	2012-06-28 01:14:20 UTC (rev 121394)
+++ trunk/Source/WebCore/ChangeLog	2012-06-28 01:58:22 UTC (rev 121395)
@@ -1,3 +1,43 @@
+2012-06-27  Charles Wei  <charles....@torchmobile.com.cn>
+
+        IndexedDB: should make the LevelDB persistant to the directory indicated in PageGroupSettings::indexedDBDataBasePath
+        https://bugs.webkit.org/show_bug.cgi?id=88338
+
+        Reviewed by David Levin.
+
+        If the indexedDB runs in main thread it can access the GroupSettings via the document;
+        otherwise, we need to pass the page GroupSettings to the worker thread so that accessible
+        to the indexedDB running in WorkerContext.
+
+        * Modules/indexeddb/IDBFactory.cpp:
+        (WebCore::IDBFactory::open):
+        * workers/DedicatedWorkerThread.cpp:
+        (WebCore::DedicatedWorkerThread::create):
+        (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
+        * workers/DedicatedWorkerThread.h:
+        (DedicatedWorkerThread):
+        * workers/DefaultSharedWorkerRepository.cpp:
+        (SharedWorkerProxy):
+        (WebCore::SharedWorkerProxy::groupSettings):
+        (WebCore):
+        (WebCore::DefaultSharedWorkerRepository::workerScriptLoaded):
+        * workers/SharedWorkerThread.cpp:
+        (WebCore::SharedWorkerThread::create):
+        (WebCore::SharedWorkerThread::SharedWorkerThread):
+        * workers/SharedWorkerThread.h:
+        (SharedWorkerThread):
+        * workers/WorkerMessagingProxy.cpp:
+        (WebCore::WorkerMessagingProxy::startWorkerContext):
+        * workers/WorkerThread.cpp:
+        (WebCore::WorkerThreadStartupData::create):
+        (WorkerThreadStartupData):
+        (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
+        (WebCore::WorkerThread::WorkerThread):
+        (WebCore::WorkerThread::groupSettings):
+        (WebCore):
+        * workers/WorkerThread.h:
+        (WorkerThread):
+
 2012-06-27  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r121359.

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp (121394 => 121395)


--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp	2012-06-28 01:14:20 UTC (rev 121394)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp	2012-06-28 01:58:22 UTC (rev 121395)
@@ -94,12 +94,14 @@
             return 0;
         Frame* frame = document->frame();
         RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), 0);
-        m_backend->open(name, request.get(), context->securityOrigin(), frame, String());
+        m_backend->open(name, request.get(), context->securityOrigin(), frame, document->page()->group().groupSettings()->indexedDBDatabasePath());
         return request;
     }
 #if ENABLE(WORKERS)
     RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), 0);
-    m_backend->openFromWorker(name, request.get(), context->securityOrigin(), static_cast<WorkerContext*>(context), String());
+    WorkerContext* workerContext = static_cast<WorkerContext*>(context);
+    GroupSettings* groupSettings = workerContext->thread()->groupSettings();
+    m_backend->openFromWorker(name, request.get(), context->securityOrigin(), workerContext, groupSettings ? groupSettings->indexedDBDatabasePath() : String());
     return request;
 #else
     return 0;

Modified: trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp (121394 => 121395)


--- trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp	2012-06-28 01:14:20 UTC (rev 121394)
+++ trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp	2012-06-28 01:58:22 UTC (rev 121395)
@@ -39,13 +39,13 @@
 
 namespace WebCore {
 
-PassRefPtr<DedicatedWorkerThread> DedicatedWorkerThread::create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
+PassRefPtr<DedicatedWorkerThread> DedicatedWorkerThread::create(const KURL& scriptURL, const String& userAgent, const GroupSettings* settings, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
 {
-    return adoptRef(new DedicatedWorkerThread(scriptURL, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy, startMode, contentSecurityPolicy, contentSecurityPolicyType));
+    return adoptRef(new DedicatedWorkerThread(scriptURL, userAgent, settings, sourceCode, workerLoaderProxy, workerObjectProxy, startMode, contentSecurityPolicy, contentSecurityPolicyType));
 }
 
-DedicatedWorkerThread::DedicatedWorkerThread(const KURL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
-    : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy, startMode, contentSecurityPolicy, contentSecurityPolicyType)
+DedicatedWorkerThread::DedicatedWorkerThread(const KURL& url, const String& userAgent, const GroupSettings* settings, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
+    : WorkerThread(url, userAgent, settings, sourceCode, workerLoaderProxy, workerObjectProxy, startMode, contentSecurityPolicy, contentSecurityPolicyType)
     , m_workerObjectProxy(workerObjectProxy)
 {
 }

Modified: trunk/Source/WebCore/workers/DedicatedWorkerThread.h (121394 => 121395)


--- trunk/Source/WebCore/workers/DedicatedWorkerThread.h	2012-06-28 01:14:20 UTC (rev 121394)
+++ trunk/Source/WebCore/workers/DedicatedWorkerThread.h	2012-06-28 01:58:22 UTC (rev 121395)
@@ -41,7 +41,7 @@
 
     class DedicatedWorkerThread : public WorkerThread {
     public:
-        static PassRefPtr<DedicatedWorkerThread> create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
+        static PassRefPtr<DedicatedWorkerThread> create(const KURL& scriptURL, const String& userAgent, const GroupSettings*, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
         WorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; }
         ~DedicatedWorkerThread();
 
@@ -50,7 +50,7 @@
         virtual void runEventLoop();
 
     private:
-        DedicatedWorkerThread(const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
+        DedicatedWorkerThread(const KURL&, const String& userAgent, const GroupSettings*, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
 
         WorkerObjectProxy& m_workerObjectProxy;
     };

Modified: trunk/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp (121394 => 121395)


--- trunk/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp	2012-06-28 01:14:20 UTC (rev 121394)
+++ trunk/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp	2012-06-28 01:58:22 UTC (rev 121395)
@@ -42,6 +42,7 @@
 #include "MessageEvent.h"
 #include "MessagePort.h"
 #include "NotImplemented.h"
+#include "PageGroup.h"
 #include "PlatformString.h"
 #include "ScriptCallStack.h"
 #include "SecurityOrigin.h"
@@ -97,6 +98,8 @@
     // Removes a detached document from the list of worker's documents. May set the closing flag if this is the last document in the list.
     void documentDetached(Document*);
 
+    GroupSettings* groupSettings() const; // Page GroupSettings used by worker thread.
+
 private:
     SharedWorkerProxy(const String& name, const KURL&, PassRefPtr<SecurityOrigin>);
     void close();
@@ -160,6 +163,16 @@
     return true;
 }
 
+GroupSettings* SharedWorkerProxy::groupSettings() const
+{
+    if (isClosing())
+        return 0;
+    ASSERT(m_workerDocuments.size());
+    // Just pick the first active document, and use the groupsettings of that page.
+    Document* document = *(m_workerDocuments.begin());
+    return document->page()->group().groupSettings();
+}
+
 static void postExceptionTask(ScriptExecutionContext* context, const String& errorMessage, int lineNumber, const String& sourceURL)
 {
     context->reportException(errorMessage, lineNumber, sourceURL, 0);
@@ -343,7 +356,7 @@
 
     // Another loader may have already started up a thread for this proxy - if so, just send a connect to the pre-existing thread.
     if (!proxy.thread()) {
-        RefPtr<SharedWorkerThread> thread = SharedWorkerThread::create(proxy.name(), proxy.url(), userAgent, workerScript, proxy, proxy, DontPauseWorkerContextOnStart, contentSecurityPolicy, contentSecurityPolicyType);
+        RefPtr<SharedWorkerThread> thread = SharedWorkerThread::create(proxy.name(), proxy.url(), userAgent, proxy.groupSettings(), workerScript, proxy, proxy, DontPauseWorkerContextOnStart, contentSecurityPolicy, contentSecurityPolicyType);
         proxy.setThread(thread);
         thread->start();
     }

Modified: trunk/Source/WebCore/workers/SharedWorkerThread.cpp (121394 => 121395)


--- trunk/Source/WebCore/workers/SharedWorkerThread.cpp	2012-06-28 01:14:20 UTC (rev 121394)
+++ trunk/Source/WebCore/workers/SharedWorkerThread.cpp	2012-06-28 01:58:22 UTC (rev 121395)
@@ -38,13 +38,13 @@
 
 namespace WebCore {
 
-PassRefPtr<SharedWorkerThread> SharedWorkerThread::create(const String& name, const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
+PassRefPtr<SharedWorkerThread> SharedWorkerThread::create(const String& name, const KURL& scriptURL, const String& userAgent, const GroupSettings* settings, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
 {
-    return adoptRef(new SharedWorkerThread(name, scriptURL, userAgent, sourceCode, workerLoaderProxy, workerReportingProxy, startMode, contentSecurityPolicy, contentSecurityPolicyType));
+    return adoptRef(new SharedWorkerThread(name, scriptURL, userAgent, settings, sourceCode, workerLoaderProxy, workerReportingProxy, startMode, contentSecurityPolicy, contentSecurityPolicyType));
 }
 
-SharedWorkerThread::SharedWorkerThread(const String& name, const KURL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
-    : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerReportingProxy, startMode, contentSecurityPolicy, contentSecurityPolicyType)
+SharedWorkerThread::SharedWorkerThread(const String& name, const KURL& url, const String& userAgent, const GroupSettings* settings, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
+    : WorkerThread(url, userAgent, settings, sourceCode, workerLoaderProxy, workerReportingProxy, startMode, contentSecurityPolicy, contentSecurityPolicyType)
     , m_name(name.isolatedCopy())
 {
 }

Modified: trunk/Source/WebCore/workers/SharedWorkerThread.h (121394 => 121395)


--- trunk/Source/WebCore/workers/SharedWorkerThread.h	2012-06-28 01:14:20 UTC (rev 121394)
+++ trunk/Source/WebCore/workers/SharedWorkerThread.h	2012-06-28 01:58:22 UTC (rev 121395)
@@ -39,14 +39,14 @@
 
     class SharedWorkerThread : public WorkerThread {
     public:
-        static PassRefPtr<SharedWorkerThread> create(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
+        static PassRefPtr<SharedWorkerThread> create(const String& name, const KURL&, const String& userAgent, const GroupSettings*, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
         ~SharedWorkerThread();
 
     protected:
         virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String&, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
 
     private:
-        SharedWorkerThread(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
+        SharedWorkerThread(const String& name, const KURL&, const String& userAgent, const GroupSettings*, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
 
         String m_name;
     };

Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp (121394 => 121395)


--- trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2012-06-28 01:14:20 UTC (rev 121394)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2012-06-28 01:58:22 UTC (rev 121395)
@@ -42,6 +42,7 @@
 #include "InspectorInstrumentation.h"
 #include "MessageEvent.h"
 #include "NotImplemented.h"
+#include "PageGroup.h"
 #include "ScriptCallStack.h"
 #include "ScriptExecutionContext.h"
 #include "Worker.h"
@@ -272,7 +273,8 @@
 
 void WorkerMessagingProxy::startWorkerContext(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode)
 {
-    RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, sourceCode, *this, *this, startMode,
+    GroupSettings* settings = static_cast<Document*>(m_workerObject->scriptExecutionContext())->page()->group().groupSettings();
+    RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, settings, sourceCode, *this, *this, startMode,
                                                                          m_scriptExecutionContext->contentSecurityPolicy()->deprecatedHeader(),
                                                                          m_scriptExecutionContext->contentSecurityPolicy()->deprecatedHeaderType());
     workerThreadCreated(thread);

Modified: trunk/Source/WebCore/workers/WorkerThread.cpp (121394 => 121395)


--- trunk/Source/WebCore/workers/WorkerThread.cpp	2012-06-28 01:14:20 UTC (rev 121394)
+++ trunk/Source/WebCore/workers/WorkerThread.cpp	2012-06-28 01:58:22 UTC (rev 121395)
@@ -71,22 +71,23 @@
 struct WorkerThreadStartupData {
     WTF_MAKE_NONCOPYABLE(WorkerThreadStartupData); WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<WorkerThreadStartupData> create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
+    static PassOwnPtr<WorkerThreadStartupData> create(const KURL& scriptURL, const String& userAgent, const GroupSettings* settings, const String& sourceCode, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
     {
-        return adoptPtr(new WorkerThreadStartupData(scriptURL, userAgent, sourceCode, startMode, contentSecurityPolicy, contentSecurityPolicyType));
+        return adoptPtr(new WorkerThreadStartupData(scriptURL, userAgent, settings, sourceCode, startMode, contentSecurityPolicy, contentSecurityPolicyType));
     }
 
     KURL m_scriptURL;
     String m_userAgent;
+    OwnPtr<GroupSettings> m_groupSettings;
     String m_sourceCode;
     WorkerThreadStartMode m_startMode;
     String m_contentSecurityPolicy;
     ContentSecurityPolicy::HeaderType m_contentSecurityPolicyType;
 private:
-    WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType);
+    WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const GroupSettings*, const String& sourceCode, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType);
 };
 
-WorkerThreadStartupData::WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
+WorkerThreadStartupData::WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const GroupSettings* settings, const String& sourceCode, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
     : m_scriptURL(scriptURL.copy())
     , m_userAgent(userAgent.isolatedCopy())
     , m_sourceCode(sourceCode.isolatedCopy())
@@ -94,13 +95,20 @@
     , m_contentSecurityPolicy(contentSecurityPolicy.isolatedCopy())
     , m_contentSecurityPolicyType(contentSecurityPolicyType)
 {
+    if (!settings)
+        return;
+
+    m_groupSettings = GroupSettings::create();
+    m_groupSettings->setLocalStorageQuotaBytes(settings->localStorageQuotaBytes());
+    m_groupSettings->setIndexedDBQuotaBytes(settings->indexedDBQuotaBytes());
+    m_groupSettings->setIndexedDBDatabasePath(settings->indexedDBDatabasePath());
 }
 
-WorkerThread::WorkerThread(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
+WorkerThread::WorkerThread(const KURL& scriptURL, const String& userAgent, const GroupSettings* settings, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
     : m_threadID(0)
     , m_workerLoaderProxy(workerLoaderProxy)
     , m_workerReportingProxy(workerReportingProxy)
-    , m_startupData(WorkerThreadStartupData::create(scriptURL, userAgent, sourceCode, startMode, contentSecurityPolicy, contentSecurityPolicyType))
+    , m_startupData(WorkerThreadStartupData::create(scriptURL, userAgent, settings, sourceCode, startMode, contentSecurityPolicy, contentSecurityPolicyType))
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
     , m_notificationClient(0)
 #endif
@@ -185,6 +193,11 @@
     m_runLoop.run(m_workerContext.get());
 }
 
+GroupSettings* WorkerThread::groupSettings()
+{
+    return m_startupData->m_groupSettings.get();
+}
+
 class WorkerThreadShutdownFinishTask : public ScriptExecutionContext::Task {
 public:
     static PassOwnPtr<WorkerThreadShutdownFinishTask> create()

Modified: trunk/Source/WebCore/workers/WorkerThread.h (121394 => 121395)


--- trunk/Source/WebCore/workers/WorkerThread.h	2012-06-28 01:14:20 UTC (rev 121394)
+++ trunk/Source/WebCore/workers/WorkerThread.h	2012-06-28 01:58:22 UTC (rev 121395)
@@ -30,6 +30,7 @@
 #if ENABLE(WORKERS)
 
 #include "ContentSecurityPolicy.h"
+#include "GroupSettings.h"
 #include "WorkerRunLoop.h"
 #include <wtf/Forward.h>
 #include <wtf/OwnPtr.h>
@@ -61,6 +62,7 @@
 
         // Number of active worker threads.
         static unsigned workerThreadCount();
+        GroupSettings* groupSettings();
 
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
         NotificationClient* getNotificationClient() { return m_notificationClient; }
@@ -68,7 +70,7 @@
 #endif
 
     protected:
-        WorkerThread(const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
+        WorkerThread(const KURL&, const String& userAgent, const GroupSettings*,  const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
 
         // Factory method for creating a new worker context for the thread.
         virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType) = 0;

Modified: trunk/Source/WebKit/chromium/ChangeLog (121394 => 121395)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-06-28 01:14:20 UTC (rev 121394)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-06-28 01:58:22 UTC (rev 121395)
@@ -1,3 +1,15 @@
+2012-06-27  Charles Wei  <charles....@torchmobile.com.cn>
+
+        IndexedDB: should make the LevelDB persistant to the directory indicated in PageGroupSettings::indexedDBDataBasePath
+        https://bugs.webkit.org/show_bug.cgi?id=88338
+
+        Reviewed by David Levin.
+
+        * src/WebSharedWorkerImpl.cpp:
+        (WebKit::WebSharedWorkerImpl::startWorkerContext):
+        * src/WebWorkerClientImpl.cpp:
+        (WebKit::WebWorkerClientImpl::startWorkerContext):
+
 2012-06-27  Joshua Bell  <jsb...@chromium.org>
 
         [Chromium] IndexedDB: Expose WebIDBTransaction::commit() method in public API

Modified: trunk/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp (121394 => 121395)


--- trunk/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp	2012-06-28 01:14:20 UTC (rev 121394)
+++ trunk/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp	2012-06-28 01:58:22 UTC (rev 121395)
@@ -34,9 +34,12 @@
 #include "CrossThreadTask.h"
 #include "DatabaseTask.h"
 #include "Document.h"
+#include "GroupSettings.h"
 #include "KURL.h"
 #include "MessageEvent.h"
 #include "MessagePortChannel.h"
+#include "Page.h"
+#include "PageGroup.h"
 #include "PlatformMessagePortChannel.h"
 #include "SecurityOrigin.h"
 #include "ScriptExecutionContext.h"
@@ -366,7 +369,8 @@
 {
     initializeLoader(url);
     WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerContextOnStart : DontPauseWorkerContextOnStart;
-    setWorkerThread(SharedWorkerThread::create(name, url, userAgent, sourceCode, *this, *this, startMode, contentSecurityPolicy,
+    setWorkerThread(SharedWorkerThread::create(name, url, userAgent, static_cast<Document*>(m_loadingDocument.get())->page()->group().groupSettings(),
+                                               sourceCode, *this, *this, startMode, contentSecurityPolicy,
                                                static_cast<WebCore::ContentSecurityPolicy::HeaderType>(policyType)));
 
     workerThread()->start();

Modified: trunk/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp (121394 => 121395)


--- trunk/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp	2012-06-28 01:14:20 UTC (rev 121394)
+++ trunk/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp	2012-06-28 01:58:22 UTC (rev 121395)
@@ -39,10 +39,13 @@
 #include "ErrorEvent.h"
 #include "Frame.h"
 #include "FrameLoaderClient.h"
+#include "GroupSettings.h"
 #include "InspectorInstrumentation.h"
 #include "MessageEvent.h"
 #include "MessagePort.h"
 #include "MessagePortChannel.h"
+#include "Page.h"
+#include "PageGroup.h"
 #include "ScriptCallStack.h"
 #include "ScriptExecutionContext.h"
 #include "Worker.h"
@@ -86,7 +89,9 @@
 
 void WebWorkerClientImpl::startWorkerContext(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode)
 {
-    RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, sourceCode, *this, *this, startMode,
+    ASSERT(m_scriptExecutionContext->isDocument());
+    GroupSettings* settings = static_cast<Document*>(m_scriptExecutionContext.get())->page()->group().groupSettings();
+    RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, settings, sourceCode, *this, *this, startMode,
                                                                          m_scriptExecutionContext->contentSecurityPolicy()->deprecatedHeader(),
                                                                          m_scriptExecutionContext->contentSecurityPolicy()->deprecatedHeaderType());
     m_proxy->workerThreadCreated(thread);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to