Chromium Code Reviews| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 break; | 281 break; |
| 282 } | 282 } |
| 283 } | 283 } |
| 284 return s; | 284 return s; |
| 285 } | 285 } |
| 286 | 286 |
| 287 leveldb::Status IndexedDBTransaction::Commit() { | 287 leveldb::Status IndexedDBTransaction::Commit() { |
| 288 IDB_TRACE1("IndexedDBTransaction::Commit", "txn.id", id()); | 288 IDB_TRACE1("IndexedDBTransaction::Commit", "txn.id", id()); |
| 289 | 289 |
| 290 timeout_timer_.Stop(); | 290 timeout_timer_.Stop(); |
| 291 | |
| 292 // In multiprocess ports, front-end may have requested a commit but | 291 // In multiprocess ports, front-end may have requested a commit but |
| 293 // an abort has already been initiated asynchronously by the | 292 // an abort has already been initiated asynchronously by the |
| 294 // back-end. | 293 // back-end. |
| 295 if (state_ == FINISHED) | 294 if (state_ == FINISHED) |
| 296 return leveldb::Status::OK(); | 295 return leveldb::Status::OK(); |
| 297 DCHECK_NE(state_, COMMITTING); | 296 DCHECK_NE(state_, COMMITTING); |
| 298 | 297 |
| 299 DCHECK(!used_ || state_ == STARTED); | 298 DCHECK(!used_ || state_ == STARTED); |
| 300 commit_pending_ = true; | 299 commit_pending_ = true; |
| 301 | 300 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 467 base::Bind(&IndexedDBTransaction::Timeout, ptr_factory_.GetWeakPtr())); | 466 base::Bind(&IndexedDBTransaction::Timeout, ptr_factory_.GetWeakPtr())); |
| 468 } | 467 } |
| 469 processing_event_queue_ = false; | 468 processing_event_queue_ = false; |
| 470 } | 469 } |
| 471 | 470 |
| 472 base::TimeDelta IndexedDBTransaction::GetInactivityTimeout() const { | 471 base::TimeDelta IndexedDBTransaction::GetInactivityTimeout() const { |
| 473 return base::TimeDelta::FromSeconds(kInactivityTimeoutPeriodSeconds); | 472 return base::TimeDelta::FromSeconds(kInactivityTimeoutPeriodSeconds); |
| 474 } | 473 } |
| 475 | 474 |
| 476 void IndexedDBTransaction::Timeout() { | 475 void IndexedDBTransaction::Timeout() { |
| 476 LOG(ERROR) << "timout"; | |
|
Ken Rockot(use gerrit already)
2017/05/16 21:06:32
nit: remove
dmurph
2017/05/16 23:06:44
Done.
| |
| 477 Abort(IndexedDBDatabaseError( | 477 Abort(IndexedDBDatabaseError( |
| 478 blink::kWebIDBDatabaseExceptionTimeoutError, | 478 blink::kWebIDBDatabaseExceptionTimeoutError, |
| 479 base::ASCIIToUTF16("Transaction timed out due to inactivity."))); | 479 base::ASCIIToUTF16("Transaction timed out due to inactivity."))); |
| 480 } | 480 } |
| 481 | 481 |
| 482 void IndexedDBTransaction::CloseOpenCursors() { | 482 void IndexedDBTransaction::CloseOpenCursors() { |
| 483 IDB_TRACE1("IndexedDBTransaction::CloseOpenCursors", "txn.id", id()); | 483 IDB_TRACE1("IndexedDBTransaction::CloseOpenCursors", "txn.id", id()); |
| 484 for (auto* cursor : open_cursors_) | 484 for (auto* cursor : open_cursors_) |
| 485 cursor->Close(); | 485 cursor->Close(); |
| 486 open_cursors_.clear(); | 486 open_cursors_.clear(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 520 | 520 |
| 521 ::indexed_db::mojom::ObserverChangesPtr* | 521 ::indexed_db::mojom::ObserverChangesPtr* |
| 522 IndexedDBTransaction::GetPendingChangesForConnection(int32_t connection_id) { | 522 IndexedDBTransaction::GetPendingChangesForConnection(int32_t connection_id) { |
| 523 auto it = connection_changes_map_.find(connection_id); | 523 auto it = connection_changes_map_.find(connection_id); |
| 524 if (it != connection_changes_map_.end()) | 524 if (it != connection_changes_map_.end()) |
| 525 return &it->second; | 525 return &it->second; |
| 526 return nullptr; | 526 return nullptr; |
| 527 } | 527 } |
| 528 | 528 |
| 529 } // namespace content | 529 } // namespace content |
| OLD | NEW |