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

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

Issue 14022012: Code quality and standards in SimpleBackend. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: braces 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
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_backend_impl.h" 5 #include "net/disk_cache/simple/simple_backend_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 } // namespace 36 } // namespace
37 37
38 namespace disk_cache { 38 namespace disk_cache {
39 39
40 SimpleBackendImpl::SimpleBackendImpl( 40 SimpleBackendImpl::SimpleBackendImpl(
41 const FilePath& path, 41 const FilePath& path,
42 int max_bytes, 42 int max_bytes,
43 net::CacheType type, 43 net::CacheType type,
44 const scoped_refptr<base::TaskRunner>& cache_thread, 44 base::TaskRunner* cache_thread,
45 net::NetLog* net_log) 45 net::NetLog* net_log)
46 : path_(path), 46 : path_(path),
47 index_(new SimpleIndex(cache_thread, 47 index_(new SimpleIndex(cache_thread,
48 MessageLoopProxy::current(), // io_thread 48 MessageLoopProxy::current(), // io_thread
49 path)), 49 path)),
50 cache_thread_(cache_thread) {} 50 cache_thread_(cache_thread) {}
51 51
52 SimpleBackendImpl::~SimpleBackendImpl() { 52 SimpleBackendImpl::~SimpleBackendImpl() {
53 index_->WriteToDisk(); 53 index_->WriteToDisk();
54 } 54 }
(...skipping 16 matching lines...) Expand all
71 } 71 }
72 72
73 int32 SimpleBackendImpl::GetEntryCount() const { 73 int32 SimpleBackendImpl::GetEntryCount() const {
74 NOTIMPLEMENTED(); 74 NOTIMPLEMENTED();
75 return 0; 75 return 0;
76 } 76 }
77 77
78 int SimpleBackendImpl::OpenEntry(const std::string& key, 78 int SimpleBackendImpl::OpenEntry(const std::string& key,
79 Entry** entry, 79 Entry** entry,
80 const CompletionCallback& callback) { 80 const CompletionCallback& callback) {
81 return SimpleEntryImpl::OpenEntry(index_, path_, key, entry, callback); 81 return SimpleEntryImpl::OpenEntry(index_.get(), path_, key, entry, callback);
82 } 82 }
83 83
84 int SimpleBackendImpl::CreateEntry(const std::string& key, 84 int SimpleBackendImpl::CreateEntry(const std::string& key,
85 Entry** entry, 85 Entry** entry,
86 const CompletionCallback& callback) { 86 const CompletionCallback& callback) {
87 return SimpleEntryImpl::CreateEntry(index_, path_, key, entry, callback); 87 return SimpleEntryImpl::CreateEntry(index_.get(), path_, key, entry,
88 callback);
88 } 89 }
89 90
90 int SimpleBackendImpl::DoomEntry(const std::string& key, 91 int SimpleBackendImpl::DoomEntry(const std::string& key,
91 const net::CompletionCallback& callback) { 92 const net::CompletionCallback& callback) {
92 return SimpleEntryImpl::DoomEntry(index_, path_, key, callback); 93 return SimpleEntryImpl::DoomEntry(index_.get(), path_, key, callback);
93 } 94 }
94 95
95 int SimpleBackendImpl::DoomAllEntries(const CompletionCallback& callback) { 96 int SimpleBackendImpl::DoomAllEntries(const CompletionCallback& callback) {
96 NOTIMPLEMENTED(); 97 NOTIMPLEMENTED();
97 return net::ERR_FAILED; 98 return net::ERR_FAILED;
98 } 99 }
99 100
100 int SimpleBackendImpl::DoomEntriesBetween( 101 int SimpleBackendImpl::DoomEntriesBetween(
101 const Time initial_time, 102 const Time initial_time,
102 const Time end_time, 103 const Time end_time,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 int rv = net::OK; 148 int rv = net::OK;
148 if (!file_util::PathExists(path) && !file_util::CreateDirectory(path)) { 149 if (!file_util::PathExists(path) && !file_util::CreateDirectory(path)) {
149 LOG(ERROR) << "Simple Cache Backend: failed to create: " << path.value(); 150 LOG(ERROR) << "Simple Cache Backend: failed to create: " << path.value();
150 rv = net::ERR_FAILED; 151 rv = net::ERR_FAILED;
151 } 152 }
152 153
153 io_thread->PostTask(FROM_HERE, base::Bind(initialize_index_callback, rv)); 154 io_thread->PostTask(FROM_HERE, base::Bind(initialize_index_callback, rv));
154 } 155 }
155 156
156 } // namespace disk_cache 157 } // namespace disk_cache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698