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> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
| 14 #include "base/callback.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
17 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
| 19 #include "base/time/time.h" |
18 #include "content/browser/indexed_db/indexed_db_database_error.h" | 20 #include "content/browser/indexed_db/indexed_db_database_error.h" |
19 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" | 21 //#include "content/browser/indexed_db/indexed_db_dispatcher_host.h" |
20 #include "content/common/indexed_db/indexed_db_key.h" | 22 #include "content/common/indexed_db/indexed_db_key.h" |
21 #include "content/common/indexed_db/indexed_db_key_path.h" | 23 #include "content/common/indexed_db/indexed_db_key_path.h" |
22 #include "url/origin.h" | 24 #include "url/origin.h" |
23 | 25 |
24 namespace content { | 26 namespace content { |
25 class IndexedDBBlobInfo; | 27 class IndexedDBBlobInfo; |
26 class IndexedDBConnection; | 28 class IndexedDBConnection; |
27 class IndexedDBCursor; | 29 class IndexedDBCursor; |
28 class IndexedDBDatabase; | 30 class IndexedDBDatabase; |
29 class IndexedDBDatabaseCallbacks; | 31 class IndexedDBDatabaseCallbacks; |
30 struct IndexedDBDatabaseMetadata; | 32 struct IndexedDBDatabaseMetadata; |
31 struct IndexedDBReturnValue; | 33 struct IndexedDBReturnValue; |
32 struct IndexedDBValue; | 34 struct IndexedDBValue; |
33 | 35 |
34 class CONTENT_EXPORT IndexedDBCallbacks | 36 class CONTENT_EXPORT IndexedDBCallbacks |
35 : public base::RefCounted<IndexedDBCallbacks> { | 37 : public base::RefCounted<IndexedDBCallbacks> { |
36 public: | 38 public: |
| 39 #if 1 |
| 40 IndexedDBCallbacks(); |
| 41 #else |
37 // Simple payload responses | 42 // Simple payload responses |
38 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, | 43 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, |
39 int32_t ipc_thread_id, | 44 int32_t ipc_thread_id, |
40 int32_t ipc_callbacks_id); | 45 int32_t ipc_callbacks_id); |
41 | 46 |
42 // IndexedDBCursor responses | 47 // IndexedDBCursor responses |
43 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, | 48 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, |
44 int32_t ipc_thread_id, | 49 int32_t ipc_thread_id, |
45 int32_t ipc_callbacks_id, | 50 int32_t ipc_callbacks_id, |
46 int32_t ipc_cursor_id); | 51 int32_t ipc_cursor_id); |
47 | 52 |
48 // IndexedDBDatabase responses | 53 // IndexedDBDatabase responses |
49 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, | 54 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, |
50 int32_t ipc_thread_id, | 55 int32_t ipc_thread_id, |
51 int32_t ipc_callbacks_id, | 56 int32_t ipc_callbacks_id, |
52 int32_t ipc_database_callbacks_id, | 57 int32_t ipc_database_callbacks_id, |
53 int64_t host_transaction_id, | 58 int64_t host_transaction_id, |
54 const url::Origin& origin); | 59 const url::Origin& origin); |
| 60 #endif |
55 | 61 |
56 virtual void OnError(const IndexedDBDatabaseError& error); | 62 virtual void OnError(const IndexedDBDatabaseError& error); |
57 | 63 |
58 // IndexedDBFactory::GetDatabaseNames | 64 // IndexedDBFactory::GetDatabaseNames |
59 virtual void OnSuccess(const std::vector<base::string16>& string); | 65 virtual void OnSuccess(const std::vector<base::string16>& string); |
60 | 66 |
61 // IndexedDBFactory::Open / DeleteDatabase | 67 // IndexedDBFactory::Open / DeleteDatabase |
62 virtual void OnBlocked(int64_t existing_version); | 68 virtual void OnBlocked(int64_t existing_version); |
63 | 69 |
64 // IndexedDBFactory::Open | 70 // IndexedDBFactory::Open |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 protected: | 120 protected: |
115 virtual ~IndexedDBCallbacks(); | 121 virtual ~IndexedDBCallbacks(); |
116 | 122 |
117 private: | 123 private: |
118 void RegisterBlobsAndSend(const std::vector<IndexedDBBlobInfo>& blob_info, | 124 void RegisterBlobsAndSend(const std::vector<IndexedDBBlobInfo>& blob_info, |
119 const base::Closure& callback); | 125 const base::Closure& callback); |
120 | 126 |
121 friend class base::RefCounted<IndexedDBCallbacks>; | 127 friend class base::RefCounted<IndexedDBCallbacks>; |
122 | 128 |
123 // Originally from IndexedDBCallbacks: | 129 // Originally from IndexedDBCallbacks: |
124 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; | 130 // scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; |
125 int32_t ipc_callbacks_id_; | 131 int32_t ipc_callbacks_id_; |
126 int32_t ipc_thread_id_; | 132 int32_t ipc_thread_id_; |
127 | 133 |
128 // IndexedDBCursor callbacks ------------------------ | 134 // IndexedDBCursor callbacks ------------------------ |
129 int32_t ipc_cursor_id_; | 135 int32_t ipc_cursor_id_; |
130 | 136 |
131 // IndexedDBDatabase callbacks ------------------------ | 137 // IndexedDBDatabase callbacks ------------------------ |
132 int64_t host_transaction_id_; | 138 int64_t host_transaction_id_; |
133 url::Origin origin_; | 139 url::Origin origin_; |
134 int32_t ipc_database_id_; | 140 int32_t ipc_database_id_; |
135 int32_t ipc_database_callbacks_id_; | 141 int32_t ipc_database_callbacks_id_; |
136 | 142 |
137 // Stored in OnDataLoss, merged with OnUpgradeNeeded response. | 143 // Stored in OnDataLoss, merged with OnUpgradeNeeded response. |
138 blink::WebIDBDataLoss data_loss_; | 144 blink::WebIDBDataLoss data_loss_; |
139 std::string data_loss_message_; | 145 std::string data_loss_message_; |
140 | 146 |
141 // The "blocked" event should be sent at most once per request. | 147 // The "blocked" event should be sent at most once per request. |
142 bool sent_blocked_; | 148 bool sent_blocked_; |
143 base::TimeTicks connection_open_start_time_; | 149 base::TimeTicks connection_open_start_time_; |
144 DISALLOW_COPY_AND_ASSIGN(IndexedDBCallbacks); | 150 DISALLOW_COPY_AND_ASSIGN(IndexedDBCallbacks); |
145 }; | 151 }; |
146 | 152 |
147 } // namespace content | 153 } // namespace content |
148 | 154 |
149 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ | 155 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ |
OLD | NEW |