Index: content/renderer/dom_storage/dom_storage_dispatcher.cc |
diff --git a/content/renderer/dom_storage/dom_storage_dispatcher.cc b/content/renderer/dom_storage/dom_storage_dispatcher.cc |
index 5963694377729c2f912f6df5f077fd6005ebe142..ce942c963b5e83a15b3551273031477d62ded60e 100644 |
--- a/content/renderer/dom_storage/dom_storage_dispatcher.cc |
+++ b/content/renderer/dom_storage/dom_storage_dispatcher.cc |
@@ -13,6 +13,7 @@ |
#include "content/renderer/dom_storage/webstoragearea_impl.h" |
#include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
#include "content/renderer/render_thread_impl.h" |
+#include "ipc/ipc_sync_message_filter.h" |
#include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispatcher.h" |
@@ -103,7 +104,7 @@ class DomStorageDispatcher::ProxyImpl : public DomStorageProxy { |
// Methods for use by DomStorageDispatcher directly. |
DomStorageCachedArea* OpenCachedArea( |
- int64 namespace_id, const GURL& origin); |
+ int64 namespace_id, const GURL& origin, int64 storage_size); |
void CloseCachedArea(DomStorageCachedArea* area); |
DomStorageCachedArea* LookupCachedArea( |
int64 namespace_id, const GURL& origin); |
@@ -179,14 +180,14 @@ DomStorageDispatcher::ProxyImpl::ProxyImpl(RenderThreadImpl* sender) |
} |
DomStorageCachedArea* DomStorageDispatcher::ProxyImpl::OpenCachedArea( |
- int64 namespace_id, const GURL& origin) { |
+ int64 namespace_id, const GURL& origin, int64 storage_size) { |
std::string key = GetCachedAreaKey(namespace_id, origin); |
if (CachedAreaHolder* holder = GetAreaHolder(key)) { |
++(holder->open_count_); |
return holder->area_; |
} |
scoped_refptr<DomStorageCachedArea> area = |
- new DomStorageCachedArea(namespace_id, origin, this); |
+ new DomStorageCachedArea(namespace_id, origin, this, storage_size); |
cached_areas_[key] = CachedAreaHolder(area, 1); |
return area.get(); |
} |
@@ -269,10 +270,17 @@ DomStorageDispatcher::~DomStorageDispatcher() { |
scoped_refptr<DomStorageCachedArea> DomStorageDispatcher::OpenCachedArea( |
int connection_id, int64 namespace_id, const GURL& origin) { |
+ /* |
RenderThreadImpl::current()->Send( |
new DOMStorageHostMsg_OpenStorageArea( |
connection_id, namespace_id, origin)); |
- return proxy_->OpenCachedArea(namespace_id, origin); |
+ */ |
+ scoped_refptr<IPC::SyncMessageFilter> sync_msg_filter( |
+ RenderThreadImpl::current()->sync_message_filter()); |
+ int64 storage_size = 0; |
+ sync_msg_filter->Send(new DOMStorageHostMsg_OpenStorageArea( |
+ connection_id, namespace_id, origin, &storage_size)); |
+ return proxy_->OpenCachedArea(namespace_id, origin, storage_size); |
} |
void DomStorageDispatcher::CloseCachedArea( |
@@ -302,11 +310,15 @@ void DomStorageDispatcher::OnStorageEvent( |
if (originated_in_process) { |
originating_area = WebStorageAreaImpl::FromConnectionId( |
params.connection_id); |
+ originating_area->cached_area()->set_global_storage_size( |
+ params.storage_size); |
} else { |
DomStorageCachedArea* cached_area = proxy_->LookupCachedArea( |
params.namespace_id, params.origin); |
- if (cached_area) |
+ if (cached_area) { |
cached_area->ApplyMutation(params.key, params.new_value); |
+ cached_area->set_global_storage_size(params.storage_size); |
+ } |
} |
if (params.namespace_id == dom_storage::kLocalStorageNamespaceId) { |