| 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 callbacks->OnError(IndexedDBDatabaseError( | 309 callbacks->OnError(IndexedDBDatabaseError( |
| 310 blink::WebIDBDatabaseExceptionUnknownError, | 310 blink::WebIDBDatabaseExceptionUnknownError, |
| 311 ASCIIToUTF16( | 311 ASCIIToUTF16( |
| 312 "Internal error creating database backend for indexedDB.open."))); | 312 "Internal error creating database backend for indexedDB.open."))); |
| 313 return; | 313 return; |
| 314 } | 314 } |
| 315 } else { | 315 } else { |
| 316 database = it->second; | 316 database = it->second; |
| 317 } | 317 } |
| 318 | 318 |
| 319 database->OpenConnection(callbacks, | 319 if (data_loss != blink::WebIDBDataLossNone) |
| 320 database_callbacks, | 320 callbacks->OnDataLoss(data_loss, data_loss_message); |
| 321 transaction_id, | 321 |
| 322 version, | 322 database->OpenConnection( |
| 323 data_loss, | 323 callbacks, database_callbacks, transaction_id, version); |
| 324 data_loss_message); | |
| 325 | 324 |
| 326 if (!was_open && database->ConnectionCount() > 0) | 325 if (!was_open && database->ConnectionCount() > 0) |
| 327 database_map_[unique_identifier] = database; | 326 database_map_[unique_identifier] = database; |
| 328 } | 327 } |
| 329 | 328 |
| 330 std::vector<IndexedDBDatabase*> IndexedDBFactory::GetOpenDatabasesForOrigin( | 329 std::vector<IndexedDBDatabase*> IndexedDBFactory::GetOpenDatabasesForOrigin( |
| 331 const GURL& origin_url) const { | 330 const GURL& origin_url) const { |
| 332 std::vector<IndexedDBDatabase*> result; | 331 std::vector<IndexedDBDatabase*> result; |
| 333 for (IndexedDBDatabaseMap::const_iterator it = database_map_.begin(); | 332 for (IndexedDBDatabaseMap::const_iterator it = database_map_.begin(); |
| 334 it != database_map_.end(); | 333 it != database_map_.end(); |
| 335 ++it) { | 334 ++it) { |
| 336 if (it->first.first == origin_url) | 335 if (it->first.first == origin_url) |
| 337 result.push_back(it->second); | 336 result.push_back(it->second); |
| 338 } | 337 } |
| 339 return result; | 338 return result; |
| 340 } | 339 } |
| 341 | 340 |
| 342 } // namespace content | 341 } // namespace content |
| OLD | NEW |