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

Side by Side Diff: content/browser/dom_storage/dom_storage_area.cc

Issue 1102263003: Discard uncommitted changes when shutting down DOMStorageArea Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | content/browser/dom_storage/dom_storage_area_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/dom_storage/dom_storage_area.h" 5 #include "content/browser/dom_storage/dom_storage_area.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 task_runner_->PostDelayedTask( 453 task_runner_->PostDelayedTask(
454 FROM_HERE, base::Bind(&DOMStorageArea::OnCommitTimer, this), 454 FROM_HERE, base::Bind(&DOMStorageArea::OnCommitTimer, this),
455 ComputeCommitDelay()); 455 ComputeCommitDelay());
456 } 456 }
457 } 457 }
458 458
459 void DOMStorageArea::ShutdownInCommitSequence() { 459 void DOMStorageArea::ShutdownInCommitSequence() {
460 // This method executes on the commit sequence. 460 // This method executes on the commit sequence.
461 DCHECK(task_runner_->IsRunningOnCommitSequence()); 461 DCHECK(task_runner_->IsRunningOnCommitSequence());
462 DCHECK(backing_.get()); 462 DCHECK(backing_.get());
463 if (commit_batch_) { 463 // Discard any changes that accrued prior to the timer firing.
464 // Commit any changes that accrued prior to the timer firing.
465 bool success = backing_->CommitChanges(
466 commit_batch_->clear_all_first,
467 commit_batch_->changed_values);
468 DCHECK(success);
469 }
470 commit_batch_.reset(); 464 commit_batch_.reset();
471 backing_.reset(); 465 backing_.reset();
472 session_storage_backing_ = NULL; 466 session_storage_backing_ = NULL;
473 } 467 }
474 468
475 } // namespace content 469 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/dom_storage/dom_storage_area_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698