OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/browsing_data/storage_partition_http_cache_data_remover.h" | 5 #include "components/browsing_data/storage_partition_http_cache_data_remover.h" |
6 | 6 |
7 #include "components/browsing_data/conditional_cache_deletion_helper.h" | 7 #include "components/browsing_data/conditional_cache_deletion_helper.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "content/public/browser/storage_partition.h" | 9 #include "content/public/browser/storage_partition.h" |
10 #include "net/base/sdch_manager.h" | 10 #include "net/base/sdch_manager.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 171 } |
172 case STATE_PROCESS_MAIN: | 172 case STATE_PROCESS_MAIN: |
173 case STATE_PROCESS_MEDIA: { | 173 case STATE_PROCESS_MEDIA: { |
174 next_cache_state_ = (next_cache_state_ == STATE_PROCESS_MAIN) | 174 next_cache_state_ = (next_cache_state_ == STATE_PROCESS_MAIN) |
175 ? STATE_CREATE_MEDIA | 175 ? STATE_CREATE_MEDIA |
176 : STATE_DONE; | 176 : STATE_DONE; |
177 | 177 |
178 // |cache_| can be null if it cannot be initialized. | 178 // |cache_| can be null if it cannot be initialized. |
179 if (cache_) { | 179 if (cache_) { |
180 if (!url_predicate_.is_null()) { | 180 if (!url_predicate_.is_null()) { |
181 (new ConditionalCacheDeletionHelper( | 181 rv = (new ConditionalCacheDeletionHelper( |
182 cache_, | 182 cache_, |
183 ConditionalCacheDeletionHelper::CreateURLAndTimeCondition( | 183 ConditionalCacheDeletionHelper::CreateURLAndTimeCondition( |
184 url_predicate_, | 184 url_predicate_, delete_begin_, delete_end_))) |
185 delete_begin_, | 185 ->DeleteAndDestroySelfWhenFinished(base::Bind( |
186 delete_end_)))->DeleteAndDestroySelfWhenFinished( | 186 &StoragePartitionHttpCacheDataRemover::DoClearCache, |
187 base::Bind( | 187 base::Unretained(this))); |
188 &StoragePartitionHttpCacheDataRemover::DoClearCache, | |
189 base::Unretained(this))); | |
190 } else if (delete_begin_.is_null() && delete_end_.is_max()) { | 188 } else if (delete_begin_.is_null() && delete_end_.is_max()) { |
191 rv = cache_->DoomAllEntries(base::Bind( | 189 rv = cache_->DoomAllEntries(base::Bind( |
192 &StoragePartitionHttpCacheDataRemover::DoClearCache, | 190 &StoragePartitionHttpCacheDataRemover::DoClearCache, |
193 base::Unretained(this))); | 191 base::Unretained(this))); |
194 } else { | 192 } else { |
195 rv = cache_->DoomEntriesBetween( | 193 rv = cache_->DoomEntriesBetween( |
196 delete_begin_, delete_end_, | 194 delete_begin_, delete_end_, |
197 base::Bind( | 195 base::Bind( |
198 &StoragePartitionHttpCacheDataRemover::DoClearCache, | 196 &StoragePartitionHttpCacheDataRemover::DoClearCache, |
199 base::Unretained(this))); | 197 base::Unretained(this))); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 default: { | 296 default: { |
299 NOTREACHED() << "bad state"; | 297 NOTREACHED() << "bad state"; |
300 next_cache_state_ = STATE_NONE; // Stop looping. | 298 next_cache_state_ = STATE_NONE; // Stop looping. |
301 return; | 299 return; |
302 } | 300 } |
303 } | 301 } |
304 } | 302 } |
305 } | 303 } |
306 | 304 |
307 } // namespace browsing_data | 305 } // namespace browsing_data |
OLD | NEW |