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 "content/browser/dom_storage/dom_storage_context_impl.h" | 5 #include "content/browser/dom_storage/dom_storage_context_impl.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/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 DOMStorageNamespace* DOMStorageContextImpl::GetStorageNamespace( | 63 DOMStorageNamespace* DOMStorageContextImpl::GetStorageNamespace( |
64 int64 namespace_id) { | 64 int64 namespace_id) { |
65 if (is_shutdown_) | 65 if (is_shutdown_) |
66 return NULL; | 66 return NULL; |
67 StorageNamespaceMap::iterator found = namespaces_.find(namespace_id); | 67 StorageNamespaceMap::iterator found = namespaces_.find(namespace_id); |
68 if (found == namespaces_.end()) { | 68 if (found == namespaces_.end()) { |
69 if (namespace_id == kLocalStorageNamespaceId) { | 69 if (namespace_id == kLocalStorageNamespaceId) { |
70 if (!localstorage_directory_.empty()) { | 70 if (!localstorage_directory_.empty()) { |
71 if (!file_util::CreateDirectory(localstorage_directory_)) { | 71 if (!base::CreateDirectory(localstorage_directory_)) { |
72 LOG(ERROR) << "Failed to create 'Local Storage' directory," | 72 LOG(ERROR) << "Failed to create 'Local Storage' directory," |
73 " falling back to in-memory only."; | 73 " falling back to in-memory only."; |
74 localstorage_directory_ = base::FilePath(); | 74 localstorage_directory_ = base::FilePath(); |
75 } | 75 } |
76 } | 76 } |
77 DOMStorageNamespace* local = | 77 DOMStorageNamespace* local = |
78 new DOMStorageNamespace(localstorage_directory_, task_runner_.get()); | 78 new DOMStorageNamespace(localstorage_directory_, task_runner_.get()); |
79 namespaces_[kLocalStorageNamespaceId] = local; | 79 namespaces_[kLocalStorageNamespaceId] = local; |
80 return local; | 80 return local; |
81 } | 81 } |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 return SessionStorageNamespace::MERGE_RESULT_NAMESPACE_NOT_FOUND; | 498 return SessionStorageNamespace::MERGE_RESULT_NAMESPACE_NOT_FOUND; |
499 DOMStorageNamespace* ns1 = it->second; | 499 DOMStorageNamespace* ns1 = it->second; |
500 it = namespaces_.find(namespace2_id); | 500 it = namespaces_.find(namespace2_id); |
501 if (it == namespaces_.end()) | 501 if (it == namespaces_.end()) |
502 return SessionStorageNamespace::MERGE_RESULT_NAMESPACE_NOT_FOUND; | 502 return SessionStorageNamespace::MERGE_RESULT_NAMESPACE_NOT_FOUND; |
503 DOMStorageNamespace* ns2 = it->second; | 503 DOMStorageNamespace* ns2 = it->second; |
504 return ns1->Merge(actually_merge, process_id, ns2, this); | 504 return ns1->Merge(actually_merge, process_id, ns2, this); |
505 } | 505 } |
506 | 506 |
507 } // namespace content | 507 } // namespace content |
OLD | NEW |