diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-13 01:16:16 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-13 01:16:16 +0000 |
commit | b928936b147062a3622fc88e72019e0279279796 (patch) | |
tree | d4974d765f86651bad73436ae4ccaee5be620c9c /content | |
parent | 15cdf9f9f5d7e7a08fc8d6e7ea3eab5ec66f285e (diff) | |
download | chromium_src-b928936b147062a3622fc88e72019e0279279796.zip chromium_src-b928936b147062a3622fc88e72019e0279279796.tar.gz chromium_src-b928936b147062a3622fc88e72019e0279279796.tar.bz2 |
DomStorage house cleaning in preparation of deleting the now obsolete in_process_webkit support for this component.
Review URL: https://chromiumcodereview.appspot.com/10005049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132120 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/dom_storage/dom_storage_message_filter_new.cc | 4 | ||||
-rw-r--r-- | content/browser/renderer_host/test_render_view_host.cc | 4 | ||||
-rw-r--r-- | content/browser/web_contents/interstitial_page_impl.cc | 4 | ||||
-rw-r--r-- | content/common/dom_storage_common.h | 6 | ||||
-rw-r--r-- | content/common/dom_storage_messages.h | 33 | ||||
-rw-r--r-- | content/renderer/render_thread_impl.cc | 4 | ||||
-rw-r--r-- | content/renderer/render_view_impl.cc | 13 | ||||
-rw-r--r-- | content/renderer/renderer_webkitplatformsupport_impl.cc | 4 | ||||
-rw-r--r-- | content/renderer/renderer_webstoragearea_impl.cc | 6 | ||||
-rw-r--r-- | content/renderer/renderer_webstoragenamespace_impl.cc | 13 | ||||
-rw-r--r-- | content/renderer/renderer_webstoragenamespace_impl.h | 8 | ||||
-rw-r--r-- | content/test/render_view_fake_resources_test.cc | 5 | ||||
-rw-r--r-- | content/test/render_view_test.cc | 4 |
13 files changed, 54 insertions, 54 deletions
diff --git a/content/browser/dom_storage/dom_storage_message_filter_new.cc b/content/browser/dom_storage/dom_storage_message_filter_new.cc index 511ac19..8ff5183 100644 --- a/content/browser/dom_storage/dom_storage_message_filter_new.cc +++ b/content/browser/dom_storage/dom_storage_message_filter_new.cc @@ -197,8 +197,8 @@ void DOMStorageMessageFilter::SendDomStorageEvent( DOMStorageMsg_Event_Params params; // TODO(michaeln): change the origin type to be GURL in ipc params. params.origin = UTF8ToUTF16(area->origin().spec()); - params.url = page_url; - params.storage_type = DOM_STORAGE_LOCAL; + params.page_url = page_url; + params.namespace_id = dom_storage::kLocalStorageNamespaceId; params.key = key; params.new_value = new_value; params.old_value = old_value; diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc index 7f6da61a..d4ccbb3 100644 --- a/content/browser/renderer_host/test_render_view_host.cc +++ b/content/browser/renderer_host/test_render_view_host.cc @@ -7,11 +7,11 @@ #include "content/browser/site_instance_impl.h" #include "content/browser/web_contents/navigation_controller_impl.h" #include "content/browser/web_contents/test_web_contents.h" -#include "content/common/dom_storage_common.h" #include "content/common/view_messages.h" #include "content/public/browser/navigation_controller.h" #include "content/public/common/content_client.h" #include "ui/gfx/rect.h" +#include "webkit/dom_storage/dom_storage_types.h" #include "webkit/forms/password_form.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webpreferences.h" @@ -209,7 +209,7 @@ TestRenderViewHost::TestRenderViewHost(SiteInstance* instance, : RenderViewHostImpl(instance, delegate, routing_id, - kInvalidSessionStorageNamespaceId), + dom_storage::kInvalidSessionStorageNamespaceId), render_view_created_(false), delete_counter_(NULL), simulate_fetch_via_proxy_(false), diff --git a/content/browser/web_contents/interstitial_page_impl.cc b/content/browser/web_contents/interstitial_page_impl.cc index 5df8063..0091331 100644 --- a/content/browser/web_contents/interstitial_page_impl.cc +++ b/content/browser/web_contents/interstitial_page_impl.cc @@ -19,7 +19,6 @@ #include "content/browser/web_contents/navigation_controller_impl.h" #include "content/browser/web_contents/navigation_entry_impl.h" #include "content/browser/web_contents/web_contents_impl.h" -#include "content/common/dom_storage_common.h" #include "content/common/view_messages.h" #include "content/port/browser/render_widget_host_view_port.h" #include "content/public/browser/browser_thread.h" @@ -34,6 +33,7 @@ #include "content/public/common/view_type.h" #include "net/base/escape.h" #include "net/url_request/url_request_context_getter.h" +#include "webkit/dom_storage/dom_storage_types.h" using content::BrowserThread; using content::DomOperationNotificationDetails; @@ -487,7 +487,7 @@ WebContents* InterstitialPageImpl::tab() const { RenderViewHost* InterstitialPageImpl::CreateRenderViewHost() { RenderViewHostImpl* render_view_host = new RenderViewHostImpl( SiteInstance::Create(tab()->GetBrowserContext()), - this, MSG_ROUTING_NONE, kInvalidSessionStorageNamespaceId); + this, MSG_ROUTING_NONE, dom_storage::kInvalidSessionStorageNamespaceId); return render_view_host; } diff --git a/content/common/dom_storage_common.h b/content/common/dom_storage_common.h index 64d35e5..3ad3d87 100644 --- a/content/common/dom_storage_common.h +++ b/content/common/dom_storage_common.h @@ -9,7 +9,11 @@ #include "build/build_config.h" #include "base/basictypes.h" +#include "webkit/dom_storage/dom_storage_types.h" +#ifdef ENABLE_NEW_DOM_STORAGE_BACKEND +// TODO(michaeln): delete this file +#else const int64 kLocalStorageNamespaceId = 0; const int64 kInvalidSessionStorageNamespaceId = kLocalStorageNamespaceId; @@ -17,5 +21,5 @@ enum DOMStorageType { DOM_STORAGE_LOCAL = 0, DOM_STORAGE_SESSION }; - +#endif // ENABLE_NEW_DOM_STORAGE_BACKEND #endif // CONTENT_COMMON_DOM_STORAGE_COMMON_H_ diff --git a/content/common/dom_storage_messages.h b/content/common/dom_storage_messages.h index 336288f..9ecc853 100644 --- a/content/common/dom_storage_messages.h +++ b/content/common/dom_storage_messages.h @@ -3,17 +3,15 @@ // found in the LICENSE file. // Multiply-included message file, no traditional include guard. -#include "content/common/dom_storage_common.h" #include "content/public/common/common_param_traits.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_param_traits.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageArea.h" +#include "webkit/dom_storage/dom_storage_types.h" #define IPC_MESSAGE_START DOMStorageMsgStart -IPC_ENUM_TRAITS(DOMStorageType) - // Signals a storage event. IPC_STRUCT_BEGIN(DOMStorageMsg_Event_Params) // The key that generated the storage event. Null if clear() was called. @@ -29,10 +27,10 @@ IPC_STRUCT_BEGIN(DOMStorageMsg_Event_Params) IPC_STRUCT_MEMBER(string16, origin) // The URL of the page that caused the storage event. - IPC_STRUCT_MEMBER(GURL, url) + IPC_STRUCT_MEMBER(GURL, page_url) - // The storage type of this event. - IPC_STRUCT_MEMBER(DOMStorageType, storage_type) + // The namespace_id this is associated with. + IPC_STRUCT_MEMBER(int64, namespace_id) IPC_STRUCT_END() IPC_ENUM_TRAITS(WebKit::WebStorageArea::Result) @@ -47,51 +45,52 @@ IPC_MESSAGE_CONTROL1(DOMStorageMsg_Event, // DOM Storage messages sent from the renderer to the browser. // Open the storage area for a particular origin within a namespace. +// TODO(michaeln): make this async and have the renderer send the connection_id IPC_SYNC_MESSAGE_CONTROL2_1(DOMStorageHostMsg_OpenStorageArea, int64 /* namespace_id */, string16 /* origin */, - int64 /* storage_area_id */) + int64 /* connection_id */) // Close a previously opened storage area. IPC_MESSAGE_CONTROL1(DOMStorageHostMsg_CloseStorageArea, - int64 /* storage_area_id */) + int64 /* connection_id */) // Get the length of a storage area. IPC_SYNC_MESSAGE_CONTROL1_1(DOMStorageHostMsg_Length, - int64 /* storage_area_id */, + int64 /* connection_id */, unsigned /* length */) // Get a the ith key within a storage area. IPC_SYNC_MESSAGE_CONTROL2_1(DOMStorageHostMsg_Key, - int64 /* storage_area_id */, + int64 /* connection_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 */, + int64 /* connection_id */, string16 /* key */, NullableString16 /* value */) // Set a value that's associated with a key in a storage area. IPC_SYNC_MESSAGE_CONTROL4_2(DOMStorageHostMsg_SetItem, - int64 /* storage_area_id */, + int64 /* connection_id */, string16 /* key */, string16 /* value */, - GURL /* url */, + GURL /* page_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 */, + int64 /* connection_id */, string16 /* key */, - GURL /* url */, + GURL /* page_url */, NullableString16 /* old_value */) // Clear the storage area. IPC_SYNC_MESSAGE_CONTROL2_1(DOMStorageHostMsg_Clear, - int64 /* storage_area_id */, - GURL /* url */, + int64 /* connection_id */, + GURL /* page_url */, bool /* something_cleared */) diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 320c820..09832aa9 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -823,8 +823,8 @@ void RenderThreadImpl::OnDOMStorageEvent( 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); + params.old_value, params.new_value, params.origin, params.page_url, + params.namespace_id == dom_storage::kLocalStorageNamespaceId); } bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index b498938..58a3621 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -156,6 +156,7 @@ #include "ui/gfx/rect.h" #include "v8/include/v8.h" #include "webkit/appcache/web_application_cache_host_impl.h" +#include "webkit/dom_storage/dom_storage_types.h" #include "webkit/forms/form_data.h" #include "webkit/forms/form_field.h" #include "webkit/forms/password_form_dom_manager.h" @@ -1556,15 +1557,15 @@ RenderWidgetFullscreenPepper* RenderViewImpl::CreatePepperFullscreenContainer( WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace( unsigned quota) { #ifdef ENABLE_NEW_DOM_STORAGE_BACKEND - CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); - return new RendererWebStorageNamespaceImpl(DOM_STORAGE_SESSION, - session_storage_namespace_id_); + CHECK(session_storage_namespace_id_ != + dom_storage::kInvalidSessionStorageNamespaceId); + return new RendererWebStorageNamespaceImpl(session_storage_namespace_id_); #else if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) return WebStorageNamespace::createSessionStorageNamespace(quota); - CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); - return new RendererWebStorageNamespaceImpl(DOM_STORAGE_SESSION, - session_storage_namespace_id_); + CHECK(session_storage_namespace_id_ != + dom_storage::kInvalidSessionStorageNamespaceId); + return new RendererWebStorageNamespaceImpl(session_storage_namespace_id_); #endif } diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index 44e3e5c..c5d03d4 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -312,11 +312,11 @@ WebStorageNamespace* RendererWebKitPlatformSupportImpl::createLocalStorageNamespace( const WebString& path, unsigned quota) { #ifdef ENABLE_NEW_DOM_STORAGE_BACKEND - return new RendererWebStorageNamespaceImpl(DOM_STORAGE_LOCAL); + return new RendererWebStorageNamespaceImpl(); #else if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) return WebStorageNamespace::createLocalStorageNamespace(path, quota); - return new RendererWebStorageNamespaceImpl(DOM_STORAGE_LOCAL); + return new RendererWebStorageNamespaceImpl(); #endif } diff --git a/content/renderer/renderer_webstoragearea_impl.cc b/content/renderer/renderer_webstoragearea_impl.cc index 15fc288..457ce11 100644 --- a/content/renderer/renderer_webstoragearea_impl.cc +++ b/content/renderer/renderer_webstoragearea_impl.cc @@ -8,10 +8,9 @@ #include "base/time.h" #include "content/common/dom_storage_messages.h" #include "content/renderer/render_thread_impl.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" +#include "webkit/dom_storage/dom_storage_types.h" -using WebKit::WebStorageNamespace; using WebKit::WebString; using WebKit::WebURL; @@ -65,8 +64,7 @@ WebString RendererWebStorageAreaImpl::getItem(const WebString& key) { void RendererWebStorageAreaImpl::setItem( const WebString& key, const WebString& value, const WebURL& url, WebStorageArea::Result& result, WebString& old_value_webkit) { - const size_t kMaxKeyValueLength = WebStorageNamespace::m_localStorageQuota; - if (key.length() + value.length() > kMaxKeyValueLength) { + if (key.length() + value.length() > dom_storage::kPerAreaQuota) { result = ResultBlockedByQuota; return; } diff --git a/content/renderer/renderer_webstoragenamespace_impl.cc b/content/renderer/renderer_webstoragenamespace_impl.cc index cd0e5d7..829d192 100644 --- a/content/renderer/renderer_webstoragenamespace_impl.cc +++ b/content/renderer/renderer_webstoragenamespace_impl.cc @@ -11,16 +11,14 @@ using WebKit::WebStorageArea; using WebKit::WebStorageNamespace; using WebKit::WebString; -RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl( - DOMStorageType storage_type) - : namespace_id_(kLocalStorageNamespaceId) { - DCHECK(storage_type == DOM_STORAGE_LOCAL); +RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl() + : namespace_id_(dom_storage::kLocalStorageNamespaceId) { } RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl( - DOMStorageType storage_type, int64 namespace_id) + int64 namespace_id) : namespace_id_(namespace_id) { - DCHECK(storage_type == DOM_STORAGE_SESSION); + DCHECK_NE(dom_storage::kInvalidSessionStorageNamespaceId, namespace_id); } RendererWebStorageNamespaceImpl::~RendererWebStorageNamespaceImpl() { @@ -44,6 +42,5 @@ WebStorageNamespace* RendererWebStorageNamespaceImpl::copy() { } void RendererWebStorageNamespaceImpl::close() { - // This is called only on LocalStorage namespaces when WebKit thinks its - // shutting down. This has no impact on Chromium. + // TOOD(michaeln): remove this deprecated method. } diff --git a/content/renderer/renderer_webstoragenamespace_impl.h b/content/renderer/renderer_webstoragenamespace_impl.h index 22cafbe..8f3d5dc 100644 --- a/content/renderer/renderer_webstoragenamespace_impl.h +++ b/content/renderer/renderer_webstoragenamespace_impl.h @@ -7,7 +7,6 @@ #pragma once #include "base/basictypes.h" -#include "content/common/dom_storage_common.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h" #include "webkit/dom_storage/dom_storage_types.h" // The above is to include the ENABLE_NEW_DOM_STORAGE_BACKEND flag @@ -15,9 +14,10 @@ class RendererWebStorageNamespaceImpl : public WebKit::WebStorageNamespace { public: - explicit RendererWebStorageNamespaceImpl(DOMStorageType storage_type); - RendererWebStorageNamespaceImpl(DOMStorageType storage_type, - int64 namespace_id); + // The default constructor creates a local storage namespace, the second + // constructor should be used for session storage namepaces. + RendererWebStorageNamespaceImpl(); + explicit RendererWebStorageNamespaceImpl(int64 namespace_id); // See WebStorageNamespace.h for documentation on these functions. virtual ~RendererWebStorageNamespaceImpl(); diff --git a/content/test/render_view_fake_resources_test.cc b/content/test/render_view_fake_resources_test.cc index 92887e4..d922307 100644 --- a/content/test/render_view_fake_resources_test.cc +++ b/content/test/render_view_fake_resources_test.cc @@ -9,7 +9,6 @@ #include "base/process.h" #include "base/shared_memory.h" #include "base/time.h" -#include "content/common/dom_storage_common.h" #include "content/common/resource_messages.h" #include "content/common/view_messages.h" #include "content/public/common/resource_response.h" @@ -25,6 +24,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" +#include "webkit/dom_storage/dom_storage_types.h" #include "webkit/glue/glue_serialize.h" #include "webkit/glue/webkit_glue.h" @@ -72,7 +72,8 @@ void RenderViewFakeResourcesTest::SetUp() { ViewMsg_New_Params params; params.parent_window = 0; params.view_id = kViewId; - params.session_storage_namespace_id = kInvalidSessionStorageNamespaceId; + params.session_storage_namespace_id = + dom_storage::kInvalidSessionStorageNamespaceId; ASSERT_TRUE(channel_->Send(new ViewMsg_New(params))); message_loop_.Run(); } diff --git a/content/test/render_view_test.cc b/content/test/render_view_test.cc index e52b157..a64f8aa 100644 --- a/content/test/render_view_test.cc +++ b/content/test/render_view_test.cc @@ -4,7 +4,6 @@ #include "content/test/render_view_test.h" -#include "content/common/dom_storage_common.h" #include "content/common/view_messages.h" #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/common/renderer_preferences.h" @@ -20,6 +19,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" +#include "webkit/dom_storage/dom_storage_types.h" #include "webkit/glue/webkit_glue.h" #if defined(OS_LINUX) && !defined(USE_AURA) @@ -162,7 +162,7 @@ void RenderViewTest::SetUp() { new SharedRenderViewCounter(0), kRouteId, kSurfaceId, - kInvalidSessionStorageNamespaceId, + dom_storage::kInvalidSessionStorageNamespaceId, string16(), 1, WebKit::WebScreenInfo(), |