| 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 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // IndexedDBFactory::Open | 52 // IndexedDBFactory::Open |
| 53 virtual void OnUpgradeNeeded( | 53 virtual void OnUpgradeNeeded( |
| 54 int64_t old_version, | 54 int64_t old_version, |
| 55 std::unique_ptr<IndexedDBConnection> connection, | 55 std::unique_ptr<IndexedDBConnection> connection, |
| 56 const content::IndexedDBDatabaseMetadata& metadata, | 56 const content::IndexedDBDatabaseMetadata& metadata, |
| 57 const IndexedDBDataLossInfo& data_loss_info); | 57 const IndexedDBDataLossInfo& data_loss_info); |
| 58 virtual void OnSuccess(std::unique_ptr<IndexedDBConnection> connection, | 58 virtual void OnSuccess(std::unique_ptr<IndexedDBConnection> connection, |
| 59 const content::IndexedDBDatabaseMetadata& metadata); | 59 const content::IndexedDBDatabaseMetadata& metadata); |
| 60 | 60 |
| 61 // IndexedDBDatabase::OpenCursor | 61 // IndexedDBDatabase::OpenCursor |
| 62 virtual void OnSuccess(scoped_refptr<IndexedDBCursor> cursor, | 62 virtual void OnSuccess(std::unique_ptr<IndexedDBCursor> cursor, |
| 63 const IndexedDBKey& key, | 63 const IndexedDBKey& key, |
| 64 const IndexedDBKey& primary_key, | 64 const IndexedDBKey& primary_key, |
| 65 IndexedDBValue* value); | 65 IndexedDBValue* value); |
| 66 | 66 |
| 67 // IndexedDBCursor::Continue / Advance | 67 // IndexedDBCursor::Continue / Advance |
| 68 virtual void OnSuccess(const IndexedDBKey& key, | 68 virtual void OnSuccess(const IndexedDBKey& key, |
| 69 const IndexedDBKey& primary_key, | 69 const IndexedDBKey& primary_key, |
| 70 IndexedDBValue* value); | 70 IndexedDBValue* value); |
| 71 | 71 |
| 72 // IndexedDBCursor::PrefetchContinue | 72 // IndexedDBCursor::PrefetchContinue |
| (...skipping 19 matching lines...) Expand all Loading... |
| 92 | 92 |
| 93 // IndexedDBCursor::Continue / Advance (when complete) | 93 // IndexedDBCursor::Continue / Advance (when complete) |
| 94 virtual void OnSuccess(); | 94 virtual void OnSuccess(); |
| 95 | 95 |
| 96 // Checks to see if the associated dispatcher host is still connected. If | 96 // Checks to see if the associated dispatcher host is still connected. If |
| 97 // not this request can be dropped. | 97 // not this request can be dropped. |
| 98 virtual bool IsValid() const; | 98 virtual bool IsValid() const; |
| 99 | 99 |
| 100 void SetConnectionOpenStartTime(const base::TimeTicks& start_time); | 100 void SetConnectionOpenStartTime(const base::TimeTicks& start_time); |
| 101 | 101 |
| 102 void set_host_transaction_id(int64_t host_transaction_id) { | |
| 103 host_transaction_id_ = host_transaction_id; | |
| 104 } | |
| 105 | |
| 106 protected: | 102 protected: |
| 107 virtual ~IndexedDBCallbacks(); | 103 virtual ~IndexedDBCallbacks(); |
| 108 | 104 |
| 109 private: | 105 private: |
| 110 void RegisterBlobsAndSend(const std::vector<IndexedDBBlobInfo>& blob_info, | 106 void RegisterBlobsAndSend(const std::vector<IndexedDBBlobInfo>& blob_info, |
| 111 const base::Closure& callback); | 107 const base::Closure& callback); |
| 112 | 108 |
| 113 friend class base::RefCounted<IndexedDBCallbacks>; | 109 friend class base::RefCounted<IndexedDBCallbacks>; |
| 114 | 110 |
| 115 class IOThreadHelper; | 111 class IOThreadHelper; |
| 116 | 112 |
| 117 // Originally from IndexedDBCallbacks: | 113 // Originally from IndexedDBCallbacks: |
| 118 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; | 114 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; |
| 119 | 115 |
| 120 // IndexedDBDatabase callbacks ------------------------ | 116 // IndexedDBDatabase callbacks ------------------------ |
| 121 int64_t host_transaction_id_; | |
| 122 url::Origin origin_; | 117 url::Origin origin_; |
| 123 bool database_sent_ = false; | 118 bool database_sent_ = false; |
| 124 | 119 |
| 125 // Used to assert that OnSuccess is only called if there was no data loss. | 120 // Used to assert that OnSuccess is only called if there was no data loss. |
| 126 blink::WebIDBDataLoss data_loss_; | 121 blink::WebIDBDataLoss data_loss_; |
| 127 | 122 |
| 128 // The "blocked" event should be sent at most once per request. | 123 // The "blocked" event should be sent at most once per request. |
| 129 bool sent_blocked_; | 124 bool sent_blocked_; |
| 130 base::TimeTicks connection_open_start_time_; | 125 base::TimeTicks connection_open_start_time_; |
| 131 | 126 |
| 132 std::unique_ptr<IOThreadHelper, BrowserThread::DeleteOnIOThread> io_helper_; | 127 std::unique_ptr<IOThreadHelper, BrowserThread::DeleteOnIOThread> io_helper_; |
| 133 base::ThreadChecker thread_checker_; | 128 base::ThreadChecker thread_checker_; |
| 134 | 129 |
| 135 DISALLOW_COPY_AND_ASSIGN(IndexedDBCallbacks); | 130 DISALLOW_COPY_AND_ASSIGN(IndexedDBCallbacks); |
| 136 }; | 131 }; |
| 137 | 132 |
| 138 } // namespace content | 133 } // namespace content |
| 139 | 134 |
| 140 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ | 135 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ |
| OLD | NEW |