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

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

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some (incomplete) work on struct traits. Created 4 years, 5 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 #include "content/browser/indexed_db/indexed_db_callbacks.h" 5 #include "content/browser/indexed_db/indexed_db_callbacks.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "content/browser/child_process_security_policy_impl.h" 14 #include "content/browser/child_process_security_policy_impl.h"
15 #include "content/browser/fileapi/fileapi_message_filter.h" 15 #include "content/browser/fileapi/fileapi_message_filter.h"
16 #include "content/browser/indexed_db/indexed_db_blob_info.h" 16 #include "content/browser/indexed_db/indexed_db_blob_info.h"
17 #include "content/browser/indexed_db/indexed_db_connection.h" 17 #include "content/browser/indexed_db/indexed_db_connection.h"
18 #include "content/browser/indexed_db/indexed_db_context_impl.h" 18 #include "content/browser/indexed_db/indexed_db_context_impl.h"
19 #include "content/browser/indexed_db/indexed_db_cursor.h" 19 #include "content/browser/indexed_db/indexed_db_cursor.h"
20 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" 20 #include "content/browser/indexed_db/indexed_db_database_callbacks.h"
21 #include "content/browser/indexed_db/indexed_db_database_error.h" 21 #include "content/browser/indexed_db/indexed_db_database_error.h"
22 #include "content/browser/indexed_db/indexed_db_metadata.h" 22 #include "content/browser/indexed_db/indexed_db_metadata.h"
23 #include "content/browser/indexed_db/indexed_db_return_value.h" 23 #include "content/browser/indexed_db/indexed_db_return_value.h"
24 #include "content/browser/indexed_db/indexed_db_tracing.h" 24 #include "content/browser/indexed_db/indexed_db_tracing.h"
25 #include "content/browser/indexed_db/indexed_db_value.h" 25 #include "content/browser/indexed_db/indexed_db_value.h"
26 #include "content/common/indexed_db/indexed_db_constants.h" 26 #include "content/common/indexed_db/indexed_db_constants.h"
27 #include "content/common/indexed_db/indexed_db_messages.h"
28 #include "storage/browser/blob/blob_storage_context.h" 27 #include "storage/browser/blob/blob_storage_context.h"
29 #include "storage/browser/blob/shareable_file_reference.h" 28 #include "storage/browser/blob/shareable_file_reference.h"
30 #include "storage/browser/quota/quota_manager.h" 29 #include "storage/browser/quota/quota_manager.h"
31 30
32 using storage::ShareableFileReference; 31 using storage::ShareableFileReference;
33 32
34 namespace content { 33 namespace content {
35 34
35 #if 0
36 namespace { 36 namespace {
37 const int32_t kNoCursor = -1; 37 const int32_t kNoCursor = -1;
38 const int32_t kNoDatabaseCallbacks = -1; 38 const int32_t kNoDatabaseCallbacks = -1;
39 const int64_t kNoTransaction = -1; 39 const int64_t kNoTransaction = -1;
40
40 } 41 }
41 42
42 IndexedDBCallbacks::IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, 43 IndexedDBCallbacks::IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host,
43 int32_t ipc_thread_id, 44 int32_t ipc_thread_id,
44 int32_t ipc_callbacks_id) 45 int32_t ipc_callbacks_id)
45 : dispatcher_host_(dispatcher_host), 46 : dispatcher_host_(dispatcher_host),
46 ipc_callbacks_id_(ipc_callbacks_id), 47 ipc_callbacks_id_(ipc_callbacks_id),
47 ipc_thread_id_(ipc_thread_id), 48 ipc_thread_id_(ipc_thread_id),
48 ipc_cursor_id_(kNoCursor), 49 ipc_cursor_id_(kNoCursor),
49 host_transaction_id_(kNoTransaction), 50 host_transaction_id_(kNoTransaction),
(...skipping 25 matching lines...) Expand all
75 : dispatcher_host_(dispatcher_host), 76 : dispatcher_host_(dispatcher_host),
76 ipc_callbacks_id_(ipc_callbacks_id), 77 ipc_callbacks_id_(ipc_callbacks_id),
77 ipc_thread_id_(ipc_thread_id), 78 ipc_thread_id_(ipc_thread_id),
78 ipc_cursor_id_(kNoCursor), 79 ipc_cursor_id_(kNoCursor),
79 host_transaction_id_(host_transaction_id), 80 host_transaction_id_(host_transaction_id),
80 origin_(origin), 81 origin_(origin),
81 ipc_database_id_(kNoDatabase), 82 ipc_database_id_(kNoDatabase),
82 ipc_database_callbacks_id_(ipc_database_callbacks_id), 83 ipc_database_callbacks_id_(ipc_database_callbacks_id),
83 data_loss_(blink::WebIDBDataLossNone), 84 data_loss_(blink::WebIDBDataLossNone),
84 sent_blocked_(false) {} 85 sent_blocked_(false) {}
86 #endif
85 87
86 IndexedDBCallbacks::~IndexedDBCallbacks() {} 88 IndexedDBCallbacks::~IndexedDBCallbacks() {}
87 89
88 void IndexedDBCallbacks::OnError(const IndexedDBDatabaseError& error) { 90 void IndexedDBCallbacks::OnError(const IndexedDBDatabaseError& error) {
91 #if 0
89 DCHECK(dispatcher_host_.get()); 92 DCHECK(dispatcher_host_.get());
90 93
91 dispatcher_host_->Send(new IndexedDBMsg_CallbacksError( 94 dispatcher_host_->Send(new IndexedDBMsg_CallbacksError(
92 ipc_thread_id_, ipc_callbacks_id_, error.code(), error.message())); 95 ipc_thread_id_, ipc_callbacks_id_, error.code(), error.message()));
93 dispatcher_host_ = NULL; 96 dispatcher_host_ = NULL;
94 97
95 if (!connection_open_start_time_.is_null()) { 98 if (!connection_open_start_time_.is_null()) {
96 UMA_HISTOGRAM_MEDIUM_TIMES( 99 UMA_HISTOGRAM_MEDIUM_TIMES(
97 "WebCore.IndexedDB.OpenTime.Error", 100 "WebCore.IndexedDB.OpenTime.Error",
98 base::TimeTicks::Now() - connection_open_start_time_); 101 base::TimeTicks::Now() - connection_open_start_time_);
99 connection_open_start_time_ = base::TimeTicks(); 102 connection_open_start_time_ = base::TimeTicks();
100 } 103 }
104 #endif
101 } 105 }
102 106
103 void IndexedDBCallbacks::OnSuccess(const std::vector<base::string16>& value) { 107 void IndexedDBCallbacks::OnSuccess(const std::vector<base::string16>& value) {
108 #if 0
104 DCHECK(dispatcher_host_.get()); 109 DCHECK(dispatcher_host_.get());
105 110
106 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 111 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
107 DCHECK_EQ(kNoTransaction, host_transaction_id_); 112 DCHECK_EQ(kNoTransaction, host_transaction_id_);
108 DCHECK_EQ(kNoDatabase, ipc_database_id_); 113 DCHECK_EQ(kNoDatabase, ipc_database_id_);
109 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_); 114 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
110 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 115 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
111 116
112 std::vector<base::string16> list; 117 std::vector<base::string16> list;
113 for (unsigned i = 0; i < value.size(); ++i) 118 for (unsigned i = 0; i < value.size(); ++i)
114 list.push_back(value[i]); 119 list.push_back(value[i]);
115 120
116 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessStringList( 121 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessStringList(
117 ipc_thread_id_, ipc_callbacks_id_, list)); 122 ipc_thread_id_, ipc_callbacks_id_, list));
118 dispatcher_host_ = NULL; 123 dispatcher_host_ = NULL;
124 #endif
119 } 125 }
120 126
121 void IndexedDBCallbacks::OnBlocked(int64_t existing_version) { 127 void IndexedDBCallbacks::OnBlocked(int64_t existing_version) {
128 #if 0
122 DCHECK(dispatcher_host_.get()); 129 DCHECK(dispatcher_host_.get());
123 130
124 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 131 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
125 // No transaction/db callbacks for DeleteDatabase. 132 // No transaction/db callbacks for DeleteDatabase.
126 DCHECK_EQ(kNoTransaction == host_transaction_id_, 133 DCHECK_EQ(kNoTransaction == host_transaction_id_,
127 kNoDatabaseCallbacks == ipc_database_callbacks_id_); 134 kNoDatabaseCallbacks == ipc_database_callbacks_id_);
128 DCHECK_EQ(kNoDatabase, ipc_database_id_); 135 DCHECK_EQ(kNoDatabase, ipc_database_id_);
129 136
130 if (sent_blocked_) 137 if (sent_blocked_)
131 return; 138 return;
132 139
133 sent_blocked_ = true; 140 sent_blocked_ = true;
134 dispatcher_host_->Send(new IndexedDBMsg_CallbacksIntBlocked( 141 dispatcher_host_->Send(new IndexedDBMsg_CallbacksIntBlocked(
135 ipc_thread_id_, ipc_callbacks_id_, existing_version)); 142 ipc_thread_id_, ipc_callbacks_id_, existing_version));
136 143
137 if (!connection_open_start_time_.is_null()) { 144 if (!connection_open_start_time_.is_null()) {
138 UMA_HISTOGRAM_MEDIUM_TIMES( 145 UMA_HISTOGRAM_MEDIUM_TIMES(
139 "WebCore.IndexedDB.OpenTime.Blocked", 146 "WebCore.IndexedDB.OpenTime.Blocked",
140 base::TimeTicks::Now() - connection_open_start_time_); 147 base::TimeTicks::Now() - connection_open_start_time_);
141 connection_open_start_time_ = base::TimeTicks(); 148 connection_open_start_time_ = base::TimeTicks();
142 } 149 }
150 #endif
143 } 151 }
144 152
145 void IndexedDBCallbacks::OnDataLoss(blink::WebIDBDataLoss data_loss, 153 void IndexedDBCallbacks::OnDataLoss(blink::WebIDBDataLoss data_loss,
146 std::string data_loss_message) { 154 std::string data_loss_message) {
155 #if 0
147 DCHECK_NE(blink::WebIDBDataLossNone, data_loss); 156 DCHECK_NE(blink::WebIDBDataLossNone, data_loss);
148 data_loss_ = data_loss; 157 data_loss_ = data_loss;
149 data_loss_message_ = data_loss_message; 158 data_loss_message_ = data_loss_message;
159 #endif
150 } 160 }
151 161
152 void IndexedDBCallbacks::OnUpgradeNeeded( 162 void IndexedDBCallbacks::OnUpgradeNeeded(
153 int64_t old_version, 163 int64_t old_version,
154 std::unique_ptr<IndexedDBConnection> connection, 164 std::unique_ptr<IndexedDBConnection> connection,
155 const IndexedDBDatabaseMetadata& metadata) { 165 const IndexedDBDatabaseMetadata& metadata) {
166 #if 0
156 DCHECK(dispatcher_host_.get()); 167 DCHECK(dispatcher_host_.get());
157 168
158 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 169 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
159 DCHECK_NE(kNoTransaction, host_transaction_id_); 170 DCHECK_NE(kNoTransaction, host_transaction_id_);
160 DCHECK_EQ(kNoDatabase, ipc_database_id_); 171 DCHECK_EQ(kNoDatabase, ipc_database_id_);
161 DCHECK_NE(kNoDatabaseCallbacks, ipc_database_callbacks_id_); 172 DCHECK_NE(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
162 173
163 dispatcher_host_->RegisterTransactionId(host_transaction_id_, origin_); 174 dispatcher_host_->RegisterTransactionId(host_transaction_id_, origin_);
164 int32_t ipc_database_id = 175 int32_t ipc_database_id =
165 dispatcher_host_->Add(connection.release(), ipc_thread_id_, origin_); 176 dispatcher_host_->Add(connection.release(), ipc_thread_id_, origin_);
(...skipping 10 matching lines...) Expand all
176 params.data_loss = data_loss_; 187 params.data_loss = data_loss_;
177 params.data_loss_message = data_loss_message_; 188 params.data_loss_message = data_loss_message_;
178 dispatcher_host_->Send(new IndexedDBMsg_CallbacksUpgradeNeeded(params)); 189 dispatcher_host_->Send(new IndexedDBMsg_CallbacksUpgradeNeeded(params));
179 190
180 if (!connection_open_start_time_.is_null()) { 191 if (!connection_open_start_time_.is_null()) {
181 UMA_HISTOGRAM_MEDIUM_TIMES( 192 UMA_HISTOGRAM_MEDIUM_TIMES(
182 "WebCore.IndexedDB.OpenTime.UpgradeNeeded", 193 "WebCore.IndexedDB.OpenTime.UpgradeNeeded",
183 base::TimeTicks::Now() - connection_open_start_time_); 194 base::TimeTicks::Now() - connection_open_start_time_);
184 connection_open_start_time_ = base::TimeTicks(); 195 connection_open_start_time_ = base::TimeTicks();
185 } 196 }
197 #endif
186 } 198 }
187 199
188 void IndexedDBCallbacks::OnSuccess( 200 void IndexedDBCallbacks::OnSuccess(
189 std::unique_ptr<IndexedDBConnection> connection, 201 std::unique_ptr<IndexedDBConnection> connection,
190 const IndexedDBDatabaseMetadata& metadata) { 202 const IndexedDBDatabaseMetadata& metadata) {
203 #if 0
191 DCHECK(dispatcher_host_.get()); 204 DCHECK(dispatcher_host_.get());
192 205
193 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 206 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
194 DCHECK_NE(kNoTransaction, host_transaction_id_); 207 DCHECK_NE(kNoTransaction, host_transaction_id_);
195 DCHECK_NE(ipc_database_id_ == kNoDatabase, !connection); 208 DCHECK_NE(ipc_database_id_ == kNoDatabase, !connection);
196 DCHECK_NE(kNoDatabaseCallbacks, ipc_database_callbacks_id_); 209 DCHECK_NE(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
197 210
198 scoped_refptr<IndexedDBCallbacks> self(this); 211 scoped_refptr<IndexedDBCallbacks> self(this);
199 212
200 int32_t ipc_object_id = kNoDatabase; 213 int32_t ipc_object_id = kNoDatabase;
(...skipping 10 matching lines...) Expand all
211 ipc_object_id, 224 ipc_object_id,
212 IndexedDBDispatcherHost::ConvertMetadata(metadata))); 225 IndexedDBDispatcherHost::ConvertMetadata(metadata)));
213 dispatcher_host_ = NULL; 226 dispatcher_host_ = NULL;
214 227
215 if (!connection_open_start_time_.is_null()) { 228 if (!connection_open_start_time_.is_null()) {
216 UMA_HISTOGRAM_MEDIUM_TIMES( 229 UMA_HISTOGRAM_MEDIUM_TIMES(
217 "WebCore.IndexedDB.OpenTime.Success", 230 "WebCore.IndexedDB.OpenTime.Success",
218 base::TimeTicks::Now() - connection_open_start_time_); 231 base::TimeTicks::Now() - connection_open_start_time_);
219 connection_open_start_time_ = base::TimeTicks(); 232 connection_open_start_time_ = base::TimeTicks();
220 } 233 }
234 #endif
221 } 235 }
222 236
223 static std::string CreateBlobData( 237 static std::string CreateBlobData(
224 const IndexedDBBlobInfo& blob_info, 238 const IndexedDBBlobInfo& blob_info,
225 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host, 239 /*scoped_refptr<IndexedDBDispatcherHost> dispatcher_host,*/
226 base::TaskRunner* task_runner) { 240 base::TaskRunner* task_runner) {
241 #if 0
227 if (!blob_info.uuid().empty()) { 242 if (!blob_info.uuid().empty()) {
228 // We're sending back a live blob, not a reference into our backing store. 243 // We're sending back a live blob, not a reference into our backing store.
229 return dispatcher_host->HoldBlobData(blob_info); 244 return dispatcher_host->HoldBlobData(blob_info);
230 } 245 }
231 scoped_refptr<ShareableFileReference> shareable_file = 246 scoped_refptr<ShareableFileReference> shareable_file =
232 ShareableFileReference::Get(blob_info.file_path()); 247 ShareableFileReference::Get(blob_info.file_path());
233 if (!shareable_file.get()) { 248 if (!shareable_file.get()) {
234 shareable_file = ShareableFileReference::GetOrCreate( 249 shareable_file = ShareableFileReference::GetOrCreate(
235 blob_info.file_path(), 250 blob_info.file_path(),
236 ShareableFileReference::DONT_DELETE_ON_FINAL_RELEASE, 251 ShareableFileReference::DONT_DELETE_ON_FINAL_RELEASE,
237 task_runner); 252 task_runner);
238 if (!blob_info.release_callback().is_null()) 253 if (!blob_info.release_callback().is_null())
239 shareable_file->AddFinalReleaseCallback(blob_info.release_callback()); 254 shareable_file->AddFinalReleaseCallback(blob_info.release_callback());
240 } 255 }
241 return dispatcher_host->HoldBlobData(blob_info); 256 return dispatcher_host->HoldBlobData(blob_info);
257 #else
258 return std::string();
259 #endif
242 } 260 }
243 261
262 #if 0
244 static bool CreateAllBlobs( 263 static bool CreateAllBlobs(
245 const std::vector<IndexedDBBlobInfo>& blob_info, 264 const std::vector<IndexedDBBlobInfo>& blob_info,
246 std::vector<IndexedDBMsg_BlobOrFileInfo>* blob_or_file_info, 265 std::vector<IndexedDBMsg_BlobOrFileInfo>* blob_or_file_info,
247 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host) { 266 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host) {
248 IDB_TRACE("IndexedDBCallbacks::CreateAllBlobs"); 267 IDB_TRACE("IndexedDBCallbacks::CreateAllBlobs");
249 DCHECK_EQ(blob_info.size(), blob_or_file_info->size()); 268 DCHECK_EQ(blob_info.size(), blob_or_file_info->size());
250 size_t i; 269 size_t i;
251 if (!dispatcher_host->blob_storage_context()) 270 if (!dispatcher_host->blob_storage_context())
252 return false; 271 return false;
253 for (i = 0; i < blob_info.size(); ++i) { 272 for (i = 0; i < blob_info.size(); ++i) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 info.last_modified = iter.last_modified().ToDoubleT(); 335 info.last_modified = iter.last_modified().ToDoubleT();
317 blob_or_file_info->push_back(info); 336 blob_or_file_info->push_back(info);
318 } else { 337 } else {
319 IndexedDBMsg_BlobOrFileInfo info; 338 IndexedDBMsg_BlobOrFileInfo info;
320 info.mime_type = iter.type(); 339 info.mime_type = iter.type();
321 info.size = iter.size(); 340 info.size = iter.size();
322 blob_or_file_info->push_back(info); 341 blob_or_file_info->push_back(info);
323 } 342 }
324 } 343 }
325 } 344 }
345 #endif
326 346
327 void IndexedDBCallbacks::RegisterBlobsAndSend( 347 void IndexedDBCallbacks::RegisterBlobsAndSend(
328 const std::vector<IndexedDBBlobInfo>& blob_info, 348 const std::vector<IndexedDBBlobInfo>& blob_info,
329 const base::Closure& callback) { 349 const base::Closure& callback) {
330 for (const auto& iter : blob_info) { 350 for (const auto& iter : blob_info) {
331 if (!iter.mark_used_callback().is_null()) 351 if (!iter.mark_used_callback().is_null())
332 iter.mark_used_callback().Run(); 352 iter.mark_used_callback().Run();
333 } 353 }
334 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); 354 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO));
335 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback); 355 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback);
336 } 356 }
337 357
338 void IndexedDBCallbacks::OnSuccess(scoped_refptr<IndexedDBCursor> cursor, 358 void IndexedDBCallbacks::OnSuccess(scoped_refptr<IndexedDBCursor> cursor,
339 const IndexedDBKey& key, 359 const IndexedDBKey& key,
340 const IndexedDBKey& primary_key, 360 const IndexedDBKey& primary_key,
341 IndexedDBValue* value) { 361 IndexedDBValue* value) {
362 #if 0
342 DCHECK(dispatcher_host_.get()); 363 DCHECK(dispatcher_host_.get());
343 364
344 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 365 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
345 DCHECK_EQ(kNoTransaction, host_transaction_id_); 366 DCHECK_EQ(kNoTransaction, host_transaction_id_);
346 DCHECK_EQ(kNoDatabase, ipc_database_id_); 367 DCHECK_EQ(kNoDatabase, ipc_database_id_);
347 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_); 368 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
348 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 369 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
349 370
350 int32_t ipc_object_id = dispatcher_host_->Add(cursor.get()); 371 int32_t ipc_object_id = dispatcher_host_->Add(cursor.get());
351 std::unique_ptr<IndexedDBMsg_CallbacksSuccessIDBCursor_Params> params( 372 std::unique_ptr<IndexedDBMsg_CallbacksSuccessIDBCursor_Params> params(
(...skipping 14 matching lines...) Expand all
366 FillInBlobData(value->blob_info, &p->value.blob_or_file_info); 387 FillInBlobData(value->blob_info, &p->value.blob_or_file_info);
367 RegisterBlobsAndSend( 388 RegisterBlobsAndSend(
368 value->blob_info, 389 value->blob_info,
369 base::Bind( 390 base::Bind(
370 CreateBlobsAndSend<IndexedDBMsg_CallbacksSuccessIDBCursor_Params, 391 CreateBlobsAndSend<IndexedDBMsg_CallbacksSuccessIDBCursor_Params,
371 IndexedDBMsg_CallbacksSuccessIDBCursor>, 392 IndexedDBMsg_CallbacksSuccessIDBCursor>,
372 base::Owned(params.release()), dispatcher_host_, value->blob_info, 393 base::Owned(params.release()), dispatcher_host_, value->blob_info,
373 base::Unretained(&p->value.blob_or_file_info))); 394 base::Unretained(&p->value.blob_or_file_info)));
374 } 395 }
375 dispatcher_host_ = NULL; 396 dispatcher_host_ = NULL;
397 #endif
376 } 398 }
377 399
378 void IndexedDBCallbacks::OnSuccess(const IndexedDBKey& key, 400 void IndexedDBCallbacks::OnSuccess(const IndexedDBKey& key,
379 const IndexedDBKey& primary_key, 401 const IndexedDBKey& primary_key,
380 IndexedDBValue* value) { 402 IndexedDBValue* value) {
403 #if 0
381 DCHECK(dispatcher_host_.get()); 404 DCHECK(dispatcher_host_.get());
382 405
383 DCHECK_NE(kNoCursor, ipc_cursor_id_); 406 DCHECK_NE(kNoCursor, ipc_cursor_id_);
384 DCHECK_EQ(kNoTransaction, host_transaction_id_); 407 DCHECK_EQ(kNoTransaction, host_transaction_id_);
385 DCHECK_EQ(kNoDatabase, ipc_database_id_); 408 DCHECK_EQ(kNoDatabase, ipc_database_id_);
386 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_); 409 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
387 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 410 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
388 411
389 IndexedDBCursor* idb_cursor = 412 IndexedDBCursor* idb_cursor =
390 dispatcher_host_->GetCursorFromId(ipc_cursor_id_); 413 dispatcher_host_->GetCursorFromId(ipc_cursor_id_);
(...skipping 22 matching lines...) Expand all
413 RegisterBlobsAndSend( 436 RegisterBlobsAndSend(
414 value->blob_info, 437 value->blob_info,
415 base::Bind(CreateBlobsAndSend< 438 base::Bind(CreateBlobsAndSend<
416 IndexedDBMsg_CallbacksSuccessCursorContinue_Params, 439 IndexedDBMsg_CallbacksSuccessCursorContinue_Params,
417 IndexedDBMsg_CallbacksSuccessCursorContinue>, 440 IndexedDBMsg_CallbacksSuccessCursorContinue>,
418 base::Owned(params.release()), dispatcher_host_, 441 base::Owned(params.release()), dispatcher_host_,
419 value->blob_info, 442 value->blob_info,
420 base::Unretained(&p->value.blob_or_file_info))); 443 base::Unretained(&p->value.blob_or_file_info)));
421 } 444 }
422 dispatcher_host_ = NULL; 445 dispatcher_host_ = NULL;
446 #endif
423 } 447 }
424 448
425 void IndexedDBCallbacks::OnSuccessWithPrefetch( 449 void IndexedDBCallbacks::OnSuccessWithPrefetch(
426 const std::vector<IndexedDBKey>& keys, 450 const std::vector<IndexedDBKey>& keys,
427 const std::vector<IndexedDBKey>& primary_keys, 451 const std::vector<IndexedDBKey>& primary_keys,
428 std::vector<IndexedDBValue>* values) { 452 std::vector<IndexedDBValue>* values) {
453 #if 0
429 DCHECK_EQ(keys.size(), primary_keys.size()); 454 DCHECK_EQ(keys.size(), primary_keys.size());
430 DCHECK_EQ(keys.size(), values->size()); 455 DCHECK_EQ(keys.size(), values->size());
431 456
432 DCHECK(dispatcher_host_.get()); 457 DCHECK(dispatcher_host_.get());
433 458
434 DCHECK_NE(kNoCursor, ipc_cursor_id_); 459 DCHECK_NE(kNoCursor, ipc_cursor_id_);
435 DCHECK_EQ(kNoTransaction, host_transaction_id_); 460 DCHECK_EQ(kNoTransaction, host_transaction_id_);
436 DCHECK_EQ(kNoDatabase, ipc_database_id_); 461 DCHECK_EQ(kNoDatabase, ipc_database_id_);
437 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_); 462 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
438 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 463 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 FROM_HERE, 498 FROM_HERE,
474 base::Bind(BlobLookupForCursorPrefetch, 499 base::Bind(BlobLookupForCursorPrefetch,
475 base::Owned(params.release()), 500 base::Owned(params.release()),
476 dispatcher_host_, 501 dispatcher_host_,
477 *values)); 502 *values));
478 } else { 503 } else {
479 dispatcher_host_->Send( 504 dispatcher_host_->Send(
480 new IndexedDBMsg_CallbacksSuccessCursorPrefetch(*params.get())); 505 new IndexedDBMsg_CallbacksSuccessCursorPrefetch(*params.get()));
481 } 506 }
482 dispatcher_host_ = NULL; 507 dispatcher_host_ = NULL;
508 #endif
483 } 509 }
484 510
485 void IndexedDBCallbacks::OnSuccess(IndexedDBReturnValue* value) { 511 void IndexedDBCallbacks::OnSuccess(IndexedDBReturnValue* value) {
512 #if 0
486 DCHECK(dispatcher_host_.get()); 513 DCHECK(dispatcher_host_.get());
487 514
488 if (value && value->primary_key.IsValid()) { 515 if (value && value->primary_key.IsValid()) {
489 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 516 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
490 } else { 517 } else {
491 DCHECK(kNoCursor == ipc_cursor_id_ || value == NULL); 518 DCHECK(kNoCursor == ipc_cursor_id_ || value == NULL);
492 } 519 }
493 DCHECK_EQ(kNoTransaction, host_transaction_id_); 520 DCHECK_EQ(kNoTransaction, host_transaction_id_);
494 DCHECK_EQ(kNoDatabase, ipc_database_id_); 521 DCHECK_EQ(kNoDatabase, ipc_database_id_);
495 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_); 522 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
(...skipping 16 matching lines...) Expand all
512 FillInBlobData(value->blob_info, &p->value.blob_or_file_info); 539 FillInBlobData(value->blob_info, &p->value.blob_or_file_info);
513 RegisterBlobsAndSend( 540 RegisterBlobsAndSend(
514 value->blob_info, 541 value->blob_info,
515 base::Bind(CreateBlobsAndSend<IndexedDBMsg_CallbacksSuccessValue_Params, 542 base::Bind(CreateBlobsAndSend<IndexedDBMsg_CallbacksSuccessValue_Params,
516 IndexedDBMsg_CallbacksSuccessValue>, 543 IndexedDBMsg_CallbacksSuccessValue>,
517 base::Owned(params.release()), dispatcher_host_, 544 base::Owned(params.release()), dispatcher_host_,
518 value->blob_info, 545 value->blob_info,
519 base::Unretained(&p->value.blob_or_file_info))); 546 base::Unretained(&p->value.blob_or_file_info)));
520 } 547 }
521 dispatcher_host_ = NULL; 548 dispatcher_host_ = NULL;
549 #endif
522 } 550 }
523 551
524 void IndexedDBCallbacks::OnSuccessArray( 552 void IndexedDBCallbacks::OnSuccessArray(
525 std::vector<IndexedDBReturnValue>* values, 553 std::vector<IndexedDBReturnValue>* values,
526 const IndexedDBKeyPath& key_path) { 554 const IndexedDBKeyPath& key_path) {
555 #if 0
527 DCHECK(dispatcher_host_.get()); 556 DCHECK(dispatcher_host_.get());
528 557
529 DCHECK_EQ(kNoTransaction, host_transaction_id_); 558 DCHECK_EQ(kNoTransaction, host_transaction_id_);
530 DCHECK_EQ(kNoDatabase, ipc_database_id_); 559 DCHECK_EQ(kNoDatabase, ipc_database_id_);
531 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_); 560 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
532 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 561 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
533 562
534 std::unique_ptr<IndexedDBMsg_CallbacksSuccessArray_Params> params( 563 std::unique_ptr<IndexedDBMsg_CallbacksSuccessArray_Params> params(
535 new IndexedDBMsg_CallbacksSuccessArray_Params()); 564 new IndexedDBMsg_CallbacksSuccessArray_Params());
536 params->ipc_thread_id = ipc_thread_id_; 565 params->ipc_thread_id = ipc_thread_id_;
(...skipping 20 matching lines...) Expand all
557 if (found_blob_info) { 586 if (found_blob_info) {
558 BrowserThread::PostTask( 587 BrowserThread::PostTask(
559 BrowserThread::IO, FROM_HERE, 588 BrowserThread::IO, FROM_HERE,
560 base::Bind(BlobLookupForGetAll, base::Owned(params.release()), 589 base::Bind(BlobLookupForGetAll, base::Owned(params.release()),
561 dispatcher_host_, *values)); 590 dispatcher_host_, *values));
562 } else { 591 } else {
563 dispatcher_host_->Send( 592 dispatcher_host_->Send(
564 new IndexedDBMsg_CallbacksSuccessArray(*params.get())); 593 new IndexedDBMsg_CallbacksSuccessArray(*params.get()));
565 } 594 }
566 dispatcher_host_ = NULL; 595 dispatcher_host_ = NULL;
596 #endif
567 } 597 }
568 598
569 void IndexedDBCallbacks::OnSuccess(const IndexedDBKey& value) { 599 void IndexedDBCallbacks::OnSuccess(const IndexedDBKey& value) {
600 #if 0
570 DCHECK(dispatcher_host_.get()); 601 DCHECK(dispatcher_host_.get());
571 602
572 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 603 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
573 DCHECK_EQ(kNoTransaction, host_transaction_id_); 604 DCHECK_EQ(kNoTransaction, host_transaction_id_);
574 DCHECK_EQ(kNoDatabase, ipc_database_id_); 605 DCHECK_EQ(kNoDatabase, ipc_database_id_);
575 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_); 606 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
576 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 607 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
577 608
578 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessIndexedDBKey( 609 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessIndexedDBKey(
579 ipc_thread_id_, ipc_callbacks_id_, value)); 610 ipc_thread_id_, ipc_callbacks_id_, value));
580 dispatcher_host_ = NULL; 611 dispatcher_host_ = NULL;
612 #endif
581 } 613 }
582 614
583 void IndexedDBCallbacks::OnSuccess(int64_t value) { 615 void IndexedDBCallbacks::OnSuccess(int64_t value) {
616 #if 0
584 DCHECK(dispatcher_host_.get()); 617 DCHECK(dispatcher_host_.get());
585 618
586 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 619 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
587 DCHECK_EQ(kNoTransaction, host_transaction_id_); 620 DCHECK_EQ(kNoTransaction, host_transaction_id_);
588 DCHECK_EQ(kNoDatabase, ipc_database_id_); 621 DCHECK_EQ(kNoDatabase, ipc_database_id_);
589 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_); 622 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
590 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 623 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
591 624
592 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessInteger( 625 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessInteger(
593 ipc_thread_id_, ipc_callbacks_id_, value)); 626 ipc_thread_id_, ipc_callbacks_id_, value));
594 dispatcher_host_ = NULL; 627 dispatcher_host_ = NULL;
628 #endif
595 } 629 }
596 630
597 void IndexedDBCallbacks::OnSuccess() { 631 void IndexedDBCallbacks::OnSuccess() {
632 #if 0
598 DCHECK(dispatcher_host_.get()); 633 DCHECK(dispatcher_host_.get());
599 634
600 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 635 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
601 DCHECK_EQ(kNoTransaction, host_transaction_id_); 636 DCHECK_EQ(kNoTransaction, host_transaction_id_);
602 DCHECK_EQ(kNoDatabase, ipc_database_id_); 637 DCHECK_EQ(kNoDatabase, ipc_database_id_);
603 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_); 638 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
604 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 639 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
605 640
606 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessUndefined( 641 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessUndefined(
607 ipc_thread_id_, ipc_callbacks_id_)); 642 ipc_thread_id_, ipc_callbacks_id_));
608 dispatcher_host_ = NULL; 643 dispatcher_host_ = NULL;
644 #endif
609 } 645 }
610 646
611 void IndexedDBCallbacks::SetConnectionOpenStartTime( 647 void IndexedDBCallbacks::SetConnectionOpenStartTime(
612 const base::TimeTicks& start_time) { 648 const base::TimeTicks& start_time) {
613 connection_open_start_time_ = start_time; 649 connection_open_start_time_ = start_time;
614 } 650 }
615 651
616 } // namespace content 652 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698