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/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 if (success) | 231 if (success) |
232 CommitPhaseTwo(); | 232 CommitPhaseTwo(); |
233 else | 233 else |
234 Abort(IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionDataError, | 234 Abort(IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionDataError, |
235 "Failed to write blobs.")); | 235 "Failed to write blobs.")); |
236 } | 236 } |
237 | 237 |
238 leveldb::Status IndexedDBTransaction::Commit() { | 238 leveldb::Status IndexedDBTransaction::Commit() { |
239 IDB_TRACE1("IndexedDBTransaction::Commit", "txn.id", id()); | 239 IDB_TRACE1("IndexedDBTransaction::Commit", "txn.id", id()); |
240 | 240 |
| 241 timeout_timer_.Stop(); |
| 242 |
241 // In multiprocess ports, front-end may have requested a commit but | 243 // In multiprocess ports, front-end may have requested a commit but |
242 // an abort has already been initiated asynchronously by the | 244 // an abort has already been initiated asynchronously by the |
243 // back-end. | 245 // back-end. |
244 if (state_ == FINISHED) | 246 if (state_ == FINISHED) |
245 return leveldb::Status::OK(); | 247 return leveldb::Status::OK(); |
246 DCHECK_NE(state_, COMMITTING); | 248 DCHECK_NE(state_, COMMITTING); |
247 | 249 |
248 DCHECK(!used_ || state_ == STARTED); | 250 DCHECK(!used_ || state_ == STARTED); |
249 commit_pending_ = true; | 251 commit_pending_ = true; |
250 | 252 |
(...skipping 27 matching lines...) Expand all Loading... |
278 if (state_ == FINISHED) | 280 if (state_ == FINISHED) |
279 return leveldb::Status::OK(); | 281 return leveldb::Status::OK(); |
280 | 282 |
281 DCHECK_EQ(state_, COMMITTING); | 283 DCHECK_EQ(state_, COMMITTING); |
282 | 284 |
283 // The last reference to this object may be released while performing the | 285 // The last reference to this object may be released while performing the |
284 // commit steps below. We therefore take a self reference to keep ourselves | 286 // commit steps below. We therefore take a self reference to keep ourselves |
285 // alive while executing this method. | 287 // alive while executing this method. |
286 scoped_refptr<IndexedDBTransaction> protect(this); | 288 scoped_refptr<IndexedDBTransaction> protect(this); |
287 | 289 |
288 timeout_timer_.Stop(); | |
289 | |
290 state_ = FINISHED; | 290 state_ = FINISHED; |
291 | 291 |
292 leveldb::Status s; | 292 leveldb::Status s; |
293 bool committed; | 293 bool committed; |
294 if (!used_) { | 294 if (!used_) { |
295 committed = true; | 295 committed = true; |
296 } else { | 296 } else { |
297 s = transaction_->CommitPhaseTwo(); | 297 s = transaction_->CommitPhaseTwo(); |
298 committed = s.ok(); | 298 committed = s.ok(); |
299 } | 299 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 398 |
399 void IndexedDBTransaction::CloseOpenCursors() { | 399 void IndexedDBTransaction::CloseOpenCursors() { |
400 for (std::set<IndexedDBCursor*>::iterator i = open_cursors_.begin(); | 400 for (std::set<IndexedDBCursor*>::iterator i = open_cursors_.begin(); |
401 i != open_cursors_.end(); | 401 i != open_cursors_.end(); |
402 ++i) | 402 ++i) |
403 (*i)->Close(); | 403 (*i)->Close(); |
404 open_cursors_.clear(); | 404 open_cursors_.clear(); |
405 } | 405 } |
406 | 406 |
407 } // namespace content | 407 } // namespace content |
OLD | NEW |