Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: content/browser/indexed_db/indexed_db_callbacks.h

Issue 2370643004: Port messages sent by WebIDBFactoryImpl to Mojo. (Closed)
Patch Set: Addressed most of dcheng@'s feedback. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/strings/string16.h" 17 #include "base/strings/string16.h"
18 #include "content/browser/indexed_db/indexed_db_database_error.h" 18 #include "content/browser/indexed_db/indexed_db_database_error.h"
19 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" 19 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h"
20 #include "content/common/indexed_db/indexed_db.mojom.h"
20 #include "content/common/indexed_db/indexed_db_key.h" 21 #include "content/common/indexed_db/indexed_db_key.h"
21 #include "content/common/indexed_db/indexed_db_key_path.h" 22 #include "content/common/indexed_db/indexed_db_key_path.h"
22 #include "url/origin.h" 23 #include "url/origin.h"
23 24
24 namespace content { 25 namespace content {
25 class IndexedDBBlobInfo; 26 class IndexedDBBlobInfo;
26 class IndexedDBConnection; 27 class IndexedDBConnection;
27 class IndexedDBCursor; 28 class IndexedDBCursor;
28 class IndexedDBDatabase; 29 class IndexedDBDatabase;
29 class IndexedDBDatabaseCallbacks; 30 class IndexedDBDatabaseCallbacks;
30 struct IndexedDBDataLossInfo; 31 struct IndexedDBDataLossInfo;
31 struct IndexedDBDatabaseMetadata; 32 struct IndexedDBDatabaseMetadata;
32 struct IndexedDBReturnValue; 33 struct IndexedDBReturnValue;
33 struct IndexedDBValue; 34 struct IndexedDBValue;
34 35
35 class CONTENT_EXPORT IndexedDBCallbacks 36 class CONTENT_EXPORT IndexedDBCallbacks
36 : public base::RefCounted<IndexedDBCallbacks> { 37 : public base::RefCounted<IndexedDBCallbacks> {
37 public: 38 public:
38 // Simple payload responses 39 // Simple payload responses
39 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, 40 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host,
40 int32_t ipc_thread_id, 41 int32_t ipc_thread_id,
41 int32_t ipc_callbacks_id); 42 int32_t ipc_callbacks_id);
42 43
43 // IndexedDBCursor responses 44 // IndexedDBCursor responses
44 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, 45 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host,
45 int32_t ipc_thread_id, 46 int32_t ipc_thread_id,
46 int32_t ipc_callbacks_id, 47 int32_t ipc_callbacks_id,
47 int32_t ipc_cursor_id); 48 int32_t ipc_cursor_id);
48 49
49 // IndexedDBDatabase responses 50 // Mojo-based responses
50 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, 51 IndexedDBCallbacks(
51 int32_t ipc_thread_id, 52 IndexedDBDispatcherHost* dispatcher_host,
52 int32_t ipc_callbacks_id, 53 const url::Origin& origin,
53 int32_t ipc_database_callbacks_id, 54 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info);
54 int64_t host_transaction_id,
55 const url::Origin& origin);
56 55
57 virtual void OnError(const IndexedDBDatabaseError& error); 56 virtual void OnError(const IndexedDBDatabaseError& error);
58 57
59 // IndexedDBFactory::GetDatabaseNames 58 // IndexedDBFactory::GetDatabaseNames
60 virtual void OnSuccess(const std::vector<base::string16>& string); 59 virtual void OnSuccess(const std::vector<base::string16>& string);
61 60
62 // IndexedDBFactory::Open / DeleteDatabase 61 // IndexedDBFactory::Open / DeleteDatabase
63 virtual void OnBlocked(int64_t existing_version); 62 virtual void OnBlocked(int64_t existing_version);
64 63
65 // IndexedDBFactory::Open 64 // IndexedDBFactory::Open
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 105
107 // IndexedDBCursor::Continue / Advance (when complete) 106 // IndexedDBCursor::Continue / Advance (when complete)
108 virtual void OnSuccess(); 107 virtual void OnSuccess();
109 108
110 // Checks to see if the associated dispatcher host is still connected. If 109 // Checks to see if the associated dispatcher host is still connected. If
111 // not this request can be dropped. 110 // not this request can be dropped.
112 virtual bool IsValid() const; 111 virtual bool IsValid() const;
113 112
114 void SetConnectionOpenStartTime(const base::TimeTicks& start_time); 113 void SetConnectionOpenStartTime(const base::TimeTicks& start_time);
115 114
115 void set_host_transaction_id(int64_t host_transaction_id) {
116 host_transaction_id_ = host_transaction_id;
117 }
118
116 protected: 119 protected:
117 virtual ~IndexedDBCallbacks(); 120 virtual ~IndexedDBCallbacks();
118 121
119 private: 122 private:
120 void RegisterBlobsAndSend(const std::vector<IndexedDBBlobInfo>& blob_info, 123 void RegisterBlobsAndSend(const std::vector<IndexedDBBlobInfo>& blob_info,
121 const base::Closure& callback); 124 const base::Closure& callback);
122 125
123 friend class base::RefCounted<IndexedDBCallbacks>; 126 friend class base::RefCounted<IndexedDBCallbacks>;
124 127
128 class IOThreadHelper;
129
125 // Originally from IndexedDBCallbacks: 130 // Originally from IndexedDBCallbacks:
126 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; 131 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_;
127 int32_t ipc_callbacks_id_; 132 int32_t ipc_callbacks_id_;
128 int32_t ipc_thread_id_; 133 int32_t ipc_thread_id_;
129 134
130 // IndexedDBCursor callbacks ------------------------ 135 // IndexedDBCursor callbacks ------------------------
131 int32_t ipc_cursor_id_; 136 int32_t ipc_cursor_id_;
132 137
133 // IndexedDBDatabase callbacks ------------------------ 138 // IndexedDBDatabase callbacks ------------------------
134 int64_t host_transaction_id_; 139 int64_t host_transaction_id_;
135 url::Origin origin_; 140 url::Origin origin_;
136 int32_t ipc_database_id_; 141 int32_t ipc_database_id_;
137 int32_t ipc_database_callbacks_id_;
138 142
139 // Used to assert that OnSuccess is only called if there was no data loss. 143 // Used to assert that OnSuccess is only called if there was no data loss.
140 blink::WebIDBDataLoss data_loss_; 144 blink::WebIDBDataLoss data_loss_;
141 145
142 // The "blocked" event should be sent at most once per request. 146 // The "blocked" event should be sent at most once per request.
143 bool sent_blocked_; 147 bool sent_blocked_;
144 base::TimeTicks connection_open_start_time_; 148 base::TimeTicks connection_open_start_time_;
149
150 IOThreadHelper* helper_;
cmumford 2016/10/11 18:30:54 nit: io_helper_? Just something to indicate what t
Reilly Grant (use Gerrit) 2016/10/11 23:46:13 Done.
151
145 DISALLOW_COPY_AND_ASSIGN(IndexedDBCallbacks); 152 DISALLOW_COPY_AND_ASSIGN(IndexedDBCallbacks);
146 }; 153 };
147 154
148 } // namespace content 155 } // namespace content
149 156
150 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ 157 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_callbacks.cc » ('j') | content/browser/indexed_db/indexed_db_callbacks.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698