| 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 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "content/browser/indexed_db/indexed_db_connection.h" | 16 #include "content/browser/indexed_db/indexed_db_connection.h" |
| 17 #include "content/browser/indexed_db/indexed_db_cursor.h" | 17 #include "content/browser/indexed_db/indexed_db_cursor.h" |
| 18 #include "content/browser/indexed_db/indexed_db_factory.h" | 18 #include "content/browser/indexed_db/indexed_db_factory.h" |
| 19 #include "content/browser/indexed_db/indexed_db_index_writer.h" | 19 #include "content/browser/indexed_db/indexed_db_index_writer.h" |
| 20 #include "content/browser/indexed_db/indexed_db_tracing.h" | 20 #include "content/browser/indexed_db/indexed_db_tracing.h" |
| 21 #include "content/browser/indexed_db/indexed_db_transaction.h" | 21 #include "content/browser/indexed_db/indexed_db_transaction.h" |
| 22 #include "content/common/indexed_db/indexed_db_key_path.h" | 22 #include "content/common/indexed_db/indexed_db_key_path.h" |
| 23 #include "content/common/indexed_db/indexed_db_key_range.h" | 23 #include "content/common/indexed_db/indexed_db_key_range.h" |
| 24 #include "content/public/browser/browser_thread.h" | |
| 25 #include "third_party/WebKit/public/platform/WebIDBDatabaseException.h" | 24 #include "third_party/WebKit/public/platform/WebIDBDatabaseException.h" |
| 26 | 25 |
| 27 using base::ASCIIToUTF16; | 26 using base::ASCIIToUTF16; |
| 28 using base::Int64ToString16; | 27 using base::Int64ToString16; |
| 29 using blink::WebIDBKeyTypeNumber; | 28 using blink::WebIDBKeyTypeNumber; |
| 30 | 29 |
| 31 namespace content { | 30 namespace content { |
| 32 | 31 |
| 33 // PendingOpenCall has a scoped_refptr<IndexedDBDatabaseCallbacks> because it | 32 // PendingOpenCall has a scoped_refptr<IndexedDBDatabaseCallbacks> because it |
| 34 // isn't a connection yet. | 33 // isn't a connection yet. |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 | 692 |
| 694 struct IndexedDBDatabase::PutOperationParams { | 693 struct IndexedDBDatabase::PutOperationParams { |
| 695 PutOperationParams() {} | 694 PutOperationParams() {} |
| 696 int64 object_store_id; | 695 int64 object_store_id; |
| 697 std::string value; | 696 std::string value; |
| 698 scoped_ptr<IndexedDBKey> key; | 697 scoped_ptr<IndexedDBKey> key; |
| 699 IndexedDBDatabase::PutMode put_mode; | 698 IndexedDBDatabase::PutMode put_mode; |
| 700 scoped_refptr<IndexedDBCallbacks> callbacks; | 699 scoped_refptr<IndexedDBCallbacks> callbacks; |
| 701 std::vector<IndexKeys> index_keys; | 700 std::vector<IndexKeys> index_keys; |
| 702 | 701 |
| 702 private: |
| 703 DISALLOW_COPY_AND_ASSIGN(PutOperationParams); | 703 DISALLOW_COPY_AND_ASSIGN(PutOperationParams); |
| 704 }; | 704 }; |
| 705 | 705 |
| 706 void IndexedDBDatabase::Put(int64 transaction_id, | 706 void IndexedDBDatabase::Put(int64 transaction_id, |
| 707 int64 object_store_id, | 707 int64 object_store_id, |
| 708 std::string* value, | 708 std::string* value, |
| 709 scoped_ptr<IndexedDBKey> key, | 709 scoped_ptr<IndexedDBKey> key, |
| 710 PutMode put_mode, | 710 PutMode put_mode, |
| 711 scoped_refptr<IndexedDBCallbacks> callbacks, | 711 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 712 const std::vector<IndexKeys>& index_keys) { | 712 const std::vector<IndexKeys>& index_keys) { |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 struct IndexedDBDatabase::OpenCursorOperationParams { | 956 struct IndexedDBDatabase::OpenCursorOperationParams { |
| 957 OpenCursorOperationParams() {} | 957 OpenCursorOperationParams() {} |
| 958 int64 object_store_id; | 958 int64 object_store_id; |
| 959 int64 index_id; | 959 int64 index_id; |
| 960 scoped_ptr<IndexedDBKeyRange> key_range; | 960 scoped_ptr<IndexedDBKeyRange> key_range; |
| 961 indexed_db::CursorDirection direction; | 961 indexed_db::CursorDirection direction; |
| 962 indexed_db::CursorType cursor_type; | 962 indexed_db::CursorType cursor_type; |
| 963 IndexedDBDatabase::TaskType task_type; | 963 IndexedDBDatabase::TaskType task_type; |
| 964 scoped_refptr<IndexedDBCallbacks> callbacks; | 964 scoped_refptr<IndexedDBCallbacks> callbacks; |
| 965 | 965 |
| 966 private: |
| 966 DISALLOW_COPY_AND_ASSIGN(OpenCursorOperationParams); | 967 DISALLOW_COPY_AND_ASSIGN(OpenCursorOperationParams); |
| 967 }; | 968 }; |
| 968 | 969 |
| 969 void IndexedDBDatabase::OpenCursor( | 970 void IndexedDBDatabase::OpenCursor( |
| 970 int64 transaction_id, | 971 int64 transaction_id, |
| 971 int64 object_store_id, | 972 int64 object_store_id, |
| 972 int64 index_id, | 973 int64 index_id, |
| 973 scoped_ptr<IndexedDBKeyRange> key_range, | 974 scoped_ptr<IndexedDBKeyRange> key_range, |
| 974 indexed_db::CursorDirection direction, | 975 indexed_db::CursorDirection direction, |
| 975 bool key_only, | 976 bool key_only, |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1664 const base::string16& previous_version, | 1665 const base::string16& previous_version, |
| 1665 int64 previous_int_version, | 1666 int64 previous_int_version, |
| 1666 IndexedDBTransaction* transaction) { | 1667 IndexedDBTransaction* transaction) { |
| 1667 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); | 1668 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); |
| 1668 DCHECK(!transaction); | 1669 DCHECK(!transaction); |
| 1669 metadata_.version = previous_version; | 1670 metadata_.version = previous_version; |
| 1670 metadata_.int_version = previous_int_version; | 1671 metadata_.int_version = previous_int_version; |
| 1671 } | 1672 } |
| 1672 | 1673 |
| 1673 } // namespace content | 1674 } // namespace content |
| OLD | NEW |