OLD | NEW |
---|---|
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/dom_storage/dom_storage_context.h" | 5 #include "webkit/dom_storage/dom_storage_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 | 82 |
83 void DomStorageContext::DeleteOrigin(const GURL& origin) { | 83 void DomStorageContext::DeleteOrigin(const GURL& origin) { |
84 // TODO(michaeln): write me | 84 // TODO(michaeln): write me |
85 } | 85 } |
86 | 86 |
87 void DomStorageContext::DeleteDataModifiedSince(const base::Time& cutoff) { | 87 void DomStorageContext::DeleteDataModifiedSince(const base::Time& cutoff) { |
88 // TODO(michaeln): write me | 88 // TODO(michaeln): write me |
89 } | 89 } |
90 | 90 |
91 void DomStorageContext::PurgeMemory() { | 91 void DomStorageContext::PurgeMemory() { |
92 // TODO(michaeln): write me | 92 // We can only purge memory from the local storage namespace |
benm (inactive)
2012/03/20 13:39:16
did you mean to add these changes in this CL?
| |
93 // which is backed by disk. | |
94 StorageNamespaceMap::iterator found = | |
95 namespaces_.find(kLocalStorageNamespaceId); | |
96 if (found != namespaces_.end()) | |
97 found->second->PurgeMemory(); | |
93 } | 98 } |
94 | 99 |
95 void DomStorageContext::Shutdown() { | 100 void DomStorageContext::Shutdown() { |
96 // TODO(michaeln): write me | 101 StorageNamespaceMap::const_iterator it = namespaces_.begin(); |
102 for (; it != namespaces_.end(); ++it) | |
103 it->second->Shutdown(); | |
97 } | 104 } |
98 | 105 |
99 void DomStorageContext::AddEventObserver(EventObserver* observer) { | 106 void DomStorageContext::AddEventObserver(EventObserver* observer) { |
100 event_observers_.AddObserver(observer); | 107 event_observers_.AddObserver(observer); |
101 } | 108 } |
102 | 109 |
103 void DomStorageContext::RemoveEventObserver(EventObserver* observer) { | 110 void DomStorageContext::RemoveEventObserver(EventObserver* observer) { |
104 event_observers_.RemoveObserver(observer); | 111 event_observers_.RemoveObserver(observer); |
105 } | 112 } |
106 | 113 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 DCHECK_NE(kLocalStorageNamespaceId, existing_id); | 159 DCHECK_NE(kLocalStorageNamespaceId, existing_id); |
153 DCHECK_NE(kLocalStorageNamespaceId, new_id); | 160 DCHECK_NE(kLocalStorageNamespaceId, new_id); |
154 StorageNamespaceMap::iterator found = namespaces_.find(existing_id); | 161 StorageNamespaceMap::iterator found = namespaces_.find(existing_id); |
155 if (found != namespaces_.end()) | 162 if (found != namespaces_.end()) |
156 namespaces_[new_id] = found->second->Clone(new_id); | 163 namespaces_[new_id] = found->second->Clone(new_id); |
157 else | 164 else |
158 CreateSessionNamespace(new_id); | 165 CreateSessionNamespace(new_id); |
159 } | 166 } |
160 | 167 |
161 } // namespace dom_storage | 168 } // namespace dom_storage |
OLD | NEW |