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_backing_store.h" | 5 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 2601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2612 } | 2612 } |
2613 | 2613 |
2614 IndexedDBBackingStore::Transaction::Transaction( | 2614 IndexedDBBackingStore::Transaction::Transaction( |
2615 IndexedDBBackingStore* backing_store) | 2615 IndexedDBBackingStore* backing_store) |
2616 : backing_store_(backing_store) {} | 2616 : backing_store_(backing_store) {} |
2617 | 2617 |
2618 IndexedDBBackingStore::Transaction::~Transaction() {} | 2618 IndexedDBBackingStore::Transaction::~Transaction() {} |
2619 | 2619 |
2620 void IndexedDBBackingStore::Transaction::begin() { | 2620 void IndexedDBBackingStore::Transaction::begin() { |
2621 IDB_TRACE("IndexedDBBackingStore::Transaction::begin"); | 2621 IDB_TRACE("IndexedDBBackingStore::Transaction::begin"); |
2622 DCHECK(!transaction_); | 2622 DCHECK(!transaction_.get()); |
2623 transaction_ = LevelDBTransaction::Create(backing_store_->db_.get()); | 2623 transaction_ = LevelDBTransaction::Create(backing_store_->db_.get()); |
2624 } | 2624 } |
2625 | 2625 |
2626 bool IndexedDBBackingStore::Transaction::Commit() { | 2626 bool IndexedDBBackingStore::Transaction::Commit() { |
2627 IDB_TRACE("IndexedDBBackingStore::Transaction::commit"); | 2627 IDB_TRACE("IndexedDBBackingStore::Transaction::commit"); |
2628 DCHECK(transaction_); | 2628 DCHECK(transaction_.get()); |
2629 bool result = transaction_->Commit(); | 2629 bool result = transaction_->Commit(); |
2630 transaction_ = NULL; | 2630 transaction_ = NULL; |
2631 if (!result) | 2631 if (!result) |
2632 INTERNAL_WRITE_ERROR(TRANSACTION_COMMIT_METHOD); | 2632 INTERNAL_WRITE_ERROR(TRANSACTION_COMMIT_METHOD); |
2633 return result; | 2633 return result; |
2634 } | 2634 } |
2635 | 2635 |
2636 void IndexedDBBackingStore::Transaction::Rollback() { | 2636 void IndexedDBBackingStore::Transaction::Rollback() { |
2637 IDB_TRACE("IndexedDBBackingStore::Transaction::rollback"); | 2637 IDB_TRACE("IndexedDBBackingStore::Transaction::rollback"); |
2638 DCHECK(transaction_); | 2638 DCHECK(transaction_.get()); |
2639 transaction_->Rollback(); | 2639 transaction_->Rollback(); |
2640 transaction_ = NULL; | 2640 transaction_ = NULL; |
2641 } | 2641 } |
2642 | 2642 |
2643 } // namespace content | 2643 } // namespace content |
OLD | NEW |