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/time.h" | 9 #include "base/time.h" |
10 #include "webkit/dom_storage/dom_storage_namespace.h" | 10 #include "webkit/dom_storage/dom_storage_namespace.h" |
11 #include "webkit/dom_storage/dom_storage_task_runner.h" | 11 #include "webkit/dom_storage/dom_storage_task_runner.h" |
12 #include "webkit/dom_storage/dom_storage_types.h" | 12 #include "webkit/dom_storage/dom_storage_types.h" |
13 #include "webkit/quota/special_storage_policy.h" | 13 #include "webkit/quota/special_storage_policy.h" |
14 | 14 |
15 namespace dom_storage { | 15 namespace dom_storage { |
16 | 16 |
17 DomStorageContext::DomStorageContext( | 17 DomStorageContext::DomStorageContext( |
18 const FilePath& directory, | 18 const FilePath& directory, |
19 quota::SpecialStoragePolicy* special_storage_policy, | 19 quota::SpecialStoragePolicy* special_storage_policy, |
20 DomStorageTaskRunner* task_runner) | 20 DomStorageTaskRunner* task_runner) |
21 : directory_(directory), | 21 : directory_(directory), |
22 task_runner_(task_runner) { | 22 task_runner_(task_runner), |
| 23 special_storage_policy_(special_storage_policy) { |
23 // AtomicSequenceNum starts at 0 but we want to start session | 24 // AtomicSequenceNum starts at 0 but we want to start session |
24 // namespace ids at one since zero is reserved for the | 25 // namespace ids at one since zero is reserved for the |
25 // kLocalStorageNamespaceId. | 26 // kLocalStorageNamespaceId. |
26 session_id_sequence_.GetNext(); | 27 session_id_sequence_.GetNext(); |
27 } | 28 } |
28 | 29 |
29 DomStorageContext::~DomStorageContext() { | 30 DomStorageContext::~DomStorageContext() { |
30 } | 31 } |
31 | 32 |
32 DomStorageNamespace* DomStorageContext::GetStorageNamespace( | 33 DomStorageNamespace* DomStorageContext::GetStorageNamespace( |
33 int64 namespace_id) { | 34 int64 namespace_id) { |
34 StorageNamespaceMap::iterator found = namespaces_.find(namespace_id); | 35 StorageNamespaceMap::iterator found = namespaces_.find(namespace_id); |
35 if (found == namespaces_.end()) { | 36 if (found == namespaces_.end()) { |
36 if (namespace_id == kLocalStorageNamespaceId) { | 37 if (namespace_id == kLocalStorageNamespaceId) { |
37 DomStorageNamespace* local = | 38 DomStorageNamespace* local = |
38 new DomStorageNamespace(directory_, task_runner_); | 39 new DomStorageNamespace(directory_, task_runner_); |
39 namespaces_[kLocalStorageNamespaceId] = local; | 40 namespaces_[kLocalStorageNamespaceId] = local; |
40 return local; | 41 return local; |
41 } | 42 } |
42 return NULL; | 43 return NULL; |
43 } | 44 } |
44 return found->second; | 45 return found->second; |
45 } | 46 } |
46 | 47 |
| 48 void DomStorageContext::GetUsageInfo(std::vector<UsageInfo>* info) { |
| 49 } |
| 50 |
| 51 void DomStorageContext::DeleteOrigin(const GURL& origin) { |
| 52 } |
| 53 |
| 54 void DomStorageContext::DeleteDataModifiedSince(const base::Time& cutoff) { |
| 55 } |
| 56 |
| 57 void DomStorageContext::PurgeMemory() { |
| 58 } |
| 59 |
| 60 void DomStorageContext::Shutdown() { |
| 61 } |
| 62 |
47 void DomStorageContext::AddEventObserver(EventObserver* observer) { | 63 void DomStorageContext::AddEventObserver(EventObserver* observer) { |
48 event_observers_.AddObserver(observer); | 64 event_observers_.AddObserver(observer); |
49 } | 65 } |
50 | 66 |
51 void DomStorageContext::RemoveEventObserver(EventObserver* observer) { | 67 void DomStorageContext::RemoveEventObserver(EventObserver* observer) { |
52 event_observers_.RemoveObserver(observer); | 68 event_observers_.RemoveObserver(observer); |
53 } | 69 } |
54 | 70 |
55 void DomStorageContext::NotifyItemSet( | 71 void DomStorageContext::NotifyItemSet( |
56 const DomStorageArea* area, | 72 const DomStorageArea* area, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 DCHECK_NE(kLocalStorageNamespaceId, existing_id); | 116 DCHECK_NE(kLocalStorageNamespaceId, existing_id); |
101 DCHECK_NE(kLocalStorageNamespaceId, new_id); | 117 DCHECK_NE(kLocalStorageNamespaceId, new_id); |
102 StorageNamespaceMap::iterator found = namespaces_.find(existing_id); | 118 StorageNamespaceMap::iterator found = namespaces_.find(existing_id); |
103 if (found != namespaces_.end()) | 119 if (found != namespaces_.end()) |
104 namespaces_[new_id] = found->second->Clone(new_id); | 120 namespaces_[new_id] = found->second->Clone(new_id); |
105 else | 121 else |
106 CreateSessionNamespace(new_id); | 122 CreateSessionNamespace(new_id); |
107 } | 123 } |
108 | 124 |
109 } // namespace dom_storage | 125 } // namespace dom_storage |
OLD | NEW |