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/session_storage_database.h" | 5 #include "webkit/dom_storage/session_storage_database.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // <namespaceid>. | 216 // <namespaceid>. |
217 current_namespace_start_key = key; | 217 current_namespace_start_key = key; |
218 namespace_ids->push_back( | 218 namespace_ids->push_back( |
219 key.substr(namespace_prefix.length(), | 219 key.substr(namespace_prefix.length(), |
220 key.length() - namespace_prefix.length() - 1)); | 220 key.length() - namespace_prefix.length() - 1)); |
221 } | 221 } |
222 } | 222 } |
223 return true; | 223 return true; |
224 } | 224 } |
225 | 225 |
| 226 bool SessionStorageDatabase::ReadOriginsInNamespace( |
| 227 const std::string& namespace_id, std::vector<GURL>* origins) { |
| 228 std::map<std::string, std::string> areas; |
| 229 if (!GetAreasInNamespace(namespace_id, &areas)) |
| 230 return false; |
| 231 for (std::map<std::string, std::string>::const_iterator it = areas.begin(); |
| 232 it != areas.end(); ++it) |
| 233 origins->push_back(GURL(it->first)); |
| 234 return true; |
| 235 } |
| 236 |
226 bool SessionStorageDatabase::LazyOpen(bool create_if_needed) { | 237 bool SessionStorageDatabase::LazyOpen(bool create_if_needed) { |
227 base::AutoLock auto_lock(db_lock_); | 238 base::AutoLock auto_lock(db_lock_); |
228 if (db_error_ || is_inconsistent_) { | 239 if (db_error_ || is_inconsistent_) { |
229 // Don't try to open a database that we know has failed already. | 240 // Don't try to open a database that we know has failed already. |
230 return false; | 241 return false; |
231 } | 242 } |
232 if (IsOpen()) | 243 if (IsOpen()) |
233 return true; | 244 return true; |
234 | 245 |
235 if (!create_if_needed && | 246 if (!create_if_needed && |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 std::string SessionStorageDatabase::MapKey(const std::string& map_id, | 595 std::string SessionStorageDatabase::MapKey(const std::string& map_id, |
585 const std::string& key) { | 596 const std::string& key) { |
586 return base::StringPrintf("map-%s-%s", map_id.c_str(), key.c_str()); | 597 return base::StringPrintf("map-%s-%s", map_id.c_str(), key.c_str()); |
587 } | 598 } |
588 | 599 |
589 const char* SessionStorageDatabase::NextMapIdKey() { | 600 const char* SessionStorageDatabase::NextMapIdKey() { |
590 return "next-map-id"; | 601 return "next-map-id"; |
591 } | 602 } |
592 | 603 |
593 } // namespace dom_storage | 604 } // namespace dom_storage |
OLD | NEW |