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

Unified Diff: webkit/dom_storage/dom_storage_context.cc

Issue 10546167: Create and store persistent unique ids for sessionStorage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: code review Created 8 years, 6 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
Index: webkit/dom_storage/dom_storage_context.cc
diff --git a/webkit/dom_storage/dom_storage_context.cc b/webkit/dom_storage/dom_storage_context.cc
index f9d530a65ecf751e44d90a5e83690fc2ce10b0e6..b8a8234cf38f622c92caa5e43235a35a3f4f2271 100644
--- a/webkit/dom_storage/dom_storage_context.cc
+++ b/webkit/dom_storage/dom_storage_context.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/file_util.h"
+#include "base/guid.h"
#include "base/location.h"
#include "base/time.h"
#include "webkit/dom_storage/dom_storage_area.h"
@@ -170,14 +171,21 @@ void DomStorageContext::NotifyAreaCleared(
OnDomStorageAreaCleared(area, page_url));
}
+std::string DomStorageContext::AllocatePersistentSessionId() {
+ std::string guid = base::GenerateGUID();
+ std::replace(guid.begin(), guid.end(), '-', '_');
+ return guid;
+}
+
void DomStorageContext::CreateSessionNamespace(
- int64 namespace_id) {
+ int64 namespace_id,
+ const std::string& persistent_namespace_id) {
if (is_shutdown_)
return;
DCHECK(namespace_id != kLocalStorageNamespaceId);
DCHECK(namespaces_.find(namespace_id) == namespaces_.end());
namespaces_[namespace_id] = new DomStorageNamespace(
- namespace_id, task_runner_);
+ namespace_id, persistent_namespace_id, task_runner_);
}
void DomStorageContext::DeleteSessionNamespace(
@@ -187,16 +195,17 @@ void DomStorageContext::DeleteSessionNamespace(
}
void DomStorageContext::CloneSessionNamespace(
- int64 existing_id, int64 new_id) {
+ int64 existing_id, int64 new_id,
+ const std::string& new_persistent_id) {
if (is_shutdown_)
return;
DCHECK_NE(kLocalStorageNamespaceId, existing_id);
DCHECK_NE(kLocalStorageNamespaceId, new_id);
StorageNamespaceMap::iterator found = namespaces_.find(existing_id);
if (found != namespaces_.end())
- namespaces_[new_id] = found->second->Clone(new_id);
+ namespaces_[new_id] = found->second->Clone(new_id, new_persistent_id);
else
- CreateSessionNamespace(new_id);
+ CreateSessionNamespace(new_id, new_persistent_id);
}
void DomStorageContext::ClearSessionOnlyOrigins() {

Powered by Google App Engine
This is Rietveld 408576698