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

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

Issue 14295013: Simple Cache: DoomEntriesBetween() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 16 matching lines...) Expand all
27 27
28 namespace disk_cache { 28 namespace disk_cache {
29 29
30 using base::FilePath; 30 using base::FilePath;
31 using base::MessageLoopProxy; 31 using base::MessageLoopProxy;
32 using base::Time; 32 using base::Time;
33 using base::WeakPtr; 33 using base::WeakPtr;
34 using base::WorkerPool; 34 using base::WorkerPool;
35 35
36 // static 36 // static
37 int SimpleEntryImpl::OpenEntry(WeakPtr<SimpleIndex> index, 37 int SimpleEntryImpl::OpenEntry(WeakPtr<SimpleIndex> index,
gavinp 2013/04/17 07:41:18 Do we need this parameter now? I think leave it al
pasko-google - do not use 2013/04/17 19:47:52 As Felipe suggests in another comment we should lo
38 const FilePath& path, 38 const FilePath& path,
39 const std::string& key, 39 const std::string& key,
40 Entry** entry, 40 Entry** entry,
41 const CompletionCallback& callback) { 41 const CompletionCallback& callback) {
42 // TODO(gavinp): More closely unify the last_used_ in the 42 // TODO(gavinp): More closely unify the last_used_ in the
43 // SimpleSynchronousEntry and the SimpleIndex. 43 // SimpleSynchronousEntry and the SimpleIndex.
44 if (!index || index->UseIfExists(key)) { 44 SynchronousCreationCallback sync_creation_callback =
felipeg 2013/04/17 16:35:04 please keep this and use the method index->Has(key
pasko-google - do not use 2013/04/17 19:47:52 Oh yes, that's the whole purpose of the index: qui
felipeg 2013/04/18 09:54:59 A stale and valid index (with the correct file ent
45 SynchronousCreationCallback sync_creation_callback = 45 base::Bind(&SimpleEntryImpl::CreationOperationComplete,
46 base::Bind(&SimpleEntryImpl::CreationOperationComplete, 46 index, callback, key, entry);
47 index, callback, key, entry); 47 WorkerPool::PostTask(FROM_HERE,
48 WorkerPool::PostTask(FROM_HERE, 48 base::Bind(&SimpleSynchronousEntry::OpenEntry, path,
49 base::Bind(&SimpleSynchronousEntry::OpenEntry, path, 49 key, MessageLoopProxy::current(),
50 key, MessageLoopProxy::current(), 50 sync_creation_callback),
51 sync_creation_callback), 51 true);
52 true); 52 return net::ERR_IO_PENDING;
53 return net::ERR_IO_PENDING;
54 }
55 return net::ERR_FAILED;
56 } 53 }
57 54
58 // static 55 // static
59 int SimpleEntryImpl::CreateEntry(WeakPtr<SimpleIndex> index, 56 int SimpleEntryImpl::CreateEntry(WeakPtr<SimpleIndex> index,
60 const FilePath& path, 57 const FilePath& path,
61 const std::string& key, 58 const std::string& key,
62 Entry** entry, 59 Entry** entry,
63 const CompletionCallback& callback) { 60 const CompletionCallback& callback) {
64 SynchronousCreationCallback sync_creation_callback = 61 SynchronousCreationCallback sync_creation_callback =
65 base::Bind(&SimpleEntryImpl::CreationOperationComplete, 62 base::Bind(&SimpleEntryImpl::CreationOperationComplete,
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 // adding an IO thread index (for fast misses etc...), we can store this data 310 // adding an IO thread index (for fast misses etc...), we can store this data
314 // in that structure. This also solves problems with last_used() on ext4 311 // in that structure. This also solves problems with last_used() on ext4
315 // filesystems not being accurate. 312 // filesystems not being accurate.
316 last_used_ = synchronous_entry_->last_used(); 313 last_used_ = synchronous_entry_->last_used();
317 last_modified_ = synchronous_entry_->last_modified(); 314 last_modified_ = synchronous_entry_->last_modified();
318 for (int i = 0; i < kSimpleEntryFileCount; ++i) 315 for (int i = 0; i < kSimpleEntryFileCount; ++i)
319 data_size_[i] = synchronous_entry_->data_size(i); 316 data_size_[i] = synchronous_entry_->data_size(i);
320 } 317 }
321 318
322 } // namespace disk_cache 319 } // namespace disk_cache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698