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

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

Issue 2439863002: Prevent cross-thread refcounting for thread-unsafe IndexedDBCallbacks. (Closed)
Patch Set: 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 #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 #include <utility> 10 #include <utility>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 IndexedDBDispatcherHost* dispatcher_host, 93 IndexedDBDispatcherHost* dispatcher_host,
94 const url::Origin& origin, 94 const url::Origin& origin,
95 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) 95 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info)
96 : dispatcher_host_(dispatcher_host), 96 : dispatcher_host_(dispatcher_host),
97 ipc_cursor_id_(kNoCursor), 97 ipc_cursor_id_(kNoCursor),
98 host_transaction_id_(kNoTransaction), 98 host_transaction_id_(kNoTransaction),
99 origin_(origin), 99 origin_(origin),
100 ipc_database_id_(kNoDatabase), 100 ipc_database_id_(kNoDatabase),
101 data_loss_(blink::WebIDBDataLossNone), 101 data_loss_(blink::WebIDBDataLossNone),
102 sent_blocked_(false), 102 sent_blocked_(false),
103 io_helper_(new IOThreadHelper(std::move(callbacks_info))) {} 103 io_helper_(new IOThreadHelper(std::move(callbacks_info))) {
104 DCHECK_CURRENTLY_ON(BrowserThread::IO);
105 thread_checker_.DetachFromThread();
106 }
104 107
105 IndexedDBCallbacks::~IndexedDBCallbacks() {} 108 IndexedDBCallbacks::~IndexedDBCallbacks() {
109 DCHECK(thread_checker_.CalledOnValidThread());
110 }
106 111
107 void IndexedDBCallbacks::OnError(const IndexedDBDatabaseError& error) { 112 void IndexedDBCallbacks::OnError(const IndexedDBDatabaseError& error) {
108 DCHECK(dispatcher_host_.get()); 113 DCHECK(thread_checker_.CalledOnValidThread());
114 DCHECK(dispatcher_host_);
109 115
110 if (io_helper_) { 116 if (io_helper_) {
111 BrowserThread::PostTask( 117 BrowserThread::PostTask(
112 BrowserThread::IO, FROM_HERE, 118 BrowserThread::IO, FROM_HERE,
113 base::Bind(&IOThreadHelper::SendError, 119 base::Bind(&IOThreadHelper::SendError,
114 base::Unretained(io_helper_.get()), error)); 120 base::Unretained(io_helper_.get()), error));
115 } else { 121 } else {
116 dispatcher_host_->Send(new IndexedDBMsg_CallbacksError( 122 dispatcher_host_->Send(new IndexedDBMsg_CallbacksError(
117 ipc_thread_id_, ipc_callbacks_id_, error.code(), error.message())); 123 ipc_thread_id_, ipc_callbacks_id_, error.code(), error.message()));
118 } 124 }
119 dispatcher_host_ = nullptr; 125 dispatcher_host_ = nullptr;
120 126
121 if (!connection_open_start_time_.is_null()) { 127 if (!connection_open_start_time_.is_null()) {
122 UMA_HISTOGRAM_MEDIUM_TIMES( 128 UMA_HISTOGRAM_MEDIUM_TIMES(
123 "WebCore.IndexedDB.OpenTime.Error", 129 "WebCore.IndexedDB.OpenTime.Error",
124 base::TimeTicks::Now() - connection_open_start_time_); 130 base::TimeTicks::Now() - connection_open_start_time_);
125 connection_open_start_time_ = base::TimeTicks(); 131 connection_open_start_time_ = base::TimeTicks();
126 } 132 }
127 } 133 }
128 134
129 void IndexedDBCallbacks::OnSuccess(const std::vector<base::string16>& value) { 135 void IndexedDBCallbacks::OnSuccess(const std::vector<base::string16>& value) {
130 DCHECK(dispatcher_host_.get()); 136 DCHECK(thread_checker_.CalledOnValidThread());
137 DCHECK(dispatcher_host_);
131 DCHECK(io_helper_); 138 DCHECK(io_helper_);
132 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 139 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
133 DCHECK_EQ(kNoTransaction, host_transaction_id_); 140 DCHECK_EQ(kNoTransaction, host_transaction_id_);
134 DCHECK_EQ(kNoDatabase, ipc_database_id_); 141 DCHECK_EQ(kNoDatabase, ipc_database_id_);
135 142
136 BrowserThread::PostTask( 143 BrowserThread::PostTask(
137 BrowserThread::IO, FROM_HERE, 144 BrowserThread::IO, FROM_HERE,
138 base::Bind(&IOThreadHelper::SendSuccessStringList, 145 base::Bind(&IOThreadHelper::SendSuccessStringList,
139 base::Unretained(io_helper_.get()), value)); 146 base::Unretained(io_helper_.get()), value));
140 dispatcher_host_ = nullptr; 147 dispatcher_host_ = nullptr;
141 } 148 }
142 149
143 void IndexedDBCallbacks::OnBlocked(int64_t existing_version) { 150 void IndexedDBCallbacks::OnBlocked(int64_t existing_version) {
144 DCHECK(dispatcher_host_.get()); 151 DCHECK(thread_checker_.CalledOnValidThread());
152 DCHECK(dispatcher_host_);
145 DCHECK(io_helper_); 153 DCHECK(io_helper_);
146 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 154 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
147 155
148 if (sent_blocked_) 156 if (sent_blocked_)
149 return; 157 return;
150 158
151 sent_blocked_ = true; 159 sent_blocked_ = true;
152 160
153 BrowserThread::PostTask( 161 BrowserThread::PostTask(
154 BrowserThread::IO, FROM_HERE, 162 BrowserThread::IO, FROM_HERE,
155 base::Bind(&IOThreadHelper::SendBlocked, 163 base::Bind(&IOThreadHelper::SendBlocked,
156 base::Unretained(io_helper_.get()), existing_version)); 164 base::Unretained(io_helper_.get()), existing_version));
157 165
158 if (!connection_open_start_time_.is_null()) { 166 if (!connection_open_start_time_.is_null()) {
159 UMA_HISTOGRAM_MEDIUM_TIMES( 167 UMA_HISTOGRAM_MEDIUM_TIMES(
160 "WebCore.IndexedDB.OpenTime.Blocked", 168 "WebCore.IndexedDB.OpenTime.Blocked",
161 base::TimeTicks::Now() - connection_open_start_time_); 169 base::TimeTicks::Now() - connection_open_start_time_);
162 connection_open_start_time_ = base::TimeTicks(); 170 connection_open_start_time_ = base::TimeTicks();
163 } 171 }
164 } 172 }
165 173
166 void IndexedDBCallbacks::OnUpgradeNeeded( 174 void IndexedDBCallbacks::OnUpgradeNeeded(
167 int64_t old_version, 175 int64_t old_version,
168 std::unique_ptr<IndexedDBConnection> connection, 176 std::unique_ptr<IndexedDBConnection> connection,
169 const IndexedDBDatabaseMetadata& metadata, 177 const IndexedDBDatabaseMetadata& metadata,
170 const IndexedDBDataLossInfo& data_loss_info) { 178 const IndexedDBDataLossInfo& data_loss_info) {
171 DCHECK(dispatcher_host_.get()); 179 DCHECK(thread_checker_.CalledOnValidThread());
180 DCHECK(dispatcher_host_);
172 DCHECK(io_helper_); 181 DCHECK(io_helper_);
173 DCHECK_NE(kNoTransaction, host_transaction_id_); 182 DCHECK_NE(kNoTransaction, host_transaction_id_);
174 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 183 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
175 DCHECK_EQ(kNoDatabase, ipc_database_id_); 184 DCHECK_EQ(kNoDatabase, ipc_database_id_);
176 185
177 data_loss_ = data_loss_info.status; 186 data_loss_ = data_loss_info.status;
178 dispatcher_host_->RegisterTransactionId(host_transaction_id_, origin_); 187 dispatcher_host_->RegisterTransactionId(host_transaction_id_, origin_);
179 int32_t ipc_database_id = 188 int32_t ipc_database_id =
180 dispatcher_host_->Add(connection.release(), origin_); 189 dispatcher_host_->Add(connection.release(), origin_);
181 if (ipc_database_id < 0) 190 if (ipc_database_id < 0)
(...skipping 12 matching lines...) Expand all
194 UMA_HISTOGRAM_MEDIUM_TIMES( 203 UMA_HISTOGRAM_MEDIUM_TIMES(
195 "WebCore.IndexedDB.OpenTime.UpgradeNeeded", 204 "WebCore.IndexedDB.OpenTime.UpgradeNeeded",
196 base::TimeTicks::Now() - connection_open_start_time_); 205 base::TimeTicks::Now() - connection_open_start_time_);
197 connection_open_start_time_ = base::TimeTicks(); 206 connection_open_start_time_ = base::TimeTicks();
198 } 207 }
199 } 208 }
200 209
201 void IndexedDBCallbacks::OnSuccess( 210 void IndexedDBCallbacks::OnSuccess(
202 std::unique_ptr<IndexedDBConnection> connection, 211 std::unique_ptr<IndexedDBConnection> connection,
203 const IndexedDBDatabaseMetadata& metadata) { 212 const IndexedDBDatabaseMetadata& metadata) {
204 DCHECK(dispatcher_host_.get()); 213 DCHECK(thread_checker_.CalledOnValidThread());
214 DCHECK(dispatcher_host_);
205 DCHECK(io_helper_); 215 DCHECK(io_helper_);
206 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 216 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
207 DCHECK_NE(kNoTransaction, host_transaction_id_); 217 DCHECK_NE(kNoTransaction, host_transaction_id_);
208 DCHECK_NE(ipc_database_id_ == kNoDatabase, !connection); 218 DCHECK_NE(ipc_database_id_ == kNoDatabase, !connection);
209 219
210 scoped_refptr<IndexedDBCallbacks> self(this); 220 scoped_refptr<IndexedDBCallbacks> self(this);
211 221
212 int32_t ipc_object_id = kNoDatabase; 222 int32_t ipc_object_id = kNoDatabase;
213 // Only register if the connection was not previously sent in OnUpgradeNeeded. 223 // Only register if the connection was not previously sent in OnUpgradeNeeded.
214 if (ipc_database_id_ == kNoDatabase) { 224 if (ipc_database_id_ == kNoDatabase) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 iter.mark_used_callback().Run(); 351 iter.mark_used_callback().Run();
342 } 352 }
343 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); 353 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO));
344 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback); 354 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback);
345 } 355 }
346 356
347 void IndexedDBCallbacks::OnSuccess(scoped_refptr<IndexedDBCursor> cursor, 357 void IndexedDBCallbacks::OnSuccess(scoped_refptr<IndexedDBCursor> cursor,
348 const IndexedDBKey& key, 358 const IndexedDBKey& key,
349 const IndexedDBKey& primary_key, 359 const IndexedDBKey& primary_key,
350 IndexedDBValue* value) { 360 IndexedDBValue* value) {
361 DCHECK(thread_checker_.CalledOnValidThread());
362 DCHECK(dispatcher_host_);
351 DCHECK(!io_helper_); 363 DCHECK(!io_helper_);
352 DCHECK(dispatcher_host_.get());
353 364
354 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 365 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
355 DCHECK_EQ(kNoTransaction, host_transaction_id_); 366 DCHECK_EQ(kNoTransaction, host_transaction_id_);
356 DCHECK_EQ(kNoDatabase, ipc_database_id_); 367 DCHECK_EQ(kNoDatabase, ipc_database_id_);
357 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 368 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
358 369
359 int32_t ipc_object_id = dispatcher_host_->Add(cursor.get()); 370 int32_t ipc_object_id = dispatcher_host_->Add(cursor.get());
360 std::unique_ptr<IndexedDBMsg_CallbacksSuccessIDBCursor_Params> params( 371 std::unique_ptr<IndexedDBMsg_CallbacksSuccessIDBCursor_Params> params(
361 new IndexedDBMsg_CallbacksSuccessIDBCursor_Params()); 372 new IndexedDBMsg_CallbacksSuccessIDBCursor_Params());
362 params->ipc_thread_id = ipc_thread_id_; 373 params->ipc_thread_id = ipc_thread_id_;
(...skipping 17 matching lines...) Expand all
380 IndexedDBMsg_CallbacksSuccessIDBCursor>, 391 IndexedDBMsg_CallbacksSuccessIDBCursor>,
381 base::Owned(params.release()), dispatcher_host_, value->blob_info, 392 base::Owned(params.release()), dispatcher_host_, value->blob_info,
382 base::Unretained(&p->value.blob_or_file_info))); 393 base::Unretained(&p->value.blob_or_file_info)));
383 } 394 }
384 dispatcher_host_ = nullptr; 395 dispatcher_host_ = nullptr;
385 } 396 }
386 397
387 void IndexedDBCallbacks::OnSuccess(const IndexedDBKey& key, 398 void IndexedDBCallbacks::OnSuccess(const IndexedDBKey& key,
388 const IndexedDBKey& primary_key, 399 const IndexedDBKey& primary_key,
389 IndexedDBValue* value) { 400 IndexedDBValue* value) {
401 DCHECK(thread_checker_.CalledOnValidThread());
402 DCHECK(dispatcher_host_);
390 DCHECK(!io_helper_); 403 DCHECK(!io_helper_);
391 DCHECK(dispatcher_host_.get());
392 404
393 DCHECK_NE(kNoCursor, ipc_cursor_id_); 405 DCHECK_NE(kNoCursor, ipc_cursor_id_);
394 DCHECK_EQ(kNoTransaction, host_transaction_id_); 406 DCHECK_EQ(kNoTransaction, host_transaction_id_);
395 DCHECK_EQ(kNoDatabase, ipc_database_id_); 407 DCHECK_EQ(kNoDatabase, ipc_database_id_);
396 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 408 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
397 409
398 IndexedDBCursor* idb_cursor = 410 IndexedDBCursor* idb_cursor =
399 dispatcher_host_->GetCursorFromId(ipc_cursor_id_); 411 dispatcher_host_->GetCursorFromId(ipc_cursor_id_);
400 412
401 DCHECK(idb_cursor); 413 DCHECK(idb_cursor);
(...skipping 26 matching lines...) Expand all
428 value->blob_info, 440 value->blob_info,
429 base::Unretained(&p->value.blob_or_file_info))); 441 base::Unretained(&p->value.blob_or_file_info)));
430 } 442 }
431 dispatcher_host_ = nullptr; 443 dispatcher_host_ = nullptr;
432 } 444 }
433 445
434 void IndexedDBCallbacks::OnSuccessWithPrefetch( 446 void IndexedDBCallbacks::OnSuccessWithPrefetch(
435 const std::vector<IndexedDBKey>& keys, 447 const std::vector<IndexedDBKey>& keys,
436 const std::vector<IndexedDBKey>& primary_keys, 448 const std::vector<IndexedDBKey>& primary_keys,
437 std::vector<IndexedDBValue>* values) { 449 std::vector<IndexedDBValue>* values) {
450 DCHECK(thread_checker_.CalledOnValidThread());
451 DCHECK(dispatcher_host_);
438 DCHECK(!io_helper_); 452 DCHECK(!io_helper_);
439 DCHECK_EQ(keys.size(), primary_keys.size()); 453 DCHECK_EQ(keys.size(), primary_keys.size());
440 DCHECK_EQ(keys.size(), values->size()); 454 DCHECK_EQ(keys.size(), values->size());
441 455
442 DCHECK(dispatcher_host_.get());
443
444 DCHECK_NE(kNoCursor, ipc_cursor_id_); 456 DCHECK_NE(kNoCursor, ipc_cursor_id_);
445 DCHECK_EQ(kNoTransaction, host_transaction_id_); 457 DCHECK_EQ(kNoTransaction, host_transaction_id_);
446 DCHECK_EQ(kNoDatabase, ipc_database_id_); 458 DCHECK_EQ(kNoDatabase, ipc_database_id_);
447 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 459 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
448 460
449 std::vector<IndexedDBKey> msg_keys; 461 std::vector<IndexedDBKey> msg_keys;
450 std::vector<IndexedDBKey> msg_primary_keys; 462 std::vector<IndexedDBKey> msg_primary_keys;
451 463
452 for (size_t i = 0; i < keys.size(); ++i) { 464 for (size_t i = 0; i < keys.size(); ++i) {
453 msg_keys.push_back(keys[i]); 465 msg_keys.push_back(keys[i]);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 dispatcher_host_, 497 dispatcher_host_,
486 *values)); 498 *values));
487 } else { 499 } else {
488 dispatcher_host_->Send( 500 dispatcher_host_->Send(
489 new IndexedDBMsg_CallbacksSuccessCursorPrefetch(*params.get())); 501 new IndexedDBMsg_CallbacksSuccessCursorPrefetch(*params.get()));
490 } 502 }
491 dispatcher_host_ = nullptr; 503 dispatcher_host_ = nullptr;
492 } 504 }
493 505
494 void IndexedDBCallbacks::OnSuccess(IndexedDBReturnValue* value) { 506 void IndexedDBCallbacks::OnSuccess(IndexedDBReturnValue* value) {
507 DCHECK(thread_checker_.CalledOnValidThread());
508 DCHECK(dispatcher_host_);
495 DCHECK(!io_helper_); 509 DCHECK(!io_helper_);
496 DCHECK(dispatcher_host_.get());
497 510
498 if (value && value->primary_key.IsValid()) { 511 if (value && value->primary_key.IsValid()) {
499 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 512 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
500 } else { 513 } else {
501 DCHECK(kNoCursor == ipc_cursor_id_ || value == NULL); 514 DCHECK(kNoCursor == ipc_cursor_id_ || value == NULL);
502 } 515 }
503 DCHECK_EQ(kNoTransaction, host_transaction_id_); 516 DCHECK_EQ(kNoTransaction, host_transaction_id_);
504 DCHECK_EQ(kNoDatabase, ipc_database_id_); 517 DCHECK_EQ(kNoDatabase, ipc_database_id_);
505 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 518 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
506 519
(...skipping 19 matching lines...) Expand all
526 base::Owned(params.release()), dispatcher_host_, 539 base::Owned(params.release()), dispatcher_host_,
527 value->blob_info, 540 value->blob_info,
528 base::Unretained(&p->value.blob_or_file_info))); 541 base::Unretained(&p->value.blob_or_file_info)));
529 } 542 }
530 dispatcher_host_ = nullptr; 543 dispatcher_host_ = nullptr;
531 } 544 }
532 545
533 void IndexedDBCallbacks::OnSuccessArray( 546 void IndexedDBCallbacks::OnSuccessArray(
534 std::vector<IndexedDBReturnValue>* values, 547 std::vector<IndexedDBReturnValue>* values,
535 const IndexedDBKeyPath& key_path) { 548 const IndexedDBKeyPath& key_path) {
549 DCHECK(thread_checker_.CalledOnValidThread());
550 DCHECK(dispatcher_host_);
536 DCHECK(!io_helper_); 551 DCHECK(!io_helper_);
537 DCHECK(dispatcher_host_.get());
538 552
539 DCHECK_EQ(kNoTransaction, host_transaction_id_); 553 DCHECK_EQ(kNoTransaction, host_transaction_id_);
540 DCHECK_EQ(kNoDatabase, ipc_database_id_); 554 DCHECK_EQ(kNoDatabase, ipc_database_id_);
541 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 555 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
542 556
543 std::unique_ptr<IndexedDBMsg_CallbacksSuccessArray_Params> params( 557 std::unique_ptr<IndexedDBMsg_CallbacksSuccessArray_Params> params(
544 new IndexedDBMsg_CallbacksSuccessArray_Params()); 558 new IndexedDBMsg_CallbacksSuccessArray_Params());
545 params->ipc_thread_id = ipc_thread_id_; 559 params->ipc_thread_id = ipc_thread_id_;
546 params->ipc_callbacks_id = ipc_callbacks_id_; 560 params->ipc_callbacks_id = ipc_callbacks_id_;
547 params->values.resize(values->size()); 561 params->values.resize(values->size());
(...skipping 21 matching lines...) Expand all
569 base::Bind(BlobLookupForGetAll, base::Owned(params.release()), 583 base::Bind(BlobLookupForGetAll, base::Owned(params.release()),
570 dispatcher_host_, *values)); 584 dispatcher_host_, *values));
571 } else { 585 } else {
572 dispatcher_host_->Send( 586 dispatcher_host_->Send(
573 new IndexedDBMsg_CallbacksSuccessArray(*params.get())); 587 new IndexedDBMsg_CallbacksSuccessArray(*params.get()));
574 } 588 }
575 dispatcher_host_ = nullptr; 589 dispatcher_host_ = nullptr;
576 } 590 }
577 591
578 void IndexedDBCallbacks::OnSuccess(const IndexedDBKey& value) { 592 void IndexedDBCallbacks::OnSuccess(const IndexedDBKey& value) {
593 DCHECK(thread_checker_.CalledOnValidThread());
594 DCHECK(dispatcher_host_);
579 DCHECK(!io_helper_); 595 DCHECK(!io_helper_);
580 DCHECK(dispatcher_host_.get());
581 596
582 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 597 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
583 DCHECK_EQ(kNoTransaction, host_transaction_id_); 598 DCHECK_EQ(kNoTransaction, host_transaction_id_);
584 DCHECK_EQ(kNoDatabase, ipc_database_id_); 599 DCHECK_EQ(kNoDatabase, ipc_database_id_);
585 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 600 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
586 601
587 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessIndexedDBKey( 602 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessIndexedDBKey(
588 ipc_thread_id_, ipc_callbacks_id_, value)); 603 ipc_thread_id_, ipc_callbacks_id_, value));
589 dispatcher_host_ = nullptr; 604 dispatcher_host_ = nullptr;
590 } 605 }
591 606
592 void IndexedDBCallbacks::OnSuccess(int64_t value) { 607 void IndexedDBCallbacks::OnSuccess(int64_t value) {
593 DCHECK(dispatcher_host_.get()); 608 DCHECK(thread_checker_.CalledOnValidThread());
609 DCHECK(dispatcher_host_);
594 if (io_helper_) { 610 if (io_helper_) {
595 BrowserThread::PostTask( 611 BrowserThread::PostTask(
596 BrowserThread::IO, FROM_HERE, 612 BrowserThread::IO, FROM_HERE,
597 base::Bind(&IOThreadHelper::SendSuccessInteger, 613 base::Bind(&IOThreadHelper::SendSuccessInteger,
598 base::Unretained(io_helper_.get()), value)); 614 base::Unretained(io_helper_.get()), value));
599 } else { 615 } else {
600 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 616 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
601 DCHECK_EQ(kNoTransaction, host_transaction_id_); 617 DCHECK_EQ(kNoTransaction, host_transaction_id_);
602 DCHECK_EQ(kNoDatabase, ipc_database_id_); 618 DCHECK_EQ(kNoDatabase, ipc_database_id_);
603 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 619 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
604 620
605 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessInteger( 621 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessInteger(
606 ipc_thread_id_, ipc_callbacks_id_, value)); 622 ipc_thread_id_, ipc_callbacks_id_, value));
607 } 623 }
608 dispatcher_host_ = nullptr; 624 dispatcher_host_ = nullptr;
609 } 625 }
610 626
611 void IndexedDBCallbacks::OnSuccess() { 627 void IndexedDBCallbacks::OnSuccess() {
628 DCHECK(thread_checker_.CalledOnValidThread());
629 DCHECK(dispatcher_host_);
612 DCHECK(!io_helper_); 630 DCHECK(!io_helper_);
613 DCHECK(dispatcher_host_.get());
614 631
615 DCHECK_EQ(kNoCursor, ipc_cursor_id_); 632 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
616 DCHECK_EQ(kNoTransaction, host_transaction_id_); 633 DCHECK_EQ(kNoTransaction, host_transaction_id_);
617 DCHECK_EQ(kNoDatabase, ipc_database_id_); 634 DCHECK_EQ(kNoDatabase, ipc_database_id_);
618 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_); 635 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
619 636
620 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessUndefined( 637 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessUndefined(
621 ipc_thread_id_, ipc_callbacks_id_)); 638 ipc_thread_id_, ipc_callbacks_id_));
622 dispatcher_host_ = nullptr; 639 dispatcher_host_ = nullptr;
623 } 640 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 int32_t database_id, 686 int32_t database_id,
670 const content::IndexedDBDatabaseMetadata& metadata) { 687 const content::IndexedDBDatabaseMetadata& metadata) {
671 callbacks_->SuccessDatabase(database_id, metadata); 688 callbacks_->SuccessDatabase(database_id, metadata);
672 } 689 }
673 690
674 void IndexedDBCallbacks::IOThreadHelper::SendSuccessInteger(int64_t value) { 691 void IndexedDBCallbacks::IOThreadHelper::SendSuccessInteger(int64_t value) {
675 callbacks_->SuccessInteger(value); 692 callbacks_->SuccessInteger(value);
676 } 693 }
677 694
678 } // namespace content 695 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_callbacks.h ('k') | content/browser/indexed_db/indexed_db_database_callbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698