Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(836)

Unified Diff: chrome/renderer/renderer_webstoragenamespace_impl.cc

Issue 545054: Introduce all the plumbing for Session Storage. This mostly consists of crea... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/renderer_webstoragenamespace_impl.h ('k') | chrome/test/render_view_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/renderer_webstoragenamespace_impl.cc
===================================================================
--- chrome/renderer/renderer_webstoragenamespace_impl.cc (revision 36257)
+++ chrome/renderer/renderer_webstoragenamespace_impl.cc (working copy)
@@ -15,14 +15,15 @@
RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl(
DOMStorageType storage_type)
: storage_type_(storage_type),
- namespace_id_(kUninitializedNamespaceId) {
+ namespace_id_(kLocalStorageNamespaceId) {
+ DCHECK(storage_type == DOM_STORAGE_LOCAL);
}
RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl(
DOMStorageType storage_type, int64 namespace_id)
: storage_type_(storage_type),
namespace_id_(namespace_id) {
- DCHECK(namespace_id_ != kUninitializedNamespaceId);
+ DCHECK(storage_type == DOM_STORAGE_SESSION);
}
RendererWebStorageNamespaceImpl::~RendererWebStorageNamespaceImpl() {
@@ -30,34 +31,16 @@
WebStorageArea* RendererWebStorageNamespaceImpl::createStorageArea(
const WebString& origin) {
- // This could be done async in the background (started when this class is
- // first instantiated) rather than lazily on first use, but it's unclear
- // whether it's worth the complexity.
- if (namespace_id_ == kUninitializedNamespaceId) {
- RenderThread::current()->Send(
- new ViewHostMsg_DOMStorageNamespaceId(storage_type_,
- &namespace_id_));
- DCHECK(namespace_id_ != kUninitializedNamespaceId);
- }
// Ideally, we'd keep a hash map of origin to these objects. Unfortunately
// this doesn't seem practical because there's no good way to ref-count these
- // objects, and it'd be unclear who owned them. So, instead, we'll pay a
- // price for an allocaiton and IPC for each.
+ // objects, and it'd be unclear who owned them. So, instead, we'll pay the
+ // price in terms of wasted memory.
return new RendererWebStorageAreaImpl(namespace_id_, origin);
}
WebStorageNamespace* RendererWebStorageNamespaceImpl::copy() {
- // If we haven't been used yet, we might as well start out fresh (and lazy).
- if (namespace_id_ == kUninitializedNamespaceId)
- return new RendererWebStorageNamespaceImpl(storage_type_);
-
- // This cannot easily be deferred because we need a snapshot in time.
- int64 new_namespace_id;
- RenderThread::current()->Send(
- new ViewHostMsg_DOMStorageCloneNamespaceId(namespace_id_,
- &new_namespace_id));
- return new RendererWebStorageNamespaceImpl(storage_type_,
- new_namespace_id);
+ NOTREACHED(); // We shouldn't ever reach this code in Chromium.
+ return NULL;
}
void RendererWebStorageNamespaceImpl::close() {
« no previous file with comments | « chrome/renderer/renderer_webstoragenamespace_impl.h ('k') | chrome/test/render_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698