| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_transaction.h" | 5 #include "content/browser/indexed_db/indexed_db_transaction.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 processing_event_queue_ = false; | 455 processing_event_queue_ = false; |
| 456 return; | 456 return; |
| 457 } | 457 } |
| 458 | 458 |
| 459 DCHECK(state_ == STARTED); | 459 DCHECK(state_ == STARTED); |
| 460 | 460 |
| 461 // Otherwise, start a timer in case the front-end gets wedged and | 461 // Otherwise, start a timer in case the front-end gets wedged and |
| 462 // never requests further activity. Read-only transactions don't | 462 // never requests further activity. Read-only transactions don't |
| 463 // block other transactions, so don't time those out. | 463 // block other transactions, so don't time those out. |
| 464 if (mode_ != blink::kWebIDBTransactionModeReadOnly) { | 464 if (mode_ != blink::kWebIDBTransactionModeReadOnly) { |
| 465 timeout_timer_.Start( | 465 // TODO(dmurph): Get this back in before submitting. |
| 466 FROM_HERE, GetInactivityTimeout(), | 466 // timeout_timer_.Start( |
| 467 base::Bind(&IndexedDBTransaction::Timeout, ptr_factory_.GetWeakPtr())); | 467 // FROM_HERE, GetInactivityTimeout(), |
| 468 // base::Bind(&IndexedDBTransaction::Timeout, |
| 469 // ptr_factory_.GetWeakPtr())); |
| 468 } | 470 } |
| 469 processing_event_queue_ = false; | 471 processing_event_queue_ = false; |
| 470 } | 472 } |
| 471 | 473 |
| 472 base::TimeDelta IndexedDBTransaction::GetInactivityTimeout() const { | 474 base::TimeDelta IndexedDBTransaction::GetInactivityTimeout() const { |
| 473 return base::TimeDelta::FromSeconds(kInactivityTimeoutPeriodSeconds); | 475 return base::TimeDelta::FromSeconds(kInactivityTimeoutPeriodSeconds); |
| 474 } | 476 } |
| 475 | 477 |
| 476 void IndexedDBTransaction::Timeout() { | 478 void IndexedDBTransaction::Timeout() { |
| 479 LOG(ERROR) << "timout"; |
| 477 Abort(IndexedDBDatabaseError( | 480 Abort(IndexedDBDatabaseError( |
| 478 blink::kWebIDBDatabaseExceptionTimeoutError, | 481 blink::kWebIDBDatabaseExceptionTimeoutError, |
| 479 base::ASCIIToUTF16("Transaction timed out due to inactivity."))); | 482 base::ASCIIToUTF16("Transaction timed out due to inactivity."))); |
| 480 } | 483 } |
| 481 | 484 |
| 482 void IndexedDBTransaction::CloseOpenCursors() { | 485 void IndexedDBTransaction::CloseOpenCursors() { |
| 483 IDB_TRACE1("IndexedDBTransaction::CloseOpenCursors", "txn.id", id()); | 486 IDB_TRACE1("IndexedDBTransaction::CloseOpenCursors", "txn.id", id()); |
| 484 for (auto* cursor : open_cursors_) | 487 for (auto* cursor : open_cursors_) |
| 485 cursor->Close(); | 488 cursor->Close(); |
| 486 open_cursors_.clear(); | 489 open_cursors_.clear(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 | 523 |
| 521 ::indexed_db::mojom::ObserverChangesPtr* | 524 ::indexed_db::mojom::ObserverChangesPtr* |
| 522 IndexedDBTransaction::GetPendingChangesForConnection(int32_t connection_id) { | 525 IndexedDBTransaction::GetPendingChangesForConnection(int32_t connection_id) { |
| 523 auto it = connection_changes_map_.find(connection_id); | 526 auto it = connection_changes_map_.find(connection_id); |
| 524 if (it != connection_changes_map_.end()) | 527 if (it != connection_changes_map_.end()) |
| 525 return &it->second; | 528 return &it->second; |
| 526 return nullptr; | 529 return nullptr; |
| 527 } | 530 } |
| 528 | 531 |
| 529 } // namespace content | 532 } // namespace content |
| OLD | NEW |