diff options
author | alecflett@chromium.org <alecflett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-22 01:10:50 +0000 |
---|---|---|
committer | alecflett@chromium.org <alecflett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-22 01:10:50 +0000 |
commit | 631ba2b2d8fa85e59bead858b175a44e0004a352 (patch) | |
tree | 2b1987cf3d2dffec515e7dfca269307d74173634 /content | |
parent | 19d99b0a1cbc27c5ef15fec5d1e651cdf300dde0 (diff) | |
download | chromium_src-631ba2b2d8fa85e59bead858b175a44e0004a352.zip chromium_src-631ba2b2d8fa85e59bead858b175a44e0004a352.tar.gz chromium_src-631ba2b2d8fa85e59bead858b175a44e0004a352.tar.bz2 |
Proxy queryUsageAndQuota from worker process
BUG=88490
Review URL: https://codereview.chromium.org/12948002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
6 files changed, 35 insertions, 1 deletions
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index e248705..b706674 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -646,6 +646,7 @@ void RenderProcessHostImpl::CreateMessageFilters() { storage_partition_impl_->GetURLRequestContext(), storage_partition_impl_->GetMediaURLRequestContext(), storage_partition_impl_->GetAppCacheService(), + storage_partition_impl_->GetQuotaManager(), storage_partition_impl_->GetFileSystemContext(), storage_partition_impl_->GetDatabaseTracker(), storage_partition_impl_->GetIndexedDBContext()), diff --git a/content/browser/worker_host/worker_process_host.cc b/content/browser/worker_host/worker_process_host.cc index 56a2e59..faad9e2 100644 --- a/content/browser/worker_host/worker_process_host.cc +++ b/content/browser/worker_host/worker_process_host.cc @@ -27,6 +27,7 @@ #include "content/browser/mime_registry_message_filter.h" #include "content/browser/renderer_host/database_message_filter.h" #include "content/browser/renderer_host/file_utilities_message_filter.h" +#include "content/browser/renderer_host/quota_dispatcher_host.h" #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" @@ -260,6 +261,10 @@ void WorkerProcessHost::CreateMessageFilters(int render_process_id) { process_->GetHost()->AddFilter(new MimeRegistryMessageFilter()); process_->GetHost()->AddFilter( new DatabaseMessageFilter(partition_.database_tracker())); + process_->GetHost()->AddFilter(new QuotaDispatcherHost( + process_->GetData().id, + partition_.quota_manager(), + GetContentClient()->browser()->CreateQuotaPermissionContext())); SocketStreamDispatcherHost* socket_stream_dispatcher_host = new SocketStreamDispatcherHost( @@ -326,7 +331,7 @@ bool WorkerProcessHost::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowFileSystem, OnAllowFileSystem) IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowIndexedDB, OnAllowIndexedDB) IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP_EX() + IPC_END_MESSAGE_MAP_EX() if (!msg_is_ok) { NOTREACHED(); diff --git a/content/browser/worker_host/worker_storage_partition.cc b/content/browser/worker_host/worker_storage_partition.cc index ad564c3..f9d47d1 100644 --- a/content/browser/worker_host/worker_storage_partition.cc +++ b/content/browser/worker_host/worker_storage_partition.cc @@ -11,6 +11,7 @@ #include "net/url_request/url_request_context_getter.h" #include "webkit/database/database_tracker.h" #include "webkit/fileapi/file_system_context.h" +#include "webkit/quota/quota_manager.h" namespace content { @@ -18,12 +19,14 @@ WorkerStoragePartition::WorkerStoragePartition( net::URLRequestContextGetter* url_request_context, net::URLRequestContextGetter* media_url_request_context, ChromeAppCacheService* appcache_service, + quota::QuotaManager* quota_manager, fileapi::FileSystemContext* filesystem_context, webkit_database::DatabaseTracker* database_tracker, IndexedDBContextImpl* indexed_db_context) : url_request_context_(url_request_context), media_url_request_context_(media_url_request_context), appcache_service_(appcache_service), + quota_manager_(quota_manager), filesystem_context_(filesystem_context), database_tracker_(database_tracker), indexed_db_context_(indexed_db_context) { @@ -45,6 +48,7 @@ bool WorkerStoragePartition::Equals( return url_request_context_ == other.url_request_context_ && media_url_request_context_ == other.media_url_request_context_ && appcache_service_ == other.appcache_service_ && + quota_manager_ == other.quota_manager_ && filesystem_context_ == other.filesystem_context_ && database_tracker_ == other.database_tracker_ && indexed_db_context_ == other.indexed_db_context_; @@ -57,6 +61,7 @@ void WorkerStoragePartition::Copy(const WorkerStoragePartition& other) { url_request_context_ = other.url_request_context_; media_url_request_context_ = other.media_url_request_context_; appcache_service_ = other.appcache_service_; + quota_manager_ = other.quota_manager_; filesystem_context_ = other.filesystem_context_; database_tracker_ = other.database_tracker_; indexed_db_context_ = other.indexed_db_context_; diff --git a/content/browser/worker_host/worker_storage_partition.h b/content/browser/worker_host/worker_storage_partition.h index 1b59b90..49c2deae 100644 --- a/content/browser/worker_host/worker_storage_partition.h +++ b/content/browser/worker_host/worker_storage_partition.h @@ -7,6 +7,10 @@ #include "base/memory/ref_counted.h" +namespace quota { +class QuotaManager; +} + namespace fileapi { class FileSystemContext; } // namespace fileapi @@ -41,6 +45,7 @@ class WorkerStoragePartition { net::URLRequestContextGetter* url_request_context, net::URLRequestContextGetter* media_url_request_context, ChromeAppCacheService* appcache_service, + quota::QuotaManager* quota_manager, fileapi::FileSystemContext* filesystem_context, webkit_database::DatabaseTracker* database_tracker, IndexedDBContextImpl* indexed_db_context); @@ -66,6 +71,10 @@ class WorkerStoragePartition { return appcache_service_.get(); } + quota::QuotaManager* quota_manager() const { + return quota_manager_.get(); + } + fileapi::FileSystemContext* filesystem_context() const { return filesystem_context_.get(); } @@ -84,6 +93,7 @@ class WorkerStoragePartition { scoped_refptr<net::URLRequestContextGetter> url_request_context_; scoped_refptr<net::URLRequestContextGetter> media_url_request_context_; scoped_refptr<ChromeAppCacheService> appcache_service_; + scoped_refptr<quota::QuotaManager> quota_manager_; scoped_refptr<fileapi::FileSystemContext> filesystem_context_; scoped_refptr<webkit_database::DatabaseTracker> database_tracker_; scoped_refptr<IndexedDBContextImpl> indexed_db_context_; diff --git a/content/worker/websharedworkerclient_proxy.cc b/content/worker/websharedworkerclient_proxy.cc index 01913cb..049361e 100644 --- a/content/worker/websharedworkerclient_proxy.cc +++ b/content/worker/websharedworkerclient_proxy.cc @@ -9,6 +9,7 @@ #include "base/message_loop.h" #include "content/common/fileapi/file_system_dispatcher.h" #include "content/common/fileapi/webfilesystem_callback_dispatcher.h" +#include "content/common/quota_dispatcher.h" #include "content/common/webmessageportchannel_impl.h" #include "content/common/worker_messages.h" #include "content/public/common/content_switches.h" @@ -177,6 +178,14 @@ bool WebSharedWorkerClientProxy::allowIndexedDB(const WebKit::WebString& name) { return result; } +void WebSharedWorkerClientProxy::queryUsageAndQuota( + WebKit::WebStorageQuotaType type, + WebKit::WebStorageQuotaCallbacks* callbacks) { + ChildThread::current()->quota_dispatcher()->QueryStorageUsageAndQuota( + stub_->url().GetOrigin(), static_cast<quota::StorageType>(type), + QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); +} + void WebSharedWorkerClientProxy::dispatchDevToolsMessage( const WebString& message) { if (devtools_agent_) diff --git a/content/worker/websharedworkerclient_proxy.h b/content/worker/websharedworkerclient_proxy.h index bc26a29..d560628 100644 --- a/content/worker/websharedworkerclient_proxy.h +++ b/content/worker/websharedworkerclient_proxy.h @@ -11,6 +11,8 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebFileSystem.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebFileSystemType.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSharedWorkerClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaCallbacks.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaType.h" namespace WebKit { class WebApplicationCacheHost; @@ -81,6 +83,8 @@ class WebSharedWorkerClientProxy : public WebKit::WebSharedWorkerClient { bool create, WebKit::WebFileSystemCallbacks* callbacks); virtual bool allowIndexedDB(const WebKit::WebString&); + virtual void queryUsageAndQuota(WebKit::WebStorageQuotaType, + WebKit::WebStorageQuotaCallbacks*); virtual void dispatchDevToolsMessage(const WebKit::WebString&); virtual void saveDevToolsAgentState(const WebKit::WebString&); |