| 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_database.h" | 5 #include "content/browser/indexed_db/indexed_db_database.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/stl_util.h" | 22 #include "base/stl_util.h" |
| 23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 25 #include "content/browser/indexed_db/indexed_db_blob_info.h" | 25 #include "content/browser/indexed_db/indexed_db_blob_info.h" |
| 26 #include "content/browser/indexed_db/indexed_db_class_factory.h" | 26 #include "content/browser/indexed_db/indexed_db_class_factory.h" |
| 27 #include "content/browser/indexed_db/indexed_db_connection.h" | 27 #include "content/browser/indexed_db/indexed_db_connection.h" |
| 28 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 28 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
| 29 #include "content/browser/indexed_db/indexed_db_cursor.h" | 29 #include "content/browser/indexed_db/indexed_db_cursor.h" |
| 30 #include "content/browser/indexed_db/indexed_db_factory.h" | 30 #include "content/browser/indexed_db/indexed_db_factory.h" |
| 31 #include "content/browser/indexed_db/indexed_db_index_writer.h" | 31 #include "content/browser/indexed_db/indexed_db_index_writer.h" |
| 32 #include "content/browser/indexed_db/indexed_db_observer.h" |
| 32 #include "content/browser/indexed_db/indexed_db_pending_connection.h" | 33 #include "content/browser/indexed_db/indexed_db_pending_connection.h" |
| 33 #include "content/browser/indexed_db/indexed_db_return_value.h" | 34 #include "content/browser/indexed_db/indexed_db_return_value.h" |
| 34 #include "content/browser/indexed_db/indexed_db_tracing.h" | 35 #include "content/browser/indexed_db/indexed_db_tracing.h" |
| 35 #include "content/browser/indexed_db/indexed_db_transaction.h" | 36 #include "content/browser/indexed_db/indexed_db_transaction.h" |
| 36 #include "content/browser/indexed_db/indexed_db_value.h" | 37 #include "content/browser/indexed_db/indexed_db_value.h" |
| 37 #include "content/common/indexed_db/indexed_db_constants.h" | 38 #include "content/common/indexed_db/indexed_db_constants.h" |
| 38 #include "content/common/indexed_db/indexed_db_key_path.h" | 39 #include "content/common/indexed_db/indexed_db_key_path.h" |
| 39 #include "content/common/indexed_db/indexed_db_key_range.h" | 40 #include "content/common/indexed_db/indexed_db_key_range.h" |
| 40 #include "content/public/common/content_switches.h" | 41 #include "content/public/common/content_switches.h" |
| 41 #include "storage/browser/blob/blob_data_handle.h" | 42 #include "storage/browser/blob/blob_data_handle.h" |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 void IndexedDBDatabase::Abort(int64_t transaction_id, | 535 void IndexedDBDatabase::Abort(int64_t transaction_id, |
| 535 const IndexedDBDatabaseError& error) { | 536 const IndexedDBDatabaseError& error) { |
| 536 IDB_TRACE1("IndexedDBDatabase::Abort(error)", "txn.id", transaction_id); | 537 IDB_TRACE1("IndexedDBDatabase::Abort(error)", "txn.id", transaction_id); |
| 537 // If the transaction is unknown, then it has already been aborted by the | 538 // If the transaction is unknown, then it has already been aborted by the |
| 538 // backend before this call so it is safe to ignore it. | 539 // backend before this call so it is safe to ignore it. |
| 539 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 540 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 540 if (transaction) | 541 if (transaction) |
| 541 transaction->Abort(error); | 542 transaction->Abort(error); |
| 542 } | 543 } |
| 543 | 544 |
| 545 void IndexedDBDatabase::Observe(int64_t transaction_id, int64_t observer_id) { |
| 546 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 547 if (!transaction) |
| 548 return; |
| 549 transaction->AddPendingObserver( |
| 550 base::WrapUnique(new IndexedDBObserver(observer_id))); |
| 551 } |
| 552 |
| 544 void IndexedDBDatabase::GetAll(int64_t transaction_id, | 553 void IndexedDBDatabase::GetAll(int64_t transaction_id, |
| 545 int64_t object_store_id, | 554 int64_t object_store_id, |
| 546 int64_t index_id, | 555 int64_t index_id, |
| 547 std::unique_ptr<IndexedDBKeyRange> key_range, | 556 std::unique_ptr<IndexedDBKeyRange> key_range, |
| 548 bool key_only, | 557 bool key_only, |
| 549 int64_t max_count, | 558 int64_t max_count, |
| 550 scoped_refptr<IndexedDBCallbacks> callbacks) { | 559 scoped_refptr<IndexedDBCallbacks> callbacks) { |
| 551 IDB_TRACE1("IndexedDBDatabase::GetAll", "txn.id", transaction_id); | 560 IDB_TRACE1("IndexedDBDatabase::GetAll", "txn.id", transaction_id); |
| 552 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 561 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 553 if (!transaction) | 562 if (!transaction) |
| (...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1950 | 1959 |
| 1951 void IndexedDBDatabase::VersionChangeAbortOperation( | 1960 void IndexedDBDatabase::VersionChangeAbortOperation( |
| 1952 int64_t previous_version, | 1961 int64_t previous_version, |
| 1953 IndexedDBTransaction* transaction) { | 1962 IndexedDBTransaction* transaction) { |
| 1954 DCHECK(!transaction); | 1963 DCHECK(!transaction); |
| 1955 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); | 1964 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); |
| 1956 metadata_.version = previous_version; | 1965 metadata_.version = previous_version; |
| 1957 } | 1966 } |
| 1958 | 1967 |
| 1959 } // namespace content | 1968 } // namespace content |
| OLD | NEW |