OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/indexed_db/indexed_db_factory.h" | 5 #include "content/browser/indexed_db/indexed_db_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 10 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionUnknownError, | 123 IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionUnknownError, |
124 "Internal error opening backing store for " | 124 "Internal error opening backing store for " |
125 "indexedDB.webkitGetDatabaseNames.")); | 125 "indexedDB.webkitGetDatabaseNames.")); |
126 return; | 126 return; |
127 } | 127 } |
128 | 128 |
129 callbacks->OnSuccess(backing_store->GetDatabaseNames()); | 129 callbacks->OnSuccess(backing_store->GetDatabaseNames()); |
130 } | 130 } |
131 | 131 |
132 void IndexedDBFactory::DeleteDatabase( | 132 void IndexedDBFactory::DeleteDatabase( |
133 const string16& name, | 133 const base::string16& name, |
134 scoped_refptr<IndexedDBCallbacks> callbacks, | 134 scoped_refptr<IndexedDBCallbacks> callbacks, |
135 const GURL& origin_url, | 135 const GURL& origin_url, |
136 const base::FilePath& data_directory) { | 136 const base::FilePath& data_directory) { |
137 IDB_TRACE("IndexedDBFactory::DeleteDatabase"); | 137 IDB_TRACE("IndexedDBFactory::DeleteDatabase"); |
138 IndexedDBDatabase::Identifier unique_identifier(origin_url, name); | 138 IndexedDBDatabase::Identifier unique_identifier(origin_url, name); |
139 IndexedDBDatabaseMap::iterator it = database_map_.find(unique_identifier); | 139 IndexedDBDatabaseMap::iterator it = database_map_.find(unique_identifier); |
140 if (it != database_map_.end()) { | 140 if (it != database_map_.end()) { |
141 // If there are any connections to the database, directly delete the | 141 // If there are any connections to the database, directly delete the |
142 // database. | 142 // database. |
143 it->second->DeleteDatabase(callbacks); | 143 it->second->DeleteDatabase(callbacks); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // type. | 226 // type. |
227 DCHECK(session_only_backing_stores_.empty() || open_in_memory); | 227 DCHECK(session_only_backing_stores_.empty() || open_in_memory); |
228 | 228 |
229 return backing_store; | 229 return backing_store; |
230 } | 230 } |
231 | 231 |
232 return 0; | 232 return 0; |
233 } | 233 } |
234 | 234 |
235 void IndexedDBFactory::Open( | 235 void IndexedDBFactory::Open( |
236 const string16& name, | 236 const base::string16& name, |
237 int64 version, | 237 int64 version, |
238 int64 transaction_id, | 238 int64 transaction_id, |
239 scoped_refptr<IndexedDBCallbacks> callbacks, | 239 scoped_refptr<IndexedDBCallbacks> callbacks, |
240 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, | 240 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, |
241 const GURL& origin_url, | 241 const GURL& origin_url, |
242 const base::FilePath& data_directory) { | 242 const base::FilePath& data_directory) { |
243 IDB_TRACE("IndexedDBFactory::Open"); | 243 IDB_TRACE("IndexedDBFactory::Open"); |
244 scoped_refptr<IndexedDBDatabase> database; | 244 scoped_refptr<IndexedDBDatabase> database; |
245 IndexedDBDatabase::Identifier unique_identifier(origin_url, name); | 245 IndexedDBDatabase::Identifier unique_identifier(origin_url, name); |
246 IndexedDBDatabaseMap::iterator it = database_map_.find(unique_identifier); | 246 IndexedDBDatabaseMap::iterator it = database_map_.find(unique_identifier); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 for (IndexedDBDatabaseMap::const_iterator it = database_map_.begin(); | 300 for (IndexedDBDatabaseMap::const_iterator it = database_map_.begin(); |
301 it != database_map_.end(); | 301 it != database_map_.end(); |
302 ++it) { | 302 ++it) { |
303 if (it->first.first == origin_url) | 303 if (it->first.first == origin_url) |
304 result.push_back(it->second.get()); | 304 result.push_back(it->second.get()); |
305 } | 305 } |
306 return result; | 306 return result; |
307 } | 307 } |
308 | 308 |
309 } // namespace content | 309 } // namespace content |
OLD | NEW |