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 "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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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( | 81 return SimpleEntryImpl::OpenEntry(index_, path_, key, entry, callback); |
rvargas (doing something else)
2013/04/17 19:56:38
the weak pointer seems like a better approach.
| |
82 index_->AsWeakPtr(), path_, key, entry, callback); | |
83 } | 82 } |
84 | 83 |
85 int SimpleBackendImpl::CreateEntry(const std::string& key, | 84 int SimpleBackendImpl::CreateEntry(const std::string& key, |
86 Entry** entry, | 85 Entry** entry, |
87 const CompletionCallback& callback) { | 86 const CompletionCallback& callback) { |
88 return SimpleEntryImpl::CreateEntry( | 87 return SimpleEntryImpl::CreateEntry(index_, path_, key, entry, callback); |
89 index_->AsWeakPtr(), path_, key, entry, callback); | |
90 } | 88 } |
91 | 89 |
92 int SimpleBackendImpl::DoomEntry(const std::string& key, | 90 int SimpleBackendImpl::DoomEntry(const std::string& key, |
93 const net::CompletionCallback& callback) { | 91 const net::CompletionCallback& callback) { |
94 return SimpleEntryImpl::DoomEntry(index_->AsWeakPtr(), path_, key, callback); | 92 return SimpleEntryImpl::DoomEntry(index_, path_, key, callback); |
95 } | 93 } |
96 | 94 |
97 int SimpleBackendImpl::DoomAllEntries(const CompletionCallback& callback) { | 95 int SimpleBackendImpl::DoomAllEntries(const CompletionCallback& callback) { |
98 NOTIMPLEMENTED(); | 96 NOTIMPLEMENTED(); |
99 return net::ERR_FAILED; | 97 return net::ERR_FAILED; |
100 } | 98 } |
101 | 99 |
102 int SimpleBackendImpl::DoomEntriesBetween( | 100 int SimpleBackendImpl::DoomEntriesBetween( |
103 const Time initial_time, | 101 const Time initial_time, |
104 const Time end_time, | 102 const Time end_time, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 int rv = net::OK; | 147 int rv = net::OK; |
150 if (!file_util::PathExists(path) && !file_util::CreateDirectory(path)) { | 148 if (!file_util::PathExists(path) && !file_util::CreateDirectory(path)) { |
151 LOG(ERROR) << "Simple Cache Backend: failed to create: " << path.value(); | 149 LOG(ERROR) << "Simple Cache Backend: failed to create: " << path.value(); |
152 rv = net::ERR_FAILED; | 150 rv = net::ERR_FAILED; |
153 } | 151 } |
154 | 152 |
155 io_thread->PostTask(FROM_HERE, base::Bind(initialize_index_callback, rv)); | 153 io_thread->PostTask(FROM_HERE, base::Bind(initialize_index_callback, rv)); |
156 } | 154 } |
157 | 155 |
158 } // namespace disk_cache | 156 } // namespace disk_cache |
OLD | NEW |