Commit d01d91f8 authored by tkent@chromium.org's avatar tkent@chromium.org

Web SQL: Remove more worker-related code.

- Drop worker support from DatabaseClient.
- Remove WorkerGlobalScope support of DatabaseContext::allowDatabaseAccess.

BUG=397429
TEST=none; No behavior changes.

Review URL: https://codereview.chromium.org/564713002

git-svn-id: svn://svn.chromium.org/blink/trunk@181857 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent f0f4a144
...@@ -29,12 +29,11 @@ ...@@ -29,12 +29,11 @@
*/ */
#include "config.h" #include "config.h"
#include "DatabaseClient.h" #include "modules/webdatabase/DatabaseClient.h"
#include "core/dom/Document.h" #include "core/dom/Document.h"
#include "core/inspector/InspectorController.h" #include "core/inspector/InspectorController.h"
#include "core/page/Page.h" #include "core/page/Page.h"
#include "core/workers/WorkerGlobalScope.h"
#include "modules/webdatabase/Database.h" #include "modules/webdatabase/Database.h"
#include "modules/webdatabase/InspectorDatabaseAgent.h" #include "modules/webdatabase/InspectorDatabaseAgent.h"
...@@ -46,11 +45,7 @@ DatabaseClient::DatabaseClient() ...@@ -46,11 +45,7 @@ DatabaseClient::DatabaseClient()
DatabaseClient* DatabaseClient::from(ExecutionContext* context) DatabaseClient* DatabaseClient::from(ExecutionContext* context)
{ {
if (context->isDocument()) { return static_cast<DatabaseClient*>(WillBeHeapSupplement<Page>::from(toDocument(context)->page(), supplementName()));
return static_cast<DatabaseClient*>(WillBeHeapSupplement<Page>::from(toDocument(context)->page(), supplementName()));
}
ASSERT(context->isWorkerGlobalScope());
return static_cast<DatabaseClient*>(WillBeHeapSupplement<WorkerClients>::from(toWorkerGlobalScope(context)->clients(), supplementName()));
} }
const char* DatabaseClient::supplementName() const char* DatabaseClient::supplementName()
...@@ -79,9 +74,4 @@ void provideDatabaseClientTo(Page& page, PassOwnPtrWillBeRawPtr<DatabaseClient> ...@@ -79,9 +74,4 @@ void provideDatabaseClientTo(Page& page, PassOwnPtrWillBeRawPtr<DatabaseClient>
clientPtr->createInspectorAgentFor(&page); clientPtr->createInspectorAgentFor(&page);
} }
void provideDatabaseClientToWorker(WorkerClients* workerClients, PassOwnPtrWillBeRawPtr<DatabaseClient> client)
{
workerClients->provideSupplement(DatabaseClient::supplementName(), client);
}
} // namespace blink } // namespace blink
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#ifndef DatabaseClient_h #ifndef DatabaseClient_h
#define DatabaseClient_h #define DatabaseClient_h
#include "core/workers/WorkerClients.h" #include "platform/Supplementable.h"
#include "platform/heap/Handle.h" #include "platform/heap/Handle.h"
#include "wtf/Forward.h" #include "wtf/Forward.h"
...@@ -41,9 +41,8 @@ class Database; ...@@ -41,9 +41,8 @@ class Database;
class ExecutionContext; class ExecutionContext;
class InspectorDatabaseAgent; class InspectorDatabaseAgent;
class Page; class Page;
class WorkerClients;
class DatabaseClient : public WillBeHeapSupplement<Page>, public WillBeHeapSupplement<WorkerClients> { class DatabaseClient : public WillBeHeapSupplement<Page> {
WTF_MAKE_NONCOPYABLE(DatabaseClient); WTF_MAKE_NONCOPYABLE(DatabaseClient);
public: public:
DatabaseClient(); DatabaseClient();
...@@ -58,18 +57,11 @@ public: ...@@ -58,18 +57,11 @@ public:
void createInspectorAgentFor(Page*); void createInspectorAgentFor(Page*);
virtual void trace(Visitor* visitor) OVERRIDE
{
WillBeHeapSupplement<Page>::trace(visitor);
WillBeHeapSupplement<WorkerClients>::trace(visitor);
}
private: private:
InspectorDatabaseAgent* m_inspectorAgent; InspectorDatabaseAgent* m_inspectorAgent;
}; };
void provideDatabaseClientTo(Page&, PassOwnPtrWillBeRawPtr<DatabaseClient>); void provideDatabaseClientTo(Page&, PassOwnPtrWillBeRawPtr<DatabaseClient>);
void provideDatabaseClientToWorker(WorkerClients*, PassOwnPtrWillBeRawPtr<DatabaseClient>);
} // namespace blink } // namespace blink
......
...@@ -134,9 +134,9 @@ void DatabaseContext::contextDestroyed() ...@@ -134,9 +134,9 @@ void DatabaseContext::contextDestroyed()
ActiveDOMObject::contextDestroyed(); ActiveDOMObject::contextDestroyed();
} }
// stop() is from stopActiveDOMObjects() which indicates that the owner LocalFrame // stop() is from stopActiveDOMObjects() which indicates that the owner
// or WorkerThread is shutting down. Initiate the orderly shutdown by stopping // LocalFrame is shutting down. Initiate the orderly shutdown by stopping the
// the associated databases. // associated databases.
void DatabaseContext::stop() void DatabaseContext::stop()
{ {
stopDatabases(); stopDatabases();
...@@ -187,11 +187,7 @@ void DatabaseContext::stopDatabases() ...@@ -187,11 +187,7 @@ void DatabaseContext::stopDatabases()
bool DatabaseContext::allowDatabaseAccess() const bool DatabaseContext::allowDatabaseAccess() const
{ {
if (executionContext()->isDocument()) return toDocument(executionContext())->isActive();
return toDocument(executionContext())->isActive();
ASSERT(executionContext()->isWorkerGlobalScope());
// allowDatabaseAccess is not yet implemented for workers.
return true;
} }
SecurityOrigin* DatabaseContext::securityOrigin() const SecurityOrigin* DatabaseContext::securityOrigin() const
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#define DatabaseContext_h #define DatabaseContext_h
#include "core/dom/ActiveDOMObject.h" #include "core/dom/ActiveDOMObject.h"
#include "core/workers/WorkerGlobalScope.h"
#include "platform/heap/Handle.h" #include "platform/heap/Handle.h"
#include "wtf/PassRefPtr.h" #include "wtf/PassRefPtr.h"
#include "wtf/ThreadSafeRefCounted.h" #include "wtf/ThreadSafeRefCounted.h"
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "modules/webdatabase/DatabaseServer.h" #include "modules/webdatabase/DatabaseServer.h"
#include "modules/webdatabase/DatabaseTask.h" #include "modules/webdatabase/DatabaseTask.h"
#include "platform/weborigin/SecurityOrigin.h" #include "platform/weborigin/SecurityOrigin.h"
#include "wtf/MainThread.h"
namespace blink { namespace blink {
......
...@@ -33,10 +33,8 @@ ...@@ -33,10 +33,8 @@
#include "core/dom/Document.h" #include "core/dom/Document.h"
#include "core/dom/ExecutionContext.h" #include "core/dom/ExecutionContext.h"
#include "core/workers/WorkerGlobalScope.h"
#include "public/web/WebPermissionClient.h" #include "public/web/WebPermissionClient.h"
#include "web/WebLocalFrameImpl.h" #include "web/WebLocalFrameImpl.h"
#include "web/WorkerPermissionClient.h"
namespace blink { namespace blink {
...@@ -52,18 +50,12 @@ DatabaseClientImpl::~DatabaseClientImpl() ...@@ -52,18 +50,12 @@ DatabaseClientImpl::~DatabaseClientImpl()
bool DatabaseClientImpl::allowDatabase(ExecutionContext* executionContext, const String& name, const String& displayName, unsigned long estimatedSize) bool DatabaseClientImpl::allowDatabase(ExecutionContext* executionContext, const String& name, const String& displayName, unsigned long estimatedSize)
{ {
ASSERT(executionContext->isContextThread()); ASSERT(executionContext->isContextThread());
ASSERT(executionContext->isDocument() || executionContext->isWorkerGlobalScope()); Document* document = toDocument(executionContext);
if (executionContext->isDocument()) { WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->frame());
Document* document = toDocument(executionContext); if (!webFrame)
WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->frame()); return false;
if (!webFrame) if (webFrame->permissionClient())
return false; return webFrame->permissionClient()->allowDatabase(name, displayName, estimatedSize);
if (webFrame->permissionClient())
return webFrame->permissionClient()->allowDatabase(name, displayName, estimatedSize);
} else {
WorkerGlobalScope& workerGlobalScope = *toWorkerGlobalScope(executionContext);
return WorkerPermissionClient::from(workerGlobalScope)->allowDatabase(name, displayName, estimatedSize);
}
return true; return true;
} }
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include "core/workers/WorkerInspectorProxy.h" #include "core/workers/WorkerInspectorProxy.h"
#include "core/workers/WorkerScriptLoader.h" #include "core/workers/WorkerScriptLoader.h"
#include "core/workers/WorkerThreadStartupData.h" #include "core/workers/WorkerThreadStartupData.h"
#include "modules/webdatabase/DatabaseTask.h"
#include "platform/RuntimeEnabledFeatures.h" #include "platform/RuntimeEnabledFeatures.h"
#include "platform/heap/Handle.h" #include "platform/heap/Handle.h"
#include "platform/network/ContentSecurityPolicyParsers.h" #include "platform/network/ContentSecurityPolicyParsers.h"
...@@ -66,7 +65,6 @@ ...@@ -66,7 +65,6 @@
#include "public/web/WebSettings.h" #include "public/web/WebSettings.h"
#include "public/web/WebView.h" #include "public/web/WebView.h"
#include "public/web/WebWorkerPermissionClientProxy.h" #include "public/web/WebWorkerPermissionClientProxy.h"
#include "web/DatabaseClientImpl.h"
#include "web/LocalFileSystemClient.h" #include "web/LocalFileSystemClient.h"
#include "web/WebDataSourceImpl.h" #include "web/WebDataSourceImpl.h"
#include "web/WebLocalFrameImpl.h" #include "web/WebLocalFrameImpl.h"
...@@ -398,7 +396,6 @@ void WebSharedWorkerImpl::onScriptLoaderFinished() ...@@ -398,7 +396,6 @@ void WebSharedWorkerImpl::onScriptLoaderFinished()
OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create();
provideLocalFileSystemToWorker(workerClients.get(), LocalFileSystemClient::create()); provideLocalFileSystemToWorker(workerClients.get(), LocalFileSystemClient::create());
provideDatabaseClientToWorker(workerClients.get(), DatabaseClientImpl::create());
WebSecurityOrigin webSecurityOrigin(m_loadingDocument->securityOrigin()); WebSecurityOrigin webSecurityOrigin(m_loadingDocument->securityOrigin());
providePermissionClientToWorker(workerClients.get(), adoptPtr(client()->createWorkerPermissionClientProxy(webSecurityOrigin))); providePermissionClientToWorker(workerClients.get(), adoptPtr(client()->createWorkerPermissionClientProxy(webSecurityOrigin)));
OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create(m_url, m_loadingDocument->userAgent(m_url), m_mainScriptLoader->script(), startMode, m_contentSecurityPolicy, static_cast<ContentSecurityPolicyHeaderType>(m_policyType), workerClients.release()); OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create(m_url, m_loadingDocument->userAgent(m_url), m_mainScriptLoader->script(), startMode, m_contentSecurityPolicy, static_cast<ContentSecurityPolicyHeaderType>(m_policyType), workerClients.release());
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "public/web/WebFrameClient.h" #include "public/web/WebFrameClient.h"
#include "public/web/WebPermissionClient.h" #include "public/web/WebPermissionClient.h"
#include "public/web/WebWorkerPermissionClientProxy.h" #include "public/web/WebWorkerPermissionClientProxy.h"
#include "web/DatabaseClientImpl.h"
#include "web/LocalFileSystemClient.h" #include "web/LocalFileSystemClient.h"
#include "web/WebLocalFrameImpl.h" #include "web/WebLocalFrameImpl.h"
#include "web/WebViewImpl.h" #include "web/WebViewImpl.h"
...@@ -57,7 +56,6 @@ WorkerGlobalScopeProxy* WorkerGlobalScopeProxyProviderImpl::createWorkerGlobalSc ...@@ -57,7 +56,6 @@ WorkerGlobalScopeProxy* WorkerGlobalScopeProxyProviderImpl::createWorkerGlobalSc
WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->frame()); WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->frame());
OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create();
provideLocalFileSystemToWorker(workerClients.get(), LocalFileSystemClient::create()); provideLocalFileSystemToWorker(workerClients.get(), LocalFileSystemClient::create());
provideDatabaseClientToWorker(workerClients.get(), DatabaseClientImpl::create());
providePermissionClientToWorker(workerClients.get(), adoptPtr(webFrame->client()->createWorkerPermissionClientProxy(webFrame))); providePermissionClientToWorker(workerClients.get(), adoptPtr(webFrame->client()->createWorkerPermissionClientProxy(webFrame)));
provideServiceWorkerContainerClientToWorker(workerClients.get(), adoptPtr(webFrame->client()->createServiceWorkerProvider(webFrame))); provideServiceWorkerContainerClientToWorker(workerClients.get(), adoptPtr(webFrame->client()->createServiceWorkerProvider(webFrame)));
return new WorkerMessagingProxy(worker, workerClients.release()); return new WorkerMessagingProxy(worker, workerClients.release());
......
...@@ -48,13 +48,6 @@ WorkerPermissionClient::~WorkerPermissionClient() ...@@ -48,13 +48,6 @@ WorkerPermissionClient::~WorkerPermissionClient()
{ {
} }
bool WorkerPermissionClient::allowDatabase(const WebString& name, const WebString& displayName, unsigned long estimatedSize)
{
if (!m_proxy)
return true;
return m_proxy->allowDatabase(name, displayName, estimatedSize);
}
bool WorkerPermissionClient::requestFileSystemAccessSync() bool WorkerPermissionClient::requestFileSystemAccessSync()
{ {
if (!m_proxy) if (!m_proxy)
......
...@@ -48,7 +48,6 @@ public: ...@@ -48,7 +48,6 @@ public:
static PassOwnPtrWillBeRawPtr<WorkerPermissionClient> create(PassOwnPtr<WebWorkerPermissionClientProxy>); static PassOwnPtrWillBeRawPtr<WorkerPermissionClient> create(PassOwnPtr<WebWorkerPermissionClientProxy>);
virtual ~WorkerPermissionClient(); virtual ~WorkerPermissionClient();
bool allowDatabase(const WebString& name, const WebString& displayName, unsigned long estimatedSize);
bool requestFileSystemAccessSync(); bool requestFileSystemAccessSync();
bool allowIndexedDB(const WebString& name); bool allowIndexedDB(const WebString& name);
......
...@@ -46,6 +46,7 @@ class WebWorkerPermissionClientProxy { ...@@ -46,6 +46,7 @@ class WebWorkerPermissionClientProxy {
public: public:
virtual ~WebWorkerPermissionClientProxy() { } virtual ~WebWorkerPermissionClientProxy() { }
// Deprecated: This function should be removed.
virtual bool allowDatabase(const WebString& name, const WebString& displayName, unsigned long estimatedSize) virtual bool allowDatabase(const WebString& name, const WebString& displayName, unsigned long estimatedSize)
{ {
return true; return true;
......
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