From c0516122e9b1da6c6584382d170cdf1533e93dfe Mon Sep 17 00:00:00 2001 From: "charles.wei@torchmobile.com.cn" Date: Tue, 3 Jul 2012 08:28:44 +0000 Subject: [PATCH] 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): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121742 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 40 ++++++++++++++++++++++ Source/WebCore/Modules/indexeddb/IDBFactory.cpp | 6 ++-- Source/WebCore/workers/DedicatedWorkerThread.cpp | 8 ++--- Source/WebCore/workers/DedicatedWorkerThread.h | 4 +-- .../workers/DefaultSharedWorkerRepository.cpp | 18 +++++++++- Source/WebCore/workers/SharedWorkerThread.cpp | 8 ++--- Source/WebCore/workers/SharedWorkerThread.h | 4 +-- Source/WebCore/workers/WorkerMessagingProxy.cpp | 9 ++++- Source/WebCore/workers/WorkerThread.cpp | 25 ++++++++++---- Source/WebCore/workers/WorkerThread.h | 4 ++- Source/WebKit/chromium/ChangeLog | 12 +++++++ Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp | 11 +++++- Source/WebKit/chromium/src/WebWorkerClientImpl.cpp | 10 +++++- 13 files changed, 134 insertions(+), 25 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index bbb89ad..809bf2f 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,43 @@ +2012-07-03 Charles Wei + + 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-07-03 Balazs Kelemen [Qt][WK2] fast/viewport/viewport-91.html still fails after r121555 and r121661 diff --git a/Source/WebCore/Modules/indexeddb/IDBFactory.cpp b/Source/WebCore/Modules/indexeddb/IDBFactory.cpp index d3de8f6..8be9d1d 100644 --- a/Source/WebCore/Modules/indexeddb/IDBFactory.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBFactory.cpp @@ -94,12 +94,14 @@ PassRefPtr IDBFactory::open(ScriptExecutionContext* context, const S return 0; Frame* frame = document->frame(); RefPtr 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 request = IDBRequest::create(context, IDBAny::create(this), 0); - m_backend->openFromWorker(name, request.get(), context->securityOrigin(), static_cast(context), String()); + WorkerContext* workerContext = static_cast(context); + GroupSettings* groupSettings = workerContext->thread()->groupSettings(); + m_backend->openFromWorker(name, request.get(), context->securityOrigin(), workerContext, groupSettings ? groupSettings->indexedDBDatabasePath() : String()); return request; #else return 0; diff --git a/Source/WebCore/workers/DedicatedWorkerThread.cpp b/Source/WebCore/workers/DedicatedWorkerThread.cpp index 5f60dd8..678ce83 100644 --- a/Source/WebCore/workers/DedicatedWorkerThread.cpp +++ b/Source/WebCore/workers/DedicatedWorkerThread.cpp @@ -39,13 +39,13 @@ namespace WebCore { -PassRefPtr 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::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) { } diff --git a/Source/WebCore/workers/DedicatedWorkerThread.h b/Source/WebCore/workers/DedicatedWorkerThread.h index 12a44da..91e4c82 100644 --- a/Source/WebCore/workers/DedicatedWorkerThread.h +++ b/Source/WebCore/workers/DedicatedWorkerThread.h @@ -41,7 +41,7 @@ namespace WebCore { class DedicatedWorkerThread : public WorkerThread { public: - static PassRefPtr create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); + static PassRefPtr 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 @@ namespace WebCore { 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; }; diff --git a/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp b/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp index 0db3480..1fa8a00 100644 --- a/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp +++ b/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp @@ -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 @@ public: // 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); void close(); @@ -160,6 +163,19 @@ bool SharedWorkerProxy::postTaskForModeToWorkerContext(PassOwnPtrpage()) + return document->page()->group().groupSettings(); + + return 0; +} + static void postExceptionTask(ScriptExecutionContext* context, const String& errorMessage, int lineNumber, const String& sourceURL) { context->reportException(errorMessage, lineNumber, sourceURL, 0); @@ -343,7 +359,7 @@ void DefaultSharedWorkerRepository::workerScriptLoaded(SharedWorkerProxy& proxy, // 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 thread = SharedWorkerThread::create(proxy.name(), proxy.url(), userAgent, workerScript, proxy, proxy, DontPauseWorkerContextOnStart, contentSecurityPolicy, contentSecurityPolicyType); + RefPtr thread = SharedWorkerThread::create(proxy.name(), proxy.url(), userAgent, proxy.groupSettings(), workerScript, proxy, proxy, DontPauseWorkerContextOnStart, contentSecurityPolicy, contentSecurityPolicyType); proxy.setThread(thread); thread->start(); } diff --git a/Source/WebCore/workers/SharedWorkerThread.cpp b/Source/WebCore/workers/SharedWorkerThread.cpp index 13432ec..50a89c8 100644 --- a/Source/WebCore/workers/SharedWorkerThread.cpp +++ b/Source/WebCore/workers/SharedWorkerThread.cpp @@ -38,13 +38,13 @@ namespace WebCore { -PassRefPtr 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::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()) { } diff --git a/Source/WebCore/workers/SharedWorkerThread.h b/Source/WebCore/workers/SharedWorkerThread.h index a58230d..3b35ed1 100644 --- a/Source/WebCore/workers/SharedWorkerThread.h +++ b/Source/WebCore/workers/SharedWorkerThread.h @@ -39,14 +39,14 @@ namespace WebCore { class SharedWorkerThread : public WorkerThread { public: - static PassRefPtr create(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); + static PassRefPtr 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 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; }; diff --git a/Source/WebCore/workers/WorkerMessagingProxy.cpp b/Source/WebCore/workers/WorkerMessagingProxy.cpp index a72b4c2..6f839f0 100644 --- a/Source/WebCore/workers/WorkerMessagingProxy.cpp +++ b/Source/WebCore/workers/WorkerMessagingProxy.cpp @@ -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,13 @@ WorkerMessagingProxy::~WorkerMessagingProxy() void WorkerMessagingProxy::startWorkerContext(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode) { - RefPtr thread = DedicatedWorkerThread::create(scriptURL, userAgent, sourceCode, *this, *this, startMode, + // FIXME: This need to be revisited when we support nested worker one day + ASSERT(m_scriptExecutionContext->isDocument()); + Document* document = static_cast(m_scriptExecutionContext.get()); + GroupSettings* settings = 0; + if (document->page()) + settings = document->page()->group().groupSettings(); + RefPtr thread = DedicatedWorkerThread::create(scriptURL, userAgent, settings, sourceCode, *this, *this, startMode, m_scriptExecutionContext->contentSecurityPolicy()->deprecatedHeader(), m_scriptExecutionContext->contentSecurityPolicy()->deprecatedHeaderType()); workerThreadCreated(thread); diff --git a/Source/WebCore/workers/WorkerThread.cpp b/Source/WebCore/workers/WorkerThread.cpp index 26ebd7e..9bde800 100644 --- a/Source/WebCore/workers/WorkerThread.cpp +++ b/Source/WebCore/workers/WorkerThread.cpp @@ -71,22 +71,23 @@ unsigned WorkerThread::workerThreadCount() struct WorkerThreadStartupData { WTF_MAKE_NONCOPYABLE(WorkerThreadStartupData); WTF_MAKE_FAST_ALLOCATED; public: - static PassOwnPtr create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) + static PassOwnPtr 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 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 @@ WorkerThreadStartupData::WorkerThreadStartupData(const KURL& scriptURL, const St , 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().isolatedCopy()); } -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 @@ void WorkerThread::runEventLoop() m_runLoop.run(m_workerContext.get()); } +GroupSettings* WorkerThread::groupSettings() +{ + return m_startupData->m_groupSettings.get(); +} + class WorkerThreadShutdownFinishTask : public ScriptExecutionContext::Task { public: static PassOwnPtr create() diff --git a/Source/WebCore/workers/WorkerThread.h b/Source/WebCore/workers/WorkerThread.h index 60c59d3..5b17513 100644 --- a/Source/WebCore/workers/WorkerThread.h +++ b/Source/WebCore/workers/WorkerThread.h @@ -30,6 +30,7 @@ #if ENABLE(WORKERS) #include "ContentSecurityPolicy.h" +#include "GroupSettings.h" #include "WorkerRunLoop.h" #include #include @@ -61,6 +62,7 @@ namespace WebCore { // 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 @@ namespace WebCore { #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 createWorkerContext(const KURL&, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType) = 0; diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 854da5a..665063f 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,15 @@ +2012-07-03 Charles Wei + + 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-07-02 Sheriff Bot Unreviewed. Rolled DEPS. diff --git a/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp b/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp index e44a1b4..100bceb 100644 --- a/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp +++ b/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp @@ -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,13 @@ void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& { initializeLoader(url); WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerContextOnStart : DontPauseWorkerContextOnStart; - setWorkerThread(SharedWorkerThread::create(name, url, userAgent, sourceCode, *this, *this, startMode, contentSecurityPolicy, + ASSERT(m_loadingDocument->isDocument()); + Document* document = static_cast(m_loadingDocument.get()); + GroupSettings* settings = 0; + if (document->page()) + settings = document->page()->group().groupSettings(); + setWorkerThread(SharedWorkerThread::create(name, url, userAgent, settings, + sourceCode, *this, *this, startMode, contentSecurityPolicy, static_cast(policyType))); workerThread()->start(); diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp index aee7b1d..8089991 100644 --- a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp @@ -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,12 @@ WorkerContextProxy* WebWorkerClientImpl::createWorkerContextProxy(Worker* worker void WebWorkerClientImpl::startWorkerContext(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode) { - RefPtr thread = DedicatedWorkerThread::create(scriptURL, userAgent, sourceCode, *this, *this, startMode, + ASSERT(m_scriptExecutionContext->isDocument()); + Document* document = static_cast(m_scriptExecutionContext.get()); + GroupSettings* settings = 0; + if (document->page()) + settings = document->page()->group().groupSettings(); + RefPtr thread = DedicatedWorkerThread::create(scriptURL, userAgent, settings, sourceCode, *this, *this, startMode, m_scriptExecutionContext->contentSecurityPolicy()->deprecatedHeader(), m_scriptExecutionContext->contentSecurityPolicy()->deprecatedHeaderType()); m_proxy->workerThreadCreated(thread); -- 2.7.4