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

Side by Side Diff: net/disk_cache/simple/simple_entry_impl.cc

Issue 23591048: Fix Simple Cache race on multiple dooms in flight. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/backend_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/disk_cache/simple/simple_entry_impl.h" 5 #include "net/disk_cache/simple/simple_entry_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 return; 558 return;
559 backend_->OnDeactivated(this); 559 backend_->OnDeactivated(this);
560 } 560 }
561 561
562 void SimpleEntryImpl::MarkAsDoomed() { 562 void SimpleEntryImpl::MarkAsDoomed() {
563 doomed_ = true; 563 doomed_ = true;
564 if (!backend_.get()) 564 if (!backend_.get())
565 return; 565 return;
566 backend_->index()->Remove(entry_hash_); 566 backend_->index()->Remove(entry_hash_);
567 RemoveSelfFromBackend(); 567 RemoveSelfFromBackend();
568 backend_->OnDoomStart(entry_hash_);
gavinp 2013/09/16 12:40:12 This is a bug. We should only do this on actual do
568 } 569 }
569 570
570 void SimpleEntryImpl::RunNextOperationIfNeeded() { 571 void SimpleEntryImpl::RunNextOperationIfNeeded() {
571 DCHECK(io_thread_checker_.CalledOnValidThread()); 572 DCHECK(io_thread_checker_.CalledOnValidThread());
572 SIMPLE_CACHE_UMA(CUSTOM_COUNTS, 573 SIMPLE_CACHE_UMA(CUSTOM_COUNTS,
573 "EntryOperationsPending", cache_type_, 574 "EntryOperationsPending", cache_type_,
574 pending_operations_.size(), 0, 100, 20); 575 pending_operations_.size(), 0, 100, 20);
575 if (!pending_operations_.empty() && state_ != STATE_IO_PENDING) { 576 if (!pending_operations_.empty() && state_ != STATE_IO_PENDING) {
576 scoped_ptr<SimpleEntryOperation> operation( 577 scoped_ptr<SimpleEntryOperation> operation(
577 new SimpleEntryOperation(pending_operations_.front())); 578 new SimpleEntryOperation(pending_operations_.front()));
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 Closure reply = base::Bind(&SimpleEntryImpl::WriteOperationComplete, 911 Closure reply = base::Bind(&SimpleEntryImpl::WriteOperationComplete,
911 this, 912 this,
912 stream_index, 913 stream_index,
913 callback, 914 callback,
914 base::Passed(&entry_stat), 915 base::Passed(&entry_stat),
915 base::Passed(&result)); 916 base::Passed(&result));
916 worker_pool_->PostTaskAndReply(FROM_HERE, task, reply); 917 worker_pool_->PostTaskAndReply(FROM_HERE, task, reply);
917 } 918 }
918 919
919 void SimpleEntryImpl::DoomEntryInternal(const CompletionCallback& callback) { 920 void SimpleEntryImpl::DoomEntryInternal(const CompletionCallback& callback) {
920 if (backend_)
921 backend_->OnDoomStart(entry_hash_);
922 PostTaskAndReplyWithResult( 921 PostTaskAndReplyWithResult(
923 worker_pool_, FROM_HERE, 922 worker_pool_, FROM_HERE,
924 base::Bind(&SimpleSynchronousEntry::DoomEntry, path_, key_, entry_hash_), 923 base::Bind(&SimpleSynchronousEntry::DoomEntry, path_, key_, entry_hash_),
925 base::Bind(&SimpleEntryImpl::DoomOperationComplete, this, callback, 924 base::Bind(&SimpleEntryImpl::DoomOperationComplete, this, callback,
926 state_)); 925 state_));
927 state_ = STATE_IO_PENDING; 926 state_ = STATE_IO_PENDING;
928 } 927 }
929 928
930 void SimpleEntryImpl::CreationOperationComplete( 929 void SimpleEntryImpl::CreationOperationComplete(
931 const CompletionCallback& completion_callback, 930 const CompletionCallback& completion_callback,
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 type = conflicting ? WRITE_FOLLOWS_CONFLICTING_WRITE 1240 type = conflicting ? WRITE_FOLLOWS_CONFLICTING_WRITE
1242 : WRITE_FOLLOWS_NON_CONFLICTING_WRITE; 1241 : WRITE_FOLLOWS_NON_CONFLICTING_WRITE;
1243 } 1242 }
1244 } 1243 }
1245 SIMPLE_CACHE_UMA(ENUMERATION, 1244 SIMPLE_CACHE_UMA(ENUMERATION,
1246 "WriteDependencyType", cache_type_, 1245 "WriteDependencyType", cache_type_,
1247 type, WRITE_DEPENDENCY_TYPE_MAX); 1246 type, WRITE_DEPENDENCY_TYPE_MAX);
1248 } 1247 }
1249 1248
1250 } // namespace disk_cache 1249 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/backend_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698