summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/in_process_webkit/browser_webkitclient_impl.cc6
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_area.cc8
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_area.h11
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_context.cc30
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_context.h24
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc341
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h117
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_message_filter.cc226
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_message_filter.h95
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_message_filter_unittest.cc (renamed from chrome/browser/in_process_webkit/dom_storage_dispatcher_host_unittest.cc)5
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_namespace.cc2
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc2
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc17
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.h7
-rw-r--r--chrome/chrome_browser.gypi4
-rw-r--r--chrome/chrome_common.gypi2
-rw-r--r--chrome/chrome_tests.gypi2
-rw-r--r--chrome/common/dom_storage_common.h4
-rw-r--r--chrome/common/dom_storage_messages.cc125
-rw-r--r--chrome/common/dom_storage_messages.h125
-rw-r--r--chrome/common/render_messages.h70
-rw-r--r--chrome/common/render_messages_internal.h49
-rw-r--r--chrome/common/render_messages_params.cc46
-rw-r--r--chrome/common/render_messages_params.h33
-rw-r--r--chrome/renderer/render_thread.cc14
-rw-r--r--chrome/renderer/render_thread.h4
-rw-r--r--chrome/renderer/renderer_webstoragearea_impl.cc28
-rw-r--r--chrome/test/render_view_test.cc1
-rw-r--r--ipc/ipc_message_impl_macros.h55
-rw-r--r--ipc/ipc_message_macros.h64
-rw-r--r--ipc/ipc_message_utils.h1
31 files changed, 771 insertions, 747 deletions
diff --git a/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc b/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc
index df541e8..57a0a14 100644
--- a/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc
+++ b/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc
@@ -6,7 +6,7 @@
#include "base/file_util.h"
#include "base/logging.h"
-#include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h"
+#include "chrome/browser/in_process_webkit/dom_storage_message_filter.h"
#include "chrome/browser/in_process_webkit/indexed_db_key_utility_client.h"
#include "chrome/common/indexed_db_key.h"
#include "chrome/common/serialized_script_value.h"
@@ -131,8 +131,8 @@ void BrowserWebKitClientImpl::dispatchStorageEvent(
if (!is_local_storage)
return;
- DOMStorageDispatcherHost::DispatchStorageEvent(key, old_value, new_value,
- origin, url, is_local_storage);
+ DOMStorageMessageFilter::DispatchStorageEvent(key, old_value, new_value,
+ origin, url, is_local_storage);
}
WebKit::WebSharedWorkerRepository*
diff --git a/chrome/browser/in_process_webkit/dom_storage_area.cc b/chrome/browser/in_process_webkit/dom_storage_area.cc
index d0d9cbf..fdf2ebc 100644
--- a/chrome/browser/in_process_webkit/dom_storage_area.cc
+++ b/chrome/browser/in_process_webkit/dom_storage_area.cc
@@ -7,7 +7,6 @@
#include "base/task.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/in_process_webkit/dom_storage_context.h"
-#include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h"
#include "chrome/browser/in_process_webkit/dom_storage_namespace.h"
#include "chrome/common/render_messages.h"
#include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h"
@@ -55,8 +54,8 @@ NullableString16 DOMStorageArea::GetItem(const string16& key) {
NullableString16 DOMStorageArea::SetItem(
const string16& key, const string16& value,
- WebStorageArea::Result* result, DOMStorageDispatcherHost* sender) {
- if (!CheckContentSetting(key, value, sender)) {
+ WebStorageArea::Result* result) {
+ if (!CheckContentSetting(key, value)) {
*result = WebStorageArea::ResultBlockedByPolicy;
return NullableString16(true); // Ignored if the content was blocked.
}
@@ -91,8 +90,7 @@ void DOMStorageArea::CreateWebStorageAreaIfNecessary() {
}
bool DOMStorageArea::CheckContentSetting(
- const string16& key, const string16& value,
- DOMStorageDispatcherHost* sender) {
+ const string16& key, const string16& value) {
ContentSetting content_setting =
host_content_settings_map_->GetContentSetting(
origin_url_, CONTENT_SETTINGS_TYPE_COOKIES, "");
diff --git a/chrome/browser/in_process_webkit/dom_storage_area.h b/chrome/browser/in_process_webkit/dom_storage_area.h
index 7740bb9..cf5a0c7 100644
--- a/chrome/browser/in_process_webkit/dom_storage_area.h
+++ b/chrome/browser/in_process_webkit/dom_storage_area.h
@@ -15,7 +15,6 @@
#include "googleurl/src/gurl.h"
#include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h"
-class DOMStorageDispatcherHost;
class DOMStorageNamespace;
class HostContentSettingsMap;
@@ -32,14 +31,9 @@ class DOMStorageArea {
unsigned Length();
NullableString16 Key(unsigned index);
NullableString16 GetItem(const string16& key);
- // The DOMStorageDispatcherHost parameter is required in case we get a
- // CONTENT_SETTING_ASK response from the HostContentettingsMap. If we do,
- // we'll need to let the renderer know that it'll need to run a nested message
- // loop.
NullableString16 SetItem(
const string16& key, const string16& value,
- WebKit::WebStorageArea::Result* result,
- DOMStorageDispatcherHost* sender);
+ WebKit::WebStorageArea::Result* result);
NullableString16 RemoveItem(const string16& key);
bool Clear();
void PurgeMemory();
@@ -53,8 +47,7 @@ class DOMStorageArea {
void CreateWebStorageAreaIfNecessary();
// Used to see if setItem has permission to do its thing.
- bool CheckContentSetting(const string16& key, const string16& value,
- DOMStorageDispatcherHost* sender);
+ bool CheckContentSetting(const string16& key, const string16& value);
// The origin this storage area represents.
string16 origin_;
diff --git a/chrome/browser/in_process_webkit/dom_storage_context.cc b/chrome/browser/in_process_webkit/dom_storage_context.cc
index fe30f18..1d6d627 100644
--- a/chrome/browser/in_process_webkit/dom_storage_context.cc
+++ b/chrome/browser/in_process_webkit/dom_storage_context.cc
@@ -72,9 +72,9 @@ DOMStorageContext::DOMStorageContext(WebKitContext* webkit_context)
}
DOMStorageContext::~DOMStorageContext() {
- // This should not go away until all DOM Storage Dispatcher hosts have gone
+ // This should not go away until all DOM Storage message filters have gone
// away. And they remove themselves from this list.
- DCHECK(dispatcher_host_set_.empty());
+ DCHECK(message_filter_set_.empty());
for (StorageNamespaceMap::iterator iter(storage_namespace_map_.begin());
iter != storage_namespace_map_.end(); ++iter) {
@@ -157,26 +157,26 @@ DOMStorageNamespace* DOMStorageContext::GetStorageNamespace(
return CreateSessionStorage(id);
}
-void DOMStorageContext::RegisterDispatcherHost(
- DOMStorageDispatcherHost* dispatcher_host) {
+void DOMStorageContext::RegisterMessageFilter(
+ DOMStorageMessageFilter* message_filter) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- DCHECK(dispatcher_host_set_.find(dispatcher_host) ==
- dispatcher_host_set_.end());
- dispatcher_host_set_.insert(dispatcher_host);
+ DCHECK(message_filter_set_.find(message_filter) ==
+ message_filter_set_.end());
+ message_filter_set_.insert(message_filter);
}
-void DOMStorageContext::UnregisterDispatcherHost(
- DOMStorageDispatcherHost* dispatcher_host) {
+void DOMStorageContext::UnregisterMessageFilter(
+ DOMStorageMessageFilter* message_filter) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- DCHECK(dispatcher_host_set_.find(dispatcher_host) !=
- dispatcher_host_set_.end());
- dispatcher_host_set_.erase(dispatcher_host);
+ DCHECK(message_filter_set_.find(message_filter) !=
+ message_filter_set_.end());
+ message_filter_set_.erase(message_filter);
}
-const DOMStorageContext::DispatcherHostSet*
-DOMStorageContext::GetDispatcherHostSet() const {
+const DOMStorageContext::MessageFilterSet*
+DOMStorageContext::GetMessageFilterSet() const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- return &dispatcher_host_set_;
+ return &message_filter_set_;
}
void DOMStorageContext::PurgeMemory() {
diff --git a/chrome/browser/in_process_webkit/dom_storage_context.h b/chrome/browser/in_process_webkit/dom_storage_context.h
index 49ff1f5..68993f4 100644
--- a/chrome/browser/in_process_webkit/dom_storage_context.h
+++ b/chrome/browser/in_process_webkit/dom_storage_context.h
@@ -14,15 +14,15 @@
#include "base/time.h"
class DOMStorageArea;
-class DOMStorageDispatcherHost;
+class DOMStorageMessageFilter;
class DOMStorageNamespace;
class WebKitContext;
// This is owned by WebKitContext and is all the dom storage information that's
-// shared by all the ResourceMessageFilter/DOMStorageDispatcherHosts that share
-// the same profile. The specifics of responsibilities are fairly well
-// documented here and in StorageNamespace and StorageArea. Everything is only
-// to be accessed on the WebKit thread unless noted otherwise.
+// shared by all the DOMStorageMessageFilters that share the same profile. The
+// specifics of responsibilities are fairly well documented here and in
+// StorageNamespace and StorageArea. Everything is only to be accessed on the
+// WebKit thread unless noted otherwise.
//
// NOTE: Virtual methods facilitate mocking functions for testing.
class DOMStorageContext {
@@ -54,12 +54,12 @@ class DOMStorageContext {
// namespace if it hasn't been already.
DOMStorageNamespace* GetStorageNamespace(int64 id, bool allocation_allowed);
- // Sometimes an event from one DOM storage dispatcher host requires
+ // Sometimes an event from one DOM storage message filter requires
// communication to all of them.
- typedef std::set<DOMStorageDispatcherHost*> DispatcherHostSet;
- void RegisterDispatcherHost(DOMStorageDispatcherHost* dispatcher_host);
- void UnregisterDispatcherHost(DOMStorageDispatcherHost* dispatcher_host);
- const DispatcherHostSet* GetDispatcherHostSet() const;
+ typedef std::set<DOMStorageMessageFilter*> MessageFilterSet;
+ void RegisterMessageFilter(DOMStorageMessageFilter* message_filter);
+ void UnregisterMessageFilter(DOMStorageMessageFilter* MessageFilter);
+ const MessageFilterSet* GetMessageFilterSet() const;
// Tells storage namespaces to purge any memory they do not need.
virtual void PurgeMemory();
@@ -133,9 +133,9 @@ class DOMStorageContext {
// make it point directly to the dom storage path.
FilePath data_path_;
- // All the DOMStorageDispatcherHosts that are attached to us. ONLY USE ON THE
+ // All the DOMStorageMessageFilters that are attached to us. ONLY USE ON THE
// IO THREAD!
- DispatcherHostSet dispatcher_host_set_;
+ MessageFilterSet message_filter_set_;
// Maps ids to StorageAreas. We do NOT own these objects. StorageNamespace
// (which does own them) will notify us when we should remove the entries.
diff --git a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc
deleted file mode 100644
index 9e8bcb9..0000000
--- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc
+++ /dev/null
@@ -1,341 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h"
-
-#include "base/nullable_string16.h"
-#include "chrome/browser/browser_thread.h"
-#include "chrome/browser/in_process_webkit/dom_storage_area.h"
-#include "chrome/browser/in_process_webkit/dom_storage_context.h"
-#include "chrome/browser/in_process_webkit/dom_storage_namespace.h"
-#include "chrome/browser/net/chrome_url_request_context.h"
-#include "chrome/browser/renderer_host/browser_render_process_host.h"
-#include "chrome/browser/renderer_host/render_view_host_notification_task.h"
-#include "chrome/browser/renderer_host/resource_message_filter.h"
-#include "chrome/common/render_messages.h"
-#include "chrome/common/render_messages_params.h"
-#include "googleurl/src/gurl.h"
-
-using WebKit::WebStorageArea;
-
-DOMStorageDispatcherHost* DOMStorageDispatcherHost::storage_event_host_ = NULL;
-const GURL* DOMStorageDispatcherHost::storage_event_url_ = NULL;
-
-DOMStorageDispatcherHost::
-ScopedStorageEventContext::ScopedStorageEventContext(
- DOMStorageDispatcherHost* dispatcher_host, const GURL* url) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
- DCHECK(!storage_event_host_);
- DCHECK(!storage_event_url_);
- storage_event_host_ = dispatcher_host;
- storage_event_url_ = url;
- DCHECK(storage_event_host_);
- DCHECK(storage_event_url_);
-}
-
-DOMStorageDispatcherHost::
-ScopedStorageEventContext::~ScopedStorageEventContext() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
- DCHECK(storage_event_host_);
- DCHECK(storage_event_url_);
- storage_event_host_ = NULL;
- storage_event_url_ = NULL;
-}
-
-DOMStorageDispatcherHost::DOMStorageDispatcherHost(
- ResourceMessageFilter* resource_message_filter,
- WebKitContext* webkit_context)
- : webkit_context_(webkit_context),
- resource_message_filter_(resource_message_filter),
- process_handle_(0),
- process_id_(0) {
- DCHECK(webkit_context_.get());
- DCHECK(resource_message_filter_);
-}
-
-DOMStorageDispatcherHost::~DOMStorageDispatcherHost() {
-}
-
-void DOMStorageDispatcherHost::Init(int process_id,
- base::ProcessHandle process_handle) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- DCHECK(resource_message_filter_); // Ensure Shutdown() has not been called.
- DCHECK(!process_handle_); // Make sure Init() has not yet been called.
- DCHECK(process_handle);
- Context()->RegisterDispatcherHost(this);
- process_id_ = process_id;
- process_handle_ = process_handle;
-}
-
-void DOMStorageDispatcherHost::Shutdown() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- // This is not always true during testing.
- if (process_handle_)
- Context()->UnregisterDispatcherHost(this);
- resource_message_filter_ = NULL;
-}
-
-/* static */
-void DOMStorageDispatcherHost::DispatchStorageEvent(const NullableString16& key,
- const NullableString16& old_value, const NullableString16& new_value,
- const string16& origin, const GURL& url, bool is_local_storage) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
- DCHECK(is_local_storage); // Only LocalStorage is implemented right now.
- DCHECK(storage_event_host_);
- ViewMsg_DOMStorageEvent_Params params;
- params.key_ = key;
- params.old_value_ = old_value;
- params.new_value_ = new_value;
- params.origin_ = origin;
- params.url_ = *storage_event_url_; // The url passed in is junk.
- params.storage_type_ = is_local_storage ? DOM_STORAGE_LOCAL
- : DOM_STORAGE_SESSION;
- // The storage_event_host_ is the DOMStorageDispatcherHost that is up in the
- // current call stack since it caused the storage event to fire.
- BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(storage_event_host_,
- &DOMStorageDispatcherHost::OnStorageEvent, params));
-}
-
-bool DOMStorageDispatcherHost::OnMessageReceived(const IPC::Message& message,
- bool* msg_is_ok) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- DCHECK(process_handle_);
-
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP_EX(DOMStorageDispatcherHost, message, *msg_is_ok)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_DOMStorageStorageAreaId,
- OnStorageAreaId)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_DOMStorageLength, OnLength)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_DOMStorageKey, OnKey)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_DOMStorageGetItem, OnGetItem)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_DOMStorageSetItem, OnSetItem)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_DOMStorageRemoveItem,
- OnRemoveItem)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_DOMStorageClear, OnClear)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
-int64 DOMStorageDispatcherHost::CloneSessionStorage(int64 original_id) {
- return Context()->CloneSessionStorage(original_id);
-}
-
-void DOMStorageDispatcherHost::Send(IPC::Message* message) {
- if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
- // TODO(jorlow): Even if we successfully post, I believe it's possible for
- // the task to never run (if the IO thread is already shutting
- // down). We may want to handle this case, though
- // realistically it probably doesn't matter.
- if (!BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE, NewRunnableMethod(
- this, &DOMStorageDispatcherHost::Send, message))) {
- // The IO thread is dead.
- delete message;
- }
- return;
- }
-
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (!resource_message_filter_)
- delete message;
- else
- resource_message_filter_->Send(message);
-}
-
-void DOMStorageDispatcherHost::OnStorageAreaId(int64 namespace_id,
- const string16& origin,
- IPC::Message* reply_msg) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- ChromeURLRequestContext* url_request_context =
- resource_message_filter_->GetRequestContextForURL(GURL(origin));
- BrowserThread::PostTask(BrowserThread::WEBKIT, FROM_HERE, NewRunnableMethod(
- this, &DOMStorageDispatcherHost::OnStorageAreaIdWebKit, namespace_id,
- origin, reply_msg,
- make_scoped_refptr(url_request_context->host_content_settings_map())));
-}
-
-void DOMStorageDispatcherHost::OnStorageAreaIdWebKit(
- int64 namespace_id, const string16& origin, IPC::Message* reply_msg,
- HostContentSettingsMap* host_content_settings_map) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
- DOMStorageNamespace* storage_namespace =
- Context()->GetStorageNamespace(namespace_id, true);
- if (!storage_namespace) {
- BrowserRenderProcessHost::BadMessageTerminateProcess(
- ViewHostMsg_DOMStorageStorageAreaId::ID, process_handle_);
- delete reply_msg;
- return;
- }
- DOMStorageArea* storage_area = storage_namespace->GetStorageArea(
- origin, host_content_settings_map);
- ViewHostMsg_DOMStorageStorageAreaId::WriteReplyParams(reply_msg,
- storage_area->id());
- Send(reply_msg);
-}
-
-void DOMStorageDispatcherHost::OnLength(int64 storage_area_id,
- IPC::Message* reply_msg) {
- if (BrowserThread::CurrentlyOn(BrowserThread::IO)) {
- BrowserThread::PostTask(BrowserThread::WEBKIT, FROM_HERE, NewRunnableMethod(
- this, &DOMStorageDispatcherHost::OnLength, storage_area_id, reply_msg));
- return;
- }
-
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
- DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id);
- if (!storage_area) {
- BrowserRenderProcessHost::BadMessageTerminateProcess(
- ViewHostMsg_DOMStorageLength::ID, process_handle_);
- delete reply_msg;
- return;
- }
- unsigned length = storage_area->Length();
- ViewHostMsg_DOMStorageLength::WriteReplyParams(reply_msg, length);
- Send(reply_msg);
-}
-
-void DOMStorageDispatcherHost::OnKey(int64 storage_area_id, unsigned index,
- IPC::Message* reply_msg) {
- if (BrowserThread::CurrentlyOn(BrowserThread::IO)) {
- BrowserThread::PostTask(BrowserThread::WEBKIT, FROM_HERE, NewRunnableMethod(
- this, &DOMStorageDispatcherHost::OnKey, storage_area_id, index,
- reply_msg));
- return;
- }
-
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
- DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id);
- if (!storage_area) {
- BrowserRenderProcessHost::BadMessageTerminateProcess(
- ViewHostMsg_DOMStorageKey::ID, process_handle_);
- delete reply_msg;
- return;
- }
- const NullableString16& key = storage_area->Key(index);
- ViewHostMsg_DOMStorageKey::WriteReplyParams(reply_msg, key);
- Send(reply_msg);
-}
-
-void DOMStorageDispatcherHost::OnGetItem(int64 storage_area_id,
- const string16& key,
- IPC::Message* reply_msg) {
- if (BrowserThread::CurrentlyOn(BrowserThread::IO)) {
- BrowserThread::PostTask(BrowserThread::WEBKIT, FROM_HERE, NewRunnableMethod(
- this, &DOMStorageDispatcherHost::OnGetItem, storage_area_id, key,
- reply_msg));
- return;
- }
-
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
- DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id);
- if (!storage_area) {
- BrowserRenderProcessHost::BadMessageTerminateProcess(
- ViewHostMsg_DOMStorageGetItem::ID, process_handle_);
- delete reply_msg;
- return;
- }
- const NullableString16& value = storage_area->GetItem(key);
- ViewHostMsg_DOMStorageGetItem::WriteReplyParams(reply_msg, value);
- Send(reply_msg);
-}
-
-void DOMStorageDispatcherHost::OnSetItem(
- int64 storage_area_id, const string16& key, const string16& value,
- const GURL& url, IPC::Message* reply_msg) {
- if (BrowserThread::CurrentlyOn(BrowserThread::IO)) {
- BrowserThread::PostTask(BrowserThread::WEBKIT, FROM_HERE, NewRunnableMethod(
- this, &DOMStorageDispatcherHost::OnSetItem, storage_area_id, key, value,
- url, reply_msg));
- return;
- }
-
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
- DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id);
- if (!storage_area) {
- BrowserRenderProcessHost::BadMessageTerminateProcess(
- ViewHostMsg_DOMStorageSetItem::ID, process_handle_);
- return;
- }
-
- ScopedStorageEventContext scope(this, &url);
- WebStorageArea::Result result;
- NullableString16 old_value = storage_area->SetItem(key, value, &result, this);
-
- // If content was blocked, tell the UI to display the blocked content icon.
- if (reply_msg->routing_id() == MSG_ROUTING_CONTROL) {
- DLOG(WARNING) << "setItem was not given a proper routing id";
- } else {
- CallRenderViewHostContentSettingsDelegate(
- process_id_, reply_msg->routing_id(),
- &RenderViewHostDelegate::ContentSettings::OnLocalStorageAccessed,
- url, storage_area->owner()->dom_storage_type(),
- result == WebStorageArea::ResultBlockedByPolicy);
- }
-
- ViewHostMsg_DOMStorageSetItem::WriteReplyParams(reply_msg, result, old_value);
- Send(reply_msg);
-}
-
-void DOMStorageDispatcherHost::OnRemoveItem(
- int64 storage_area_id, const string16& key, const GURL& url,
- IPC::Message* reply_msg) {
- if (BrowserThread::CurrentlyOn(BrowserThread::IO)) {
- BrowserThread::PostTask(BrowserThread::WEBKIT, FROM_HERE, NewRunnableMethod(
- this, &DOMStorageDispatcherHost::OnRemoveItem, storage_area_id, key,
- url, reply_msg));
- return;
- }
-
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
- DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id);
- if (!storage_area) {
- BrowserRenderProcessHost::BadMessageTerminateProcess(
- ViewHostMsg_DOMStorageRemoveItem::ID, process_handle_);
- return;
- }
-
- ScopedStorageEventContext scope(this, &url);
- NullableString16 old_value = storage_area->RemoveItem(key);
- ViewHostMsg_DOMStorageRemoveItem::WriteReplyParams(reply_msg, old_value);
- Send(reply_msg);
-}
-
-void DOMStorageDispatcherHost::OnClear(int64 storage_area_id, const GURL& url,
- IPC::Message* reply_msg) {
- if (BrowserThread::CurrentlyOn(BrowserThread::IO)) {
- BrowserThread::PostTask(BrowserThread::WEBKIT, FROM_HERE, NewRunnableMethod(
- this, &DOMStorageDispatcherHost::OnClear, storage_area_id, url,
- reply_msg));
- return;
- }
-
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
- DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id);
- if (!storage_area) {
- BrowserRenderProcessHost::BadMessageTerminateProcess(
- ViewHostMsg_DOMStorageClear::ID, process_handle_);
- return;
- }
-
- ScopedStorageEventContext scope(this, &url);
- bool something_cleared = storage_area->Clear();
- ViewHostMsg_DOMStorageClear::WriteReplyParams(reply_msg, something_cleared);
- Send(reply_msg);
-}
-
-void DOMStorageDispatcherHost::OnStorageEvent(
- const ViewMsg_DOMStorageEvent_Params& params) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- const DOMStorageContext::DispatcherHostSet* set =
- Context()->GetDispatcherHostSet();
- DOMStorageContext::DispatcherHostSet::const_iterator cur = set->begin();
- while (cur != set->end()) {
- // The renderer that generates the event handles it itself.
- if (*cur != this)
- (*cur)->Send(new ViewMsg_DOMStorageEvent(params));
- ++cur;
- }
-}
diff --git a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h
deleted file mode 100644
index 736e55d..0000000
--- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_DISPATCHER_HOST_H_
-#define CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_DISPATCHER_HOST_H_
-#pragma once
-
-#include "base/process.h"
-#include "base/ref_counted.h"
-#include "base/tracked.h"
-#include "chrome/browser/in_process_webkit/dom_storage_area.h"
-#include "chrome/browser/in_process_webkit/webkit_context.h"
-#include "chrome/common/dom_storage_common.h"
-#include "ipc/ipc_message.h"
-
-class DOMStorageContext;
-class GURL;
-class HostContentSettingsMap;
-class ResourceMessageFilter;
-class Task;
-struct ViewMsg_DOMStorageEvent_Params;
-
-// This class handles the logistics of DOM Storage within the browser process.
-// It mostly ferries information between IPCs and the WebKit implementations,
-// but it also handles some special cases like when renderer processes die.
-class DOMStorageDispatcherHost
- : public base::RefCountedThreadSafe<DOMStorageDispatcherHost> {
- public:
- // Only call the constructor from the UI thread.
- DOMStorageDispatcherHost(
- ResourceMessageFilter* resource_message_filter,
- WebKitContext* webkit_context);
-
- // Only call from ResourceMessageFilter on the IO thread.
- void Init(int process_id, base::ProcessHandle process_handle);
-
- // Only call from ResourceMessageFilter on the IO thread. Calls self on the
- // WebKit thread in some cases.
- void Shutdown();
-
- // Only call from ResourceMessageFilter on the IO thread.
- bool OnMessageReceived(const IPC::Message& message, bool* msg_is_ok);
-
- // Clones a session storage namespace and returns the cloned namespaces' id.
- // Only call on the IO thread.
- int64 CloneSessionStorage(int64 original_id);
-
- // Send a message to the renderer process associated with our
- // message_sender_ via the IO thread. May be called from any thread.
- void Send(IPC::Message* message);
-
- // Only call on the WebKit thread.
- static void DispatchStorageEvent(const NullableString16& key,
- const NullableString16& old_value, const NullableString16& new_value,
- const string16& origin, const GURL& url, bool is_local_storage);
-
- private:
- friend class base::RefCountedThreadSafe<DOMStorageDispatcherHost>;
- ~DOMStorageDispatcherHost();
-
- // Message Handlers.
- void OnStorageAreaId(int64 namespace_id, const string16& origin,
- IPC::Message* reply_msg);
- void OnLength(int64 storage_area_id, IPC::Message* reply_msg);
- void OnKey(int64 storage_area_id, unsigned index, IPC::Message* reply_msg);
- void OnGetItem(int64 storage_area_id, const string16& key,
- IPC::Message* reply_msg);
- void OnSetItem(int64 storage_area_id, const string16& key,
- const string16& value, const GURL& url,
- IPC::Message* reply_msg);
- void OnRemoveItem(int64 storage_area_id, const string16& key,
- const GURL& url, IPC::Message* reply_msg);
- void OnClear(int64 storage_area_id, const GURL& url, IPC::Message* reply_msg);
-
- // WebKit thread half of OnStorageAreaId
- void OnStorageAreaIdWebKit(
- int64 namespace_id, const string16& origin, IPC::Message* reply_msg,
- HostContentSettingsMap* host_context_settings_map);
-
- // Only call on the IO thread.
- void OnStorageEvent(const ViewMsg_DOMStorageEvent_Params& params);
-
- // A shortcut for accessing our context.
- DOMStorageContext* Context() {
- return webkit_context_->dom_storage_context();
- }
-
- // Use whenever there's a chance OnStorageEvent will be called.
- class ScopedStorageEventContext {
- public:
- ScopedStorageEventContext(DOMStorageDispatcherHost* dispatcher_host,
- const GURL* url);
- ~ScopedStorageEventContext();
- };
-
- // Only access on the WebKit thread! Used for storage events.
- static DOMStorageDispatcherHost* storage_event_host_;
- static const GURL* storage_event_url_;
-
- // Data shared between renderer processes with the same profile.
- scoped_refptr<WebKitContext> webkit_context_;
-
- // Only set and use on the IO thread.
- ResourceMessageFilter* resource_message_filter_;
-
- // If we get a corrupt message from a renderer, we need to kill it using this
- // handle.
- base::ProcessHandle process_handle_;
-
- // Used to dispatch messages to the correct view host.
- int process_id_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageDispatcherHost);
-};
-
-#endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_DISPATCHER_HOST_H_
diff --git a/chrome/browser/in_process_webkit/dom_storage_message_filter.cc b/chrome/browser/in_process_webkit/dom_storage_message_filter.cc
new file mode 100644
index 0000000..f98fc74
--- /dev/null
+++ b/chrome/browser/in_process_webkit/dom_storage_message_filter.cc
@@ -0,0 +1,226 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/in_process_webkit/dom_storage_message_filter.h"
+
+#include "base/nullable_string16.h"
+#include "chrome/browser/browser_thread.h"
+#include "chrome/browser/in_process_webkit/dom_storage_area.h"
+#include "chrome/browser/in_process_webkit/dom_storage_context.h"
+#include "chrome/browser/in_process_webkit/dom_storage_namespace.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/renderer_host/browser_render_process_host.h"
+#include "chrome/browser/renderer_host/render_view_host_notification_task.h"
+#include "chrome/common/dom_storage_messages.h"
+#include "chrome/common/url_constants.h"
+#include "googleurl/src/gurl.h"
+
+using WebKit::WebStorageArea;
+
+DOMStorageMessageFilter* DOMStorageMessageFilter::storage_event_message_filter =
+ NULL;
+const GURL* DOMStorageMessageFilter::storage_event_url_ = NULL;
+
+DOMStorageMessageFilter::
+ScopedStorageEventContext::ScopedStorageEventContext(
+ DOMStorageMessageFilter* dispatcher_message_filter, const GURL* url) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
+ DCHECK(!storage_event_message_filter);
+ DCHECK(!storage_event_url_);
+ storage_event_message_filter = dispatcher_message_filter;
+ storage_event_url_ = url;
+ DCHECK(storage_event_message_filter);
+ DCHECK(storage_event_url_);
+}
+
+DOMStorageMessageFilter::
+ScopedStorageEventContext::~ScopedStorageEventContext() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
+ DCHECK(storage_event_message_filter);
+ DCHECK(storage_event_url_);
+ storage_event_message_filter = NULL;
+ storage_event_url_ = NULL;
+}
+
+DOMStorageMessageFilter::DOMStorageMessageFilter(int process_id,
+ Profile* profile)
+ : webkit_context_(profile->GetWebKitContext()),
+ process_id_(process_id),
+ host_content_settings_map_(profile->GetHostContentSettingsMap()) {
+}
+
+DOMStorageMessageFilter::~DOMStorageMessageFilter() {
+ // This is not always true during testing.
+ if (peer_handle())
+ Context()->UnregisterMessageFilter(this);
+}
+
+void DOMStorageMessageFilter::OnChannelConnected(int32 peer_pid) {
+ BrowserMessageFilter::OnChannelConnected(peer_pid);
+
+ Context()->RegisterMessageFilter(this);
+}
+
+/* static */
+void DOMStorageMessageFilter::DispatchStorageEvent(const NullableString16& key,
+ const NullableString16& old_value, const NullableString16& new_value,
+ const string16& origin, const GURL& url, bool is_local_storage) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
+ DCHECK(is_local_storage); // Only LocalStorage is implemented right now.
+ DCHECK(storage_event_message_filter);
+ DOMStorageMsg_Event_Params params;
+ params.key = key;
+ params.old_value = old_value;
+ params.new_value = new_value;
+ params.origin = origin;
+ params.url = *storage_event_url_; // The url passed in is junk.
+ params.storage_type = is_local_storage ? DOM_STORAGE_LOCAL
+ : DOM_STORAGE_SESSION;
+ // The storage_event_message_filter is the DOMStorageMessageFilter that is up
+ // in the current call stack since it caused the storage event to fire.
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ NewRunnableMethod(storage_event_message_filter,
+ &DOMStorageMessageFilter::OnStorageEvent, params));
+}
+
+bool DOMStorageMessageFilter::OnMessageReceived(const IPC::Message& message,
+ bool* message_was_ok) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP_EX(DOMStorageMessageFilter, message, *message_was_ok)
+ IPC_MESSAGE_HANDLER(DOMStorageHostMsg_StorageAreaId, OnStorageAreaId)
+ IPC_MESSAGE_HANDLER(DOMStorageHostMsg_Length, OnLength)
+ IPC_MESSAGE_HANDLER(DOMStorageHostMsg_Key, OnKey)
+ IPC_MESSAGE_HANDLER(DOMStorageHostMsg_GetItem, OnGetItem)
+ IPC_MESSAGE_HANDLER(DOMStorageHostMsg_SetItem, OnSetItem)
+ IPC_MESSAGE_HANDLER(DOMStorageHostMsg_RemoveItem, OnRemoveItem)
+ IPC_MESSAGE_HANDLER(DOMStorageHostMsg_Clear, OnClear)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+
+ return handled;
+}
+
+void DOMStorageMessageFilter::OverrideThreadForMessage(
+ const IPC::Message& message,
+ BrowserThread::ID* thread) {
+ if (IPC_MESSAGE_CLASS(message) == DOMStorageMsgStart)
+ *thread = BrowserThread::WEBKIT;
+}
+
+void DOMStorageMessageFilter::OnStorageAreaId(int64 namespace_id,
+ const string16& origin,
+ int64* storage_area_id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
+
+ DOMStorageNamespace* storage_namespace =
+ Context()->GetStorageNamespace(namespace_id, true);
+ if (!storage_namespace) {
+ BadMessageReceived(DOMStorageHostMsg_StorageAreaId::ID);
+ return;
+ }
+ DOMStorageArea* storage_area = storage_namespace->GetStorageArea(
+ origin, host_content_settings_map_);
+ *storage_area_id = storage_area->id();
+}
+
+void DOMStorageMessageFilter::OnLength(int64 storage_area_id,
+ unsigned* length) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
+ DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id);
+ if (!storage_area) {
+ BadMessageReceived(DOMStorageHostMsg_Length::ID);
+ return;
+ }
+ *length = storage_area->Length();
+}
+
+void DOMStorageMessageFilter::OnKey(int64 storage_area_id, unsigned index,
+ NullableString16* key) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
+ DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id);
+ if (!storage_area) {
+ BadMessageReceived(DOMStorageHostMsg_Key::ID);
+ return;
+ }
+ *key = storage_area->Key(index);
+}
+
+void DOMStorageMessageFilter::OnGetItem(int64 storage_area_id,
+ const string16& key,
+ NullableString16* value) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
+ DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id);
+ if (!storage_area) {
+ BadMessageReceived(DOMStorageHostMsg_GetItem::ID);
+ return;
+ }
+ *value = storage_area->GetItem(key);
+}
+
+void DOMStorageMessageFilter::OnSetItem(
+ int render_view_id, int64 storage_area_id, const string16& key,
+ const string16& value, const GURL& url,
+ WebKit::WebStorageArea::Result* result, NullableString16* old_value) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
+ DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id);
+ if (!storage_area) {
+ BadMessageReceived(DOMStorageHostMsg_SetItem::ID);
+ return;
+ }
+
+ ScopedStorageEventContext scope(this, &url);
+ *old_value = storage_area->SetItem(key, value, result);
+
+ // If content was blocked, tell the UI to display the blocked content icon.
+ if (render_view_id == MSG_ROUTING_CONTROL) {
+ DLOG(WARNING) << "setItem was not given a proper routing id";
+ } else {
+ CallRenderViewHostContentSettingsDelegate(
+ process_id_, render_view_id,
+ &RenderViewHostDelegate::ContentSettings::OnLocalStorageAccessed,
+ url, storage_area->owner()->dom_storage_type(),
+ *result == WebStorageArea::ResultBlockedByPolicy);
+ }
+}
+
+void DOMStorageMessageFilter::OnRemoveItem(
+ int64 storage_area_id, const string16& key, const GURL& url,
+ NullableString16* old_value) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
+ DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id);
+ if (!storage_area) {
+ BadMessageReceived(DOMStorageHostMsg_RemoveItem::ID);
+ return;
+ }
+
+ ScopedStorageEventContext scope(this, &url);
+ *old_value = storage_area->RemoveItem(key);
+}
+
+void DOMStorageMessageFilter::OnClear(int64 storage_area_id, const GURL& url,
+ bool* something_cleared) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
+ DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id);
+ if (!storage_area) {
+ BadMessageReceived(DOMStorageHostMsg_Clear::ID);
+ return;
+ }
+
+ ScopedStorageEventContext scope(this, &url);
+ *something_cleared = storage_area->Clear();
+}
+
+void DOMStorageMessageFilter::OnStorageEvent(
+ const DOMStorageMsg_Event_Params& params) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ const DOMStorageContext::MessageFilterSet* set =
+ Context()->GetMessageFilterSet();
+ DOMStorageContext::MessageFilterSet::const_iterator cur = set->begin();
+ while (cur != set->end()) {
+ // The renderer that generates the event handles it itself.
+ if (*cur != this)
+ (*cur)->Send(new DOMStorageMsg_Event(params));
+ ++cur;
+ }
+}
diff --git a/chrome/browser/in_process_webkit/dom_storage_message_filter.h b/chrome/browser/in_process_webkit/dom_storage_message_filter.h
new file mode 100644
index 0000000..eea02d0
--- /dev/null
+++ b/chrome/browser/in_process_webkit/dom_storage_message_filter.h
@@ -0,0 +1,95 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_MESSAGE_FILTER_H_
+#define CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_MESSAGE_FILTER_H_
+#pragma once
+
+#include "base/process.h"
+#include "base/ref_counted.h"
+#include "base/tracked.h"
+#include "chrome/browser/browser_message_filter.h"
+#include "chrome/browser/in_process_webkit/dom_storage_area.h"
+#include "chrome/browser/in_process_webkit/webkit_context.h"
+#include "chrome/browser/content_settings/host_content_settings_map.h"
+#include "chrome/common/dom_storage_common.h"
+#include "ipc/ipc_message.h"
+
+class DOMStorageContext;
+class GURL;
+class Profile;
+struct DOMStorageMsg_Event_Params;
+
+// This class handles the logistics of DOM Storage within the browser process.
+// It mostly ferries information between IPCs and the WebKit implementations,
+// but it also handles some special cases like when renderer processes die.
+class DOMStorageMessageFilter : public BrowserMessageFilter {
+ public:
+ // Only call the constructor from the UI thread.
+ DOMStorageMessageFilter(int process_id, Profile* profile);
+
+ // BrowserMessageFilter implementation
+ virtual void OnChannelConnected(int32 peer_pid);
+ virtual void OverrideThreadForMessage(const IPC::Message& message,
+ BrowserThread::ID* thread);
+ virtual bool OnMessageReceived(const IPC::Message& message,
+ bool* message_was_ok);
+
+ // Only call on the WebKit thread.
+ static void DispatchStorageEvent(const NullableString16& key,
+ const NullableString16& old_value, const NullableString16& new_value,
+ const string16& origin, const GURL& url, bool is_local_storage);
+
+ private:
+ friend class base::RefCountedThreadSafe<DOMStorageMessageFilter>;
+ ~DOMStorageMessageFilter();
+
+ // Message Handlers.
+ void OnStorageAreaId(int64 namespace_id, const string16& origin,
+ int64* storage_area_id);
+ void OnLength(int64 storage_area_id, unsigned* length);
+ void OnKey(int64 storage_area_id, unsigned index, NullableString16* key);
+ void OnGetItem(int64 storage_area_id, const string16& key,
+ NullableString16* value);
+ void OnSetItem(int render_view_id, int64 storage_area_id, const string16& key,
+ const string16& value, const GURL& url,
+ WebKit::WebStorageArea::Result* result,
+ NullableString16* old_value);
+ void OnRemoveItem(int64 storage_area_id, const string16& key,
+ const GURL& url, NullableString16* old_value);
+ void OnClear(int64 storage_area_id, const GURL& url, bool* something_cleared);
+
+ // Only call on the IO thread.
+ void OnStorageEvent(const DOMStorageMsg_Event_Params& params);
+
+ // A shortcut for accessing our context.
+ DOMStorageContext* Context() {
+ return webkit_context_->dom_storage_context();
+ }
+
+ // Use whenever there's a chance OnStorageEvent will be called.
+ class ScopedStorageEventContext {
+ public:
+ ScopedStorageEventContext(
+ DOMStorageMessageFilter* dispatcher_message_filter,
+ const GURL* url);
+ ~ScopedStorageEventContext();
+ };
+
+ // Only access on the WebKit thread! Used for storage events.
+ static DOMStorageMessageFilter* storage_event_message_filter;
+ static const GURL* storage_event_url_;
+
+ // Data shared between renderer processes with the same profile.
+ scoped_refptr<WebKitContext> webkit_context_;
+
+ // Used to dispatch messages to the correct view host.
+ int process_id_;
+
+ scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageMessageFilter);
+};
+
+#endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_MESSAGE_FILTER_H_
diff --git a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host_unittest.cc b/chrome/browser/in_process_webkit/dom_storage_message_filter_unittest.cc
index a277492..c56ee71 100644
--- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host_unittest.cc
+++ b/chrome/browser/in_process_webkit/dom_storage_message_filter_unittest.cc
@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h"
+#include "chrome/browser/in_process_webkit/dom_storage_message_filter.h"
#include "testing/gtest/include/gtest/gtest.h"
-// TODO(jorlow): Write once dom_storage_dispatcher_host is more than just a
-// stub.
+// TODO(jorlow): Write me
diff --git a/chrome/browser/in_process_webkit/dom_storage_namespace.cc b/chrome/browser/in_process_webkit/dom_storage_namespace.cc
index b0cfaf4..a663a05 100644
--- a/chrome/browser/in_process_webkit/dom_storage_namespace.cc
+++ b/chrome/browser/in_process_webkit/dom_storage_namespace.cc
@@ -7,7 +7,7 @@
#include "base/file_path.h"
#include "chrome/browser/in_process_webkit/dom_storage_area.h"
#include "chrome/browser/in_process_webkit/dom_storage_context.h"
-#include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h"
+#include "chrome/browser/in_process_webkit/dom_storage_message_filter.h"
#include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h"
#include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h"
#include "webkit/glue/webkit_glue.h"
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index aff7ee6..f38401e 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -39,6 +39,7 @@
#include "chrome/browser/file_system/file_system_dispatcher_host.h"
#include "chrome/browser/gpu_process_host.h"
#include "chrome/browser/history/history.h"
+#include "chrome/browser/in_process_webkit/dom_storage_message_filter.h"
#include "chrome/browser/io_thread.h"
#include "chrome/browser/mime_registry_message_filter.h"
#include "chrome/browser/platform_util.h"
@@ -396,6 +397,7 @@ void BrowserRenderProcessHost::CreateMessageFilters() {
channel_->AddFilter(new AudioRendererHost());
channel_->AddFilter(
new AppCacheDispatcherHost(profile()->GetRequestContext(), id()));
+ channel_->AddFilter(new DOMStorageMessageFilter(id(), profile()));
channel_->AddFilter(new PepperFileMessageFilter(id(), profile()));
channel_->AddFilter(new speech_input::SpeechInputDispatcherHost(id()));
channel_->AddFilter(
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index fe88078..ceda6a3 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -25,7 +25,6 @@
#include "chrome/browser/geolocation/geolocation_permission_context.h"
#include "chrome/browser/gpu_process_host.h"
#include "chrome/browser/host_zoom_map.h"
-#include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h"
#include "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h"
#include "chrome/browser/metrics/histogram_synchronizer.h"
#include "chrome/browser/nacl_host/nacl_process_host.h"
@@ -247,8 +246,6 @@ ResourceMessageFilter::ResourceMessageFilter(
media_request_context_(profile->GetRequestContextForMedia()),
extensions_request_context_(profile->GetRequestContextForExtensions()),
render_widget_helper_(render_widget_helper),
- ALLOW_THIS_IN_INITIALIZER_LIST(dom_storage_dispatcher_host_(
- new DOMStorageDispatcherHost(this, profile->GetWebKitContext()))),
ALLOW_THIS_IN_INITIALIZER_LIST(indexed_db_dispatcher_host_(
new IndexedDBDispatcherHost(this, profile))),
notification_prefs_(
@@ -259,11 +256,11 @@ ResourceMessageFilter::ResourceMessageFilter(
render_widget_helper, &RenderWidgetHelper::GetNextRoutingID)),
ALLOW_THIS_IN_INITIALIZER_LIST(geolocation_dispatcher_host_(
GeolocationDispatcherHostOld::New(
- this->id(), profile->GetGeolocationPermissionContext()))) {
+ this->id(), profile->GetGeolocationPermissionContext()))),
+ webkit_context_(profile->GetWebKitContext()) {
request_context_ = profile_->GetRequestContext();
DCHECK(request_context_);
DCHECK(media_request_context_);
- DCHECK(dom_storage_dispatcher_host_.get());
render_widget_helper_->Init(id(), resource_dispatcher_host_);
#if defined(OS_CHROMEOS)
@@ -278,9 +275,6 @@ ResourceMessageFilter::~ResourceMessageFilter() {
// This function should be called on the IO thread.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- // Tell the DOM Storage dispatcher host to stop sending messages via us.
- dom_storage_dispatcher_host_->Shutdown();
-
// Tell the Indexed DB dispatcher host to stop sending messages via us.
indexed_db_dispatcher_host_->Shutdown();
@@ -311,7 +305,6 @@ void ResourceMessageFilter::OnChannelConnected(int32 peer_pid) {
set_handle(peer_handle);
WorkerService::GetInstance()->Initialize(resource_dispatcher_host_);
- dom_storage_dispatcher_host_->Init(id(), handle());
indexed_db_dispatcher_host_->Init(id(), handle());
}
@@ -337,7 +330,6 @@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& msg) {
bool msg_is_ok = true;
bool handled =
resource_dispatcher_host_->OnMessageReceived(msg, this, &msg_is_ok) ||
- dom_storage_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok) ||
indexed_db_dispatcher_host_->OnMessageReceived(msg) ||
mp_dispatcher->OnMessageReceived(
msg, this, next_route_id_callback(), &msg_is_ok) ||
@@ -564,8 +556,9 @@ URLRequestContext* ResourceMessageFilter::GetRequestContext(
void ResourceMessageFilter::OnMsgCreateWindow(
const ViewHostMsg_CreateWindow_Params& params,
int* route_id, int64* cloned_session_storage_namespace_id) {
- *cloned_session_storage_namespace_id = dom_storage_dispatcher_host_->
- CloneSessionStorage(params.session_storage_namespace_id);
+ *cloned_session_storage_namespace_id =
+ webkit_context_->dom_storage_context()->CloneSessionStorage(
+ params.session_storage_namespace_id);
render_widget_helper_->CreateNewWindow(params.opener_id,
params.user_gesture,
params.window_container_type,
diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h
index 5d30051..2b7a214 100644
--- a/chrome/browser/renderer_host/resource_message_filter.h
+++ b/chrome/browser/renderer_host/resource_message_filter.h
@@ -23,6 +23,7 @@
#include "base/string16.h"
#include "base/task.h"
#include "build/build_config.h"
+#include "chrome/browser/in_process_webkit/webkit_context.h"
#include "chrome/browser/net/resolve_proxy_msg_helper.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/common/content_settings.h"
@@ -32,7 +33,6 @@
#include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h"
class ChromeURLRequestContext;
-class DOMStorageDispatcherHost;
struct FontDescriptor;
class GeolocationDispatcherHostOld;
class HostZoomMap;
@@ -430,9 +430,6 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
scoped_refptr<RenderWidgetHelper> render_widget_helper_;
- // Handles DOM Storage related messages.
- scoped_refptr<DOMStorageDispatcherHost> dom_storage_dispatcher_host_;
-
// Handles Indexed Database related messages.
scoped_refptr<IndexedDBDispatcherHost> indexed_db_dispatcher_host_;
@@ -459,6 +456,8 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
// Used to handle geolocation-related messages.
scoped_refptr<GeolocationDispatcherHostOld> geolocation_dispatcher_host_;
+ scoped_refptr<WebKitContext> webkit_context_;
+
DISALLOW_COPY_AND_ASSIGN(ResourceMessageFilter);
};
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index abdcdcb..56fa836 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1695,8 +1695,8 @@
'browser/in_process_webkit/dom_storage_area.h',
'browser/in_process_webkit/dom_storage_context.cc',
'browser/in_process_webkit/dom_storage_context.h',
- 'browser/in_process_webkit/dom_storage_dispatcher_host.cc',
- 'browser/in_process_webkit/dom_storage_dispatcher_host.h',
+ 'browser/in_process_webkit/dom_storage_message_filter.cc',
+ 'browser/in_process_webkit/dom_storage_message_filter.h',
'browser/in_process_webkit/dom_storage_namespace.cc',
'browser/in_process_webkit/dom_storage_namespace.h',
'browser/in_process_webkit/indexed_db_callbacks.cc',
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index dc292b3..1118732 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -55,6 +55,8 @@
'common/devtools_messages.cc',
'common/devtools_messages.h',
'common/devtools_messages_internal.h',
+ 'common/dom_storage_messages.cc',
+ 'common/dom_storage_messages.h',
'common/dx_diag_node.cc',
'common/dx_diag_node.h',
'common/file_system/webfilesystem_callback_dispatcher.cc',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 6abcfd7..4ecf428 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1213,7 +1213,7 @@
'browser/importer/safari_importer_unittest.mm',
'browser/importer/toolbar_importer_unittest.cc',
'browser/instant/instant_loader_manager_unittest.cc',
- 'browser/in_process_webkit/dom_storage_dispatcher_host_unittest.cc',
+ 'browser/in_process_webkit/dom_storage_message_filter_unittest.cc',
'browser/in_process_webkit/webkit_context_unittest.cc',
'browser/in_process_webkit/webkit_thread_unittest.cc',
'browser/instant/promo_counter_unittest.cc',
diff --git a/chrome/common/dom_storage_common.h b/chrome/common/dom_storage_common.h
index 21ba19c..5946384 100644
--- a/chrome/common/dom_storage_common.h
+++ b/chrome/common/dom_storage_common.h
@@ -6,6 +6,10 @@
#define CHROME_COMMON_DOM_STORAGE_COMMON_H_
#pragma once
+#include "build/build_config.h"
+
+#include "base/basictypes.h"
+
const int64 kLocalStorageNamespaceId = 0;
const int64 kInvalidSessionStorageNamespaceId = kLocalStorageNamespaceId;
diff --git a/chrome/common/dom_storage_messages.cc b/chrome/common/dom_storage_messages.cc
new file mode 100644
index 0000000..9aee345
--- /dev/null
+++ b/chrome/common/dom_storage_messages.cc
@@ -0,0 +1,125 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/common_param_traits.h"
+
+#define IPC_MESSAGE_IMPL
+#include "chrome/common/dom_storage_messages.h"
+
+DOMStorageMsg_Event_Params::DOMStorageMsg_Event_Params()
+ : storage_type(DOM_STORAGE_LOCAL) {
+}
+
+DOMStorageMsg_Event_Params::~DOMStorageMsg_Event_Params() {
+}
+
+namespace IPC {
+
+void ParamTraits<DOMStorageMsg_Event_Params>::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, p.key);
+ WriteParam(m, p.old_value);
+ WriteParam(m, p.new_value);
+ WriteParam(m, p.origin);
+ WriteParam(m, p.url);
+ WriteParam(m, p.storage_type);
+}
+
+bool ParamTraits<DOMStorageMsg_Event_Params>::Read(const Message* m,
+ void** iter,
+ param_type* p) {
+ return
+ ReadParam(m, iter, &p->key) &&
+ ReadParam(m, iter, &p->old_value) &&
+ ReadParam(m, iter, &p->new_value) &&
+ ReadParam(m, iter, &p->origin) &&
+ ReadParam(m, iter, &p->url) &&
+ ReadParam(m, iter, &p->storage_type);
+}
+
+void ParamTraits<DOMStorageMsg_Event_Params>::Log(const param_type& p,
+ std::string* l) {
+ l->append("(");
+ LogParam(p.key, l);
+ l->append(", ");
+ LogParam(p.old_value, l);
+ l->append(", ");
+ LogParam(p.new_value, l);
+ l->append(", ");
+ LogParam(p.origin, l);
+ l->append(", ");
+ LogParam(p.url, l);
+ l->append(", ");
+ LogParam(p.storage_type, l);
+ l->append(")");
+}
+
+void ParamTraits<DOMStorageType>::Write(Message* m, const param_type& p) {
+ m->WriteInt(p);
+}
+
+bool ParamTraits<DOMStorageType>::Read(const Message* m,
+ void** iter,
+ param_type* p) {
+ int type;
+ if (!m->ReadInt(iter, &type))
+ return false;
+ *p = static_cast<param_type>(type);
+ return true;
+}
+
+void ParamTraits<DOMStorageType>::Log(const param_type& p, std::string* l) {
+ std::string control;
+ switch (p) {
+ case DOM_STORAGE_LOCAL:
+ control = "DOM_STORAGE_LOCAL";
+ break;
+ case DOM_STORAGE_SESSION:
+ control = "DOM_STORAGE_SESSION";
+ break;
+ default:
+ NOTIMPLEMENTED();
+ control = "UNKNOWN";
+ break;
+ }
+ LogParam(control, l);
+}
+
+void ParamTraits<WebKit::WebStorageArea::Result>::Write(Message* m,
+ const param_type& p) {
+ m->WriteInt(p);
+}
+
+bool ParamTraits<WebKit::WebStorageArea::Result>::Read(const Message* m,
+ void** iter,
+ param_type* p) {
+ int type;
+ if (!m->ReadInt(iter, &type))
+ return false;
+ *p = static_cast<param_type>(type);
+ return true;
+}
+
+void ParamTraits<WebKit::WebStorageArea::Result>::Log(const param_type& p,
+ std::string* l) {
+ std::string control;
+ switch (p) {
+ case WebKit::WebStorageArea::ResultOK:
+ control = "WebKit::WebStorageArea::ResultOK";
+ break;
+ case WebKit::WebStorageArea::ResultBlockedByQuota:
+ control = "WebKit::WebStorageArea::ResultBlockedByQuota";
+ break;
+ case WebKit::WebStorageArea::ResultBlockedByPolicy:
+ control = "WebKit::WebStorageArea::ResultBlockedByPolicy";
+ break;
+ default:
+ NOTIMPLEMENTED();
+ control = "UNKNOWN";
+ break;
+ }
+ LogParam(control, l);
+}
+
+} // namespace IPC
diff --git a/chrome/common/dom_storage_messages.h b/chrome/common/dom_storage_messages.h
new file mode 100644
index 0000000..e36f517
--- /dev/null
+++ b/chrome/common/dom_storage_messages.h
@@ -0,0 +1,125 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_COMMON_DOM_STORAGE_MESSAGES_H_
+#define CHROME_COMMON_DOM_STORAGE_MESSAGES_H_
+#pragma once
+
+#include "chrome/common/dom_storage_common.h"
+#include "googleurl/src/gurl.h"
+#include "ipc/ipc_message_macros.h"
+#include "ipc/ipc_param_traits.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h"
+
+#define IPC_MESSAGE_START DOMStorageMsgStart
+
+// Signals a storage event.
+struct DOMStorageMsg_Event_Params {
+ DOMStorageMsg_Event_Params();
+ ~DOMStorageMsg_Event_Params();
+
+ // The key that generated the storage event. Null if clear() was called.
+ NullableString16 key;
+
+ // The old value of this key. Null on clear() or if it didn't have a value.
+ NullableString16 old_value;
+
+ // The new value of this key. Null on removeItem() or clear().
+ NullableString16 new_value;
+
+ // The origin this is associated with.
+ string16 origin;
+
+ // The URL of the page that caused the storage event.
+ GURL url;
+
+ // The storage type of this event.
+ DOMStorageType storage_type;
+};
+
+namespace IPC {
+
+template <>
+struct ParamTraits<DOMStorageMsg_Event_Params> {
+ typedef DOMStorageMsg_Event_Params param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, void** iter, param_type* p);
+ static void Log(const param_type& p, std::string* l);
+};
+
+template <>
+struct ParamTraits<DOMStorageType> {
+ typedef DOMStorageType param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, void** iter, param_type* p);
+ static void Log(const param_type& p, std::string* l);
+};
+
+template <>
+struct ParamTraits<WebKit::WebStorageArea::Result> {
+ typedef WebKit::WebStorageArea::Result param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, void** iter, param_type* p);
+ static void Log(const param_type& p, std::string* l);
+};
+
+} // namespace IPC
+
+// DOM Storage messages sent from the browser to the renderer.
+
+// Storage events are broadcast to renderer processes.
+IPC_MESSAGE_CONTROL1(DOMStorageMsg_Event,
+ DOMStorageMsg_Event_Params)
+
+
+// DOM Storage messages sent from the renderer to the browser.
+
+
+// Get the storage area id for a particular origin within a namespace.
+IPC_SYNC_MESSAGE_CONTROL2_1(DOMStorageHostMsg_StorageAreaId,
+ int64 /* namespace_id */,
+ string16 /* origin */,
+ int64 /* storage_area_id */)
+
+// Get the length of a storage area.
+IPC_SYNC_MESSAGE_CONTROL1_1(DOMStorageHostMsg_Length,
+ int64 /* storage_area_id */,
+ unsigned /* length */)
+
+// Get a the ith key within a storage area.
+IPC_SYNC_MESSAGE_CONTROL2_1(DOMStorageHostMsg_Key,
+ int64 /* storage_area_id */,
+ unsigned /* index */,
+ NullableString16 /* key */)
+
+// Get a value based on a key from a storage area.
+IPC_SYNC_MESSAGE_CONTROL2_1(DOMStorageHostMsg_GetItem,
+ int64 /* storage_area_id */,
+ string16 /* key */,
+ NullableString16 /* value */)
+
+// Set a value that's associated with a key in a storage area.
+IPC_SYNC_MESSAGE_CONTROL5_2(DOMStorageHostMsg_SetItem,
+ int /* routing_id */,
+ int64 /* storage_area_id */,
+ string16 /* key */,
+ string16 /* value */,
+ GURL /* url */,
+ WebKit::WebStorageArea::Result /* result */,
+ NullableString16 /* old_value */)
+
+// Remove the value associated with a key in a storage area.
+IPC_SYNC_MESSAGE_CONTROL3_1(DOMStorageHostMsg_RemoveItem,
+ int64 /* storage_area_id */,
+ string16 /* key */,
+ GURL /* url */,
+ NullableString16 /* old_value */)
+
+// Clear the storage area.
+IPC_SYNC_MESSAGE_CONTROL2_1(DOMStorageHostMsg_Clear,
+ int64 /* storage_area_id */,
+ GURL /* url */,
+ bool /* something_cleared */)
+
+#endif // CHROME_COMMON_DOM_STORAGE_MESSAGES_H_
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 0d3eb80..b7de06d 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -17,7 +17,6 @@
#include "base/string16.h"
#include "chrome/common/common_param_traits.h"
#include "chrome/common/css_colors.h"
-#include "chrome/common/dom_storage_common.h"
#include "chrome/common/indexed_db_param_traits.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/common/translate_errors.h"
@@ -25,7 +24,6 @@
#include "chrome/common/webkit_param_traits.h"
#include "ipc/ipc_message_utils.h"
#include "ipc/ipc_platform_file.h" // ifdefed typedef.
-#include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h"
#include "webkit/appcache/appcache_interfaces.h" // enum appcache::Status
#include "webkit/fileapi/file_system_types.h" // enum fileapi::FileSystemType
#include "webkit/glue/plugins/pepper_dir_contents.h"
@@ -103,7 +101,6 @@ struct ViewHostMsg_DidPrintPage_Params;
struct ViewHostMsg_Audio_CreateStream_Params;
struct ViewHostMsg_ShowPopup_Params;
struct ViewHostMsg_ScriptedPrint_Params;
-struct ViewMsg_DOMStorageEvent_Params;
struct ViewHostMsg_IDBFactoryOpen_Params;
struct ViewHostMsg_IDBDatabaseCreateObjectStore_Params;
struct ViewHostMsg_IDBIndexOpenCursor_Params;
@@ -480,73 +477,6 @@ struct ParamTraits<EditCommand> {
static void Log(const param_type& p, std::string* l);
};
-// Traits for DOMStorageType enum.
-template <>
-struct ParamTraits<DOMStorageType> {
- typedef DOMStorageType param_type;
- static void Write(Message* m, const param_type& p) {
- m->WriteInt(p);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- int type;
- if (!m->ReadInt(iter, &type))
- return false;
- *p = static_cast<param_type>(type);
- return true;
- }
- static void Log(const param_type& p, std::string* l) {
- std::string control;
- switch (p) {
- case DOM_STORAGE_LOCAL:
- control = "DOM_STORAGE_LOCAL";
- break;
- case DOM_STORAGE_SESSION:
- control = "DOM_STORAGE_SESSION";
- break;
- default:
- NOTIMPLEMENTED();
- control = "UNKNOWN";
- break;
- }
- LogParam(control, l);
- }
-};
-
-// Traits for WebKit::WebStorageArea::Result enum.
-template <>
-struct ParamTraits<WebKit::WebStorageArea::Result> {
- typedef WebKit::WebStorageArea::Result param_type;
- static void Write(Message* m, const param_type& p) {
- m->WriteInt(p);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- int type;
- if (!m->ReadInt(iter, &type))
- return false;
- *p = static_cast<param_type>(type);
- return true;
- }
- static void Log(const param_type& p, std::string* l) {
- std::string control;
- switch (p) {
- case WebKit::WebStorageArea::ResultOK:
- control = "WebKit::WebStorageArea::ResultOK";
- break;
- case WebKit::WebStorageArea::ResultBlockedByQuota:
- control = "WebKit::WebStorageArea::ResultBlockedByQuota";
- break;
- case WebKit::WebStorageArea::ResultBlockedByPolicy:
- control = "WebKit::WebStorageArea::ResultBlockedByPolicy";
- break;
- default:
- NOTIMPLEMENTED();
- control = "UNKNOWN";
- break;
- }
- LogParam(control, l);
- }
-};
-
// Traits for WebCookie
template <>
struct ParamTraits<webkit_glue::WebCookie> {
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index c27975b..c981923 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -902,10 +902,6 @@ IPC_MESSAGE_ROUTED1(ViewMsg_NotifyRenderViewType,
IPC_MESSAGE_ROUTED1(ViewMsg_ExecuteCode,
ViewMsg_ExecuteCode_Params)
-// Storage events are broadcast to renderer processes.
-IPC_MESSAGE_CONTROL1(ViewMsg_DOMStorageEvent,
- ViewMsg_DOMStorageEvent_Params)
-
// IDBCallback message handlers.
IPC_MESSAGE_CONTROL1(ViewMsg_IDBCallbacksSuccessNull,
int32 /* response_id */)
@@ -2357,51 +2353,6 @@ IPC_MESSAGE_CONTROL3(ViewHostMsg_DidGenerateCacheableMetadata,
double /* expected_response_time */,
std::vector<char> /* data */)
-// Get the storage area id for a particular origin within a namespace.
-IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_DOMStorageStorageAreaId,
- int64 /* namespace_id */,
- string16 /* origin */,
- int64 /* storage_area_id */)
-
-// Get the length of a storage area.
-IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_DOMStorageLength,
- int64 /* storage_area_id */,
- unsigned /* length */)
-
-// Get a the ith key within a storage area.
-IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_DOMStorageKey,
- int64 /* storage_area_id */,
- unsigned /* index */,
- NullableString16 /* key */)
-
-// Get a value based on a key from a storage area.
-IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_DOMStorageGetItem,
- int64 /* storage_area_id */,
- string16 /* key */,
- NullableString16 /* value */)
-
-// Set a value that's associated with a key in a storage area.
-IPC_SYNC_MESSAGE_ROUTED4_2(ViewHostMsg_DOMStorageSetItem,
- int64 /* storage_area_id */,
- string16 /* key */,
- string16 /* value */,
- GURL /* url */,
- WebKit::WebStorageArea::Result /* result */,
- NullableString16 /* old_value */)
-
-// Remove the value associated with a key in a storage area.
-IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_DOMStorageRemoveItem,
- int64 /* storage_area_id */,
- string16 /* key */,
- GURL /* url */,
- NullableString16 /* old_value */)
-
-// Clear the storage area.
-IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_DOMStorageClear,
- int64 /* storage_area_id */,
- GURL /* url */,
- bool /* something_cleared */)
-
// WebIDBCursor::direction() message.
IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBCursorDirection,
int32, /* idb_cursor_id */
diff --git a/chrome/common/render_messages_params.cc b/chrome/common/render_messages_params.cc
index 77e7b6d..01d3d58 100644
--- a/chrome/common/render_messages_params.cc
+++ b/chrome/common/render_messages_params.cc
@@ -166,13 +166,6 @@ ViewHostMsg_ScriptedPrint_Params::ViewHostMsg_ScriptedPrint_Params()
ViewHostMsg_ScriptedPrint_Params::~ViewHostMsg_ScriptedPrint_Params() {
}
-ViewMsg_DOMStorageEvent_Params::ViewMsg_DOMStorageEvent_Params()
- : storage_type_(DOM_STORAGE_LOCAL) {
-}
-
-ViewMsg_DOMStorageEvent_Params::~ViewMsg_DOMStorageEvent_Params() {
-}
-
ViewHostMsg_IDBFactoryOpen_Params::ViewHostMsg_IDBFactoryOpen_Params()
: routing_id_(0),
response_id_(0),
@@ -1218,45 +1211,6 @@ void ParamTraits<ViewHostMsg_ScriptedPrint_Params>::Log(const param_type& p,
l->append(")");
}
-void ParamTraits<ViewMsg_DOMStorageEvent_Params>::Write(Message* m,
- const param_type& p) {
- WriteParam(m, p.key_);
- WriteParam(m, p.old_value_);
- WriteParam(m, p.new_value_);
- WriteParam(m, p.origin_);
- WriteParam(m, p.url_);
- WriteParam(m, p.storage_type_);
-}
-
-bool ParamTraits<ViewMsg_DOMStorageEvent_Params>::Read(const Message* m,
- void** iter,
- param_type* p) {
- return
- ReadParam(m, iter, &p->key_) &&
- ReadParam(m, iter, &p->old_value_) &&
- ReadParam(m, iter, &p->new_value_) &&
- ReadParam(m, iter, &p->origin_) &&
- ReadParam(m, iter, &p->url_) &&
- ReadParam(m, iter, &p->storage_type_);
-}
-
-void ParamTraits<ViewMsg_DOMStorageEvent_Params>::Log(const param_type& p,
- std::string* l) {
- l->append("(");
- LogParam(p.key_, l);
- l->append(", ");
- LogParam(p.old_value_, l);
- l->append(", ");
- LogParam(p.new_value_, l);
- l->append(", ");
- LogParam(p.origin_, l);
- l->append(", ");
- LogParam(p.url_, l);
- l->append(", ");
- LogParam(p.storage_type_, l);
- l->append(")");
-}
-
void ParamTraits<ViewHostMsg_IDBFactoryOpen_Params>::Write(
Message* m,
const param_type& p) {
diff --git a/chrome/common/render_messages_params.h b/chrome/common/render_messages_params.h
index 1d964a0..b522e66 100644
--- a/chrome/common/render_messages_params.h
+++ b/chrome/common/render_messages_params.h
@@ -16,7 +16,6 @@
#include "base/shared_memory.h"
#include "base/time.h"
#include "base/values.h"
-#include "chrome/common/dom_storage_common.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_extent.h"
#include "chrome/common/extensions/url_pattern.h"
@@ -635,30 +634,6 @@ struct ViewHostMsg_ScriptedPrint_Params {
bool use_overlays;
};
-// Signals a storage event.
-struct ViewMsg_DOMStorageEvent_Params {
- ViewMsg_DOMStorageEvent_Params();
- ~ViewMsg_DOMStorageEvent_Params();
-
- // The key that generated the storage event. Null if clear() was called.
- NullableString16 key_;
-
- // The old value of this key. Null on clear() or if it didn't have a value.
- NullableString16 old_value_;
-
- // The new value of this key. Null on removeItem() or clear().
- NullableString16 new_value_;
-
- // The origin this is associated with.
- string16 origin_;
-
- // The URL of the page that caused the storage event.
- GURL url_;
-
- // The storage type of this event.
- DOMStorageType storage_type_;
-};
-
// Used to open an indexed database.
struct ViewHostMsg_IDBFactoryOpen_Params {
ViewHostMsg_IDBFactoryOpen_Params();
@@ -1191,14 +1166,6 @@ struct ParamTraits<ViewHostMsg_ScriptedPrint_Params> {
};
template <>
-struct ParamTraits<ViewMsg_DOMStorageEvent_Params> {
- typedef ViewMsg_DOMStorageEvent_Params param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-template <>
struct ParamTraits<ViewHostMsg_IDBFactoryOpen_Params> {
typedef ViewHostMsg_IDBFactoryOpen_Params param_type;
static void Write(Message* m, const param_type& p);
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index 6cbaa94..285211b 100644
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -29,7 +29,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/database_messages.h"
#include "chrome/common/db_message_filter.h"
-#include "chrome/common/dom_storage_common.h"
+#include "chrome/common/dom_storage_messages.h"
#include "chrome/common/plugin_messages.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
@@ -391,7 +391,7 @@ bool RenderThread::Send(IPC::Message* msg) {
case ViewHostMsg_GetCookies::ID:
case ViewHostMsg_GetRawCookies::ID:
case ViewHostMsg_CookiesEnabled::ID:
- case ViewHostMsg_DOMStorageSetItem::ID:
+ case DOMStorageHostMsg_SetItem::ID:
case ViewHostMsg_SyncLoad::ID:
case DatabaseHostMsg_Allow::ID:
may_show_cookie_prompt = true;
@@ -578,12 +578,12 @@ void RenderThread::OnExtensionSetHostPermissions(
}
void RenderThread::OnDOMStorageEvent(
- const ViewMsg_DOMStorageEvent_Params& params) {
+ const DOMStorageMsg_Event_Params& params) {
if (!dom_storage_event_dispatcher_.get())
dom_storage_event_dispatcher_.reset(WebStorageEventDispatcher::create());
- dom_storage_event_dispatcher_->dispatchStorageEvent(params.key_,
- params.old_value_, params.new_value_, params.origin_, params.url_,
- params.storage_type_ == DOM_STORAGE_LOCAL);
+ dom_storage_event_dispatcher_->dispatchStorageEvent(params.key,
+ params.old_value, params.new_value, params.origin, params.url,
+ params.storage_type == DOM_STORAGE_LOCAL);
}
void RenderThread::OnControlMessageReceived(const IPC::Message& msg) {
@@ -637,7 +637,7 @@ void RenderThread::OnControlMessageReceived(const IPC::Message& msg) {
OnExtensionSetAPIPermissions)
IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetHostPermissions,
OnExtensionSetHostPermissions)
- IPC_MESSAGE_HANDLER(ViewMsg_DOMStorageEvent,
+ IPC_MESSAGE_HANDLER(DOMStorageMsg_Event,
OnDOMStorageEvent)
#if defined(IPC_MESSAGE_LOG_ENABLED)
IPC_MESSAGE_HANDLER(ViewMsg_SetIPCLoggingEnabled,
diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h
index bdba97e..adfc65e 100644
--- a/chrome/renderer/render_thread.h
+++ b/chrome/renderer/render_thread.h
@@ -43,7 +43,7 @@ class WebDatabaseObserverImpl;
struct ContentSettings;
struct RendererPreferences;
-struct ViewMsg_DOMStorageEvent_Params;
+struct DOMStorageMsg_Event_Params;
struct ViewMsg_ExtensionsUpdated_Params;
struct ViewMsg_New_Params;
struct WebPreferences;
@@ -271,7 +271,7 @@ class RenderThread : public RenderThreadBase,
const ViewMsg_ExtensionsUpdated_Params& params);
void OnPageActionsUpdated(const std::string& extension_id,
const std::vector<std::string>& page_actions);
- void OnDOMStorageEvent(const ViewMsg_DOMStorageEvent_Params& params);
+ void OnDOMStorageEvent(const DOMStorageMsg_Event_Params& params);
void OnExtensionSetAPIPermissions(
const std::string& extension_id,
const std::set<std::string>& permissions);
diff --git a/chrome/renderer/renderer_webstoragearea_impl.cc b/chrome/renderer/renderer_webstoragearea_impl.cc
index d466952..60f8b54 100644
--- a/chrome/renderer/renderer_webstoragearea_impl.cc
+++ b/chrome/renderer/renderer_webstoragearea_impl.cc
@@ -4,7 +4,7 @@
#include "chrome/renderer/renderer_webstoragearea_impl.h"
-#include "chrome/common/render_messages.h"
+#include "chrome/common/dom_storage_messages.h"
#include "chrome/renderer/render_thread.h"
#include "chrome/renderer/render_view.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
@@ -19,8 +19,8 @@ using WebKit::WebView;
RendererWebStorageAreaImpl::RendererWebStorageAreaImpl(
int64 namespace_id, const WebString& origin) {
RenderThread::current()->Send(
- new ViewHostMsg_DOMStorageStorageAreaId(namespace_id, origin,
- &storage_area_id_));
+ new DOMStorageHostMsg_StorageAreaId(namespace_id, origin,
+ &storage_area_id_));
}
RendererWebStorageAreaImpl::~RendererWebStorageAreaImpl() {
@@ -29,21 +29,21 @@ RendererWebStorageAreaImpl::~RendererWebStorageAreaImpl() {
unsigned RendererWebStorageAreaImpl::length() {
unsigned length;
RenderThread::current()->Send(
- new ViewHostMsg_DOMStorageLength(storage_area_id_, &length));
+ new DOMStorageHostMsg_Length(storage_area_id_, &length));
return length;
}
WebString RendererWebStorageAreaImpl::key(unsigned index) {
NullableString16 key;
RenderThread::current()->Send(
- new ViewHostMsg_DOMStorageKey(storage_area_id_, index, &key));
+ new DOMStorageHostMsg_Key(storage_area_id_, index, &key));
return key;
}
WebString RendererWebStorageAreaImpl::getItem(const WebString& key) {
NullableString16 value;
RenderThread::current()->Send(
- new ViewHostMsg_DOMStorageGetItem(storage_area_id_, key, &value));
+ new DOMStorageHostMsg_GetItem(storage_area_id_, key, &value));
return value;
}
@@ -51,18 +51,18 @@ void RendererWebStorageAreaImpl::setItem(
const WebString& key, const WebString& value, const WebURL& url,
WebStorageArea::Result& result, WebString& old_value_webkit,
WebFrame* web_frame) {
- int32 routing_id = MSG_ROUTING_CONTROL;
+ int32 render_view_id = MSG_ROUTING_CONTROL;
if (web_frame) {
RenderView* render_view = RenderView::FromWebView(web_frame->view());
if (render_view)
- routing_id = render_view->routing_id();
+ render_view_id = render_view->routing_id();
}
- DCHECK(routing_id != MSG_ROUTING_CONTROL);
+ DCHECK(render_view_id != MSG_ROUTING_CONTROL);
NullableString16 old_value;
IPC::SyncMessage* message =
- new ViewHostMsg_DOMStorageSetItem(routing_id, storage_area_id_, key,
- value, url, &result, &old_value);
+ new DOMStorageHostMsg_SetItem(render_view_id, storage_area_id_, key,
+ value, url, &result, &old_value);
// NOTE: This may pump events (see RenderThread::Send).
RenderThread::current()->Send(message);
old_value_webkit = old_value;
@@ -72,14 +72,12 @@ void RendererWebStorageAreaImpl::removeItem(
const WebString& key, const WebURL& url, WebString& old_value_webkit) {
NullableString16 old_value;
RenderThread::current()->Send(
- new ViewHostMsg_DOMStorageRemoveItem(storage_area_id_, key,
- url, &old_value));
+ new DOMStorageHostMsg_RemoveItem(storage_area_id_, key, url, &old_value));
old_value_webkit = old_value;
}
void RendererWebStorageAreaImpl::clear(
const WebURL& url, bool& cleared_something) {
RenderThread::current()->Send(
- new ViewHostMsg_DOMStorageClear(storage_area_id_, url,
- &cleared_something));
+ new DOMStorageHostMsg_Clear(storage_area_id_, url, &cleared_something));
}
diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc
index 7e6435e..123304d 100644
--- a/chrome/test/render_view_test.cc
+++ b/chrome/test/render_view_test.cc
@@ -5,6 +5,7 @@
#include "chrome/test/render_view_test.h"
#include "chrome/browser/extensions/extension_function_dispatcher.h"
+#include "chrome/common/dom_storage_common.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/native_web_keyboard_event.h"
#include "chrome/common/render_messages.h"
diff --git a/ipc/ipc_message_impl_macros.h b/ipc/ipc_message_impl_macros.h
index b6b6278..e04749c 100644
--- a/ipc/ipc_message_impl_macros.h
+++ b/ipc/ipc_message_impl_macros.h
@@ -330,6 +330,61 @@
\
IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class)
+#define IPC_SYNC_MESSAGE_CONTROL4_3_EXTRA(msg_class, type1_in, type2_in, \
+ type3_in, type4_in, type1_out, \
+ type2_out, type3_out) \
+ msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \
+ const type3_in& arg3, const type4_in& arg4, \
+ type1_out* arg5, type2_out* arg6, typ3_out* arg7) \
+ : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, \
+ type4_in>, \
+ Tuple3<type1_out&, type2_out&, type3_out&> >(MSG_ROUTING_CONTROL, ID, \
+ MakeRefTuple(arg1, arg2, arg3, arg4), \
+ MakeRefTuple(*arg5, *arg6, *arg7)) {} \
+ \
+ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class)
+
+#define IPC_SYNC_MESSAGE_CONTROL5_1_EXTRA(msg_class, type1_in, type2_in, \
+ type3_in, type4_in, type5_in, \
+ type1_out) \
+ msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \
+ const type3_in& arg3, const type4_in& arg4, \
+ const type5_in& arg5, type1_out* arg6) \
+ : IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_in>, \
+ Tuple1<type1_out&> >(MSG_ROUTING_CONTROL, ID, \
+ MakeRefTuple(arg1, arg2, arg3, arg4, arg5), MakeRefTuple(*arg6)) {} \
+ \
+ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class)
+
+
+#define IPC_SYNC_MESSAGE_CONTROL5_2_EXTRA(msg_class, type1_in, type2_in, \
+ type3_in, type4_in, type5_in, \
+ type1_out, type2_out) \
+ msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \
+ const type3_in& arg3, const type4_in& arg4, \
+ const type5_in& arg5, type1_out* arg6, type2_out* arg7) \
+ : IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, \
+ type4_in, type5_in>, \
+ Tuple2<type1_out&, type2_out&> >(MSG_ROUTING_CONTROL, ID, \
+ MakeRefTuple(arg1, arg2, arg3, arg4, arg5), \
+ MakeRefTuple(*arg6, *arg7)) {} \
+ \
+ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class)
+
+#define IPC_SYNC_MESSAGE_CONTROL5_3_EXTRA(msg_class, type1_in, type2_in, \
+ type3_in, type4_in, type5_in, \
+ type1_out, type2_out, type3_out) \
+ msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \
+ const type3_in& arg3, const type4_in& arg4, \
+ const type5_in& arg5, type1_out* arg6, type2_out* arg7, typ3_out* arg8) \
+ : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, \
+ type4_in, type5_in>, \
+ Tuple3<type1_out&, type2_out&, type3_out&> >(MSG_ROUTING_CONTROL, ID, \
+ MakeRefTuple(arg1, arg2, arg3, arg4, arg5), \
+ MakeRefTuple(*arg6, *arg7, *arg8)) {} \
+ \
+ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class)
+
#define IPC_SYNC_MESSAGE_ROUTED0_0_EXTRA(msg_class) \
msg_class::msg_class(int routing_id) \
: IPC::MessageWithReply<Tuple0, Tuple0>( \
diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h
index d955135..7247c66 100644
--- a/ipc/ipc_message_macros.h
+++ b/ipc/ipc_message_macros.h
@@ -162,6 +162,18 @@ LogFunctionMap g_log_function_mapping;
#define IPC_SYNC_MESSAGE_CONTROL4_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \
IPC_MESSAGE_LOG(msg_class)
+#define IPC_SYNC_MESSAGE_CONTROL4_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) \
+ IPC_MESSAGE_LOG(msg_class)
+
+#define IPC_SYNC_MESSAGE_CONTROL5_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) \
+ IPC_MESSAGE_LOG(msg_class)
+
+#define IPC_SYNC_MESSAGE_CONTROL5_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out) \
+ IPC_MESSAGE_LOG(msg_class)
+
+#define IPC_SYNC_MESSAGE_CONTROL5_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) \
+ IPC_MESSAGE_LOG(msg_class)
+
#define IPC_SYNC_MESSAGE_ROUTED0_0_EXTRA(msg_class) \
IPC_MESSAGE_LOG(msg_class)
@@ -272,6 +284,10 @@ LogFunctionMap g_log_function_mapping;
#define IPC_SYNC_MESSAGE_CONTROL3_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out, type4_out)
#define IPC_SYNC_MESSAGE_CONTROL4_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out)
#define IPC_SYNC_MESSAGE_CONTROL4_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out)
+#define IPC_SYNC_MESSAGE_CONTROL4_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out)
+#define IPC_SYNC_MESSAGE_CONTROL5_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out)
+#define IPC_SYNC_MESSAGE_CONTROL5_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out)
+#define IPC_SYNC_MESSAGE_CONTROL5_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out)
#define IPC_SYNC_MESSAGE_ROUTED0_0_EXTRA(msg_class)
#define IPC_SYNC_MESSAGE_ROUTED0_1_EXTRA(msg_class, type1_out)
#define IPC_SYNC_MESSAGE_ROUTED0_2_EXTRA(msg_class, type1_out, type2_out)
@@ -647,6 +663,54 @@ LogFunctionMap g_log_function_mapping;
}; \
IPC_SYNC_MESSAGE_CONTROL4_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out)
+#define IPC_SYNC_MESSAGE_CONTROL4_3(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) \
+ class msg_class : \
+ public IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \
+ Tuple3<type1_out&, type2_out&, type3_out&> > { \
+ public: \
+ enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \
+ msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6, type3_out* arg7); \
+ ~msg_class(); \
+ static void Log(std::string* name, const Message* msg, std::string* l); \
+ }; \
+ IPC_SYNC_MESSAGE_CONTROL4_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out)
+
+#define IPC_SYNC_MESSAGE_CONTROL5_1(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) \
+ class msg_class : \
+ public IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_in>, \
+ Tuple1<type1_out&> > { \
+ public: \
+ enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \
+ msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type5_in& arg5, type1_out* arg6); \
+ ~msg_class(); \
+ static void Log(std::string* name, const Message* msg, std::string* l); \
+ }; \
+ IPC_SYNC_MESSAGE_CONTROL5_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out)
+
+#define IPC_SYNC_MESSAGE_CONTROL5_2(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out) \
+ class msg_class : \
+ public IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_in>, \
+ Tuple2<type1_out&, type2_out&> > { \
+ public: \
+ enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \
+ msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type5_in& arg5, type1_out* arg6, type2_out* arg7); \
+ ~msg_class(); \
+ static void Log(std::string* name, const Message* msg, std::string* l); \
+ }; \
+ IPC_SYNC_MESSAGE_CONTROL5_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out)
+
+#define IPC_SYNC_MESSAGE_CONTROL5_3(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) \
+ class msg_class : \
+ public IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_in>, \
+ Tuple3<type1_out&, type2_out&, type3_out&> > { \
+ public: \
+ enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \
+ msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type5_in& arg5, type1_out* arg6, type2_out* arg7, type3_out* arg8); \
+ ~msg_class(); \
+ static void Log(std::string* name, const Message* msg, std::string* l); \
+ }; \
+ IPC_SYNC_MESSAGE_CONTROL4_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out)
+
#define IPC_SYNC_MESSAGE_ROUTED0_0(msg_class) \
class msg_class : public IPC::MessageWithReply<Tuple0, Tuple0 > { \
public: \
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index c556507..a7cdfd5 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -62,6 +62,7 @@ enum IPCMessageStart {
FileUtilitiesMsgStart,
MimeRegistryMsgStart,
DatabaseMsgStart,
+ DOMStorageMsgStart,
};
class DictionaryValue;