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

Side by Side Diff: webkit/tools/test_shell/simple_dom_storage_system.cc

Issue 9963107: Persist sessionStorage on disk. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/tools/test_shell/simple_dom_storage_system.h" 5 #include "webkit/tools/test_shell/simple_dom_storage_system.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "googleurl/src/gurl.h" 8 #include "googleurl/src/gurl.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" 9 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageArea.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageArea.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 WebStorageArea* SimpleDomStorageSystem::NamespaceImpl::createStorageArea( 100 WebStorageArea* SimpleDomStorageSystem::NamespaceImpl::createStorageArea(
101 const WebString& origin) { 101 const WebString& origin) {
102 return new AreaImpl(parent_, namespace_id_, GURL(origin)); 102 return new AreaImpl(parent_, namespace_id_, GURL(origin));
103 } 103 }
104 104
105 WebStorageNamespace* SimpleDomStorageSystem::NamespaceImpl::copy() { 105 WebStorageNamespace* SimpleDomStorageSystem::NamespaceImpl::copy() {
106 DCHECK_NE(dom_storage::kLocalStorageNamespaceId, namespace_id_); 106 DCHECK_NE(dom_storage::kLocalStorageNamespaceId, namespace_id_);
107 int new_id = kInvalidNamespaceId; 107 int new_id = kInvalidNamespaceId;
108 if (Context()) { 108 if (Context()) {
109 new_id = Context()->AllocateSessionId(); 109 new_id = Context()->AllocateSessionId();
110 Context()->CloneSessionNamespace(namespace_id_, new_id); 110 Context()->CloneSessionNamespace(namespace_id_, new_id, "");
111 } 111 }
112 return new NamespaceImpl(parent_, new_id); 112 return new NamespaceImpl(parent_, new_id);
113 } 113 }
114 114
115 bool SimpleDomStorageSystem::NamespaceImpl::isSameNamespace( 115 bool SimpleDomStorageSystem::NamespaceImpl::isSameNamespace(
116 const WebStorageNamespace& other) const { 116 const WebStorageNamespace& other) const {
117 const NamespaceImpl* other_impl = static_cast<const NamespaceImpl*>(&other); 117 const NamespaceImpl* other_impl = static_cast<const NamespaceImpl*>(&other);
118 return namespace_id_ == other_impl->namespace_id_; 118 return namespace_id_ == other_impl->namespace_id_;
119 } 119 }
120 120
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 host_.reset(); 208 host_.reset();
209 context_->RemoveEventObserver(this); 209 context_->RemoveEventObserver(this);
210 } 210 }
211 211
212 WebStorageNamespace* SimpleDomStorageSystem::CreateLocalStorageNamespace() { 212 WebStorageNamespace* SimpleDomStorageSystem::CreateLocalStorageNamespace() {
213 return new NamespaceImpl(weak_factory_.GetWeakPtr()); 213 return new NamespaceImpl(weak_factory_.GetWeakPtr());
214 } 214 }
215 215
216 WebStorageNamespace* SimpleDomStorageSystem::CreateSessionStorageNamespace() { 216 WebStorageNamespace* SimpleDomStorageSystem::CreateSessionStorageNamespace() {
217 int id = context_->AllocateSessionId(); 217 int id = context_->AllocateSessionId();
218 context_->CreateSessionNamespace(id); 218 context_->CreateSessionNamespace(id, "");
219 return new NamespaceImpl(weak_factory_.GetWeakPtr(), id); 219 return new NamespaceImpl(weak_factory_.GetWeakPtr(), id);
220 } 220 }
221 221
222 void SimpleDomStorageSystem::OnDomStorageItemSet( 222 void SimpleDomStorageSystem::OnDomStorageItemSet(
223 const dom_storage::DomStorageArea* area, 223 const dom_storage::DomStorageArea* area,
224 const string16& key, 224 const string16& key,
225 const string16& new_value, 225 const string16& new_value,
226 const NullableString16& old_value, 226 const NullableString16& old_value,
227 const GURL& page_url) { 227 const GURL& page_url) {
228 DispatchDomStorageEvent(area, page_url, 228 DispatchDomStorageEvent(area, page_url,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 key, 274 key,
275 old_value, 275 old_value,
276 new_value, 276 new_value,
277 area->origin(), 277 area->origin(),
278 page_url, 278 page_url,
279 session_namespace_for_event_dispatch, 279 session_namespace_for_event_dispatch,
280 area_being_processed_, 280 area_being_processed_,
281 true /* originatedInProcess */); 281 true /* originatedInProcess */);
282 } 282 }
283 } 283 }
OLDNEW
« webkit/dom_storage/dom_storage_context.h ('K') | « webkit/dom_storage/webkit_dom_storage.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698