OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/storage_partition_impl.h" | 5 #include "content/browser/storage_partition_impl.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "content/browser/fileapi/browser_file_system_helper.h" | 8 #include "content/browser/fileapi/browser_file_system_helper.h" |
| 9 #include "content/browser/gpu/shader_disk_cache.h" |
9 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
10 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
11 #include "content/public/browser/dom_storage_context.h" | 12 #include "content/public/browser/dom_storage_context.h" |
12 #include "content/public/browser/indexed_db_context.h" | 13 #include "content/public/browser/indexed_db_context.h" |
13 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
14 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
15 #include "net/cookies/cookie_monster.h" | 16 #include "net/cookies/cookie_monster.h" |
16 #include "net/url_request/url_request_context_getter.h" | 17 #include "net/url_request/url_request_context_getter.h" |
17 #include "net/url_request/url_request_context.h" | 18 #include "net/url_request/url_request_context.h" |
18 #include "webkit/database/database_tracker.h" | 19 #include "webkit/database/database_tracker.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 quota::kStorageTypeTemporary, base::Time(), | 98 quota::kStorageTypeTemporary, base::Time(), |
98 base::Bind(&ClearQuotaManagedOriginsOnIOThread, quota_manager)); | 99 base::Bind(&ClearQuotaManagedOriginsOnIOThread, quota_manager)); |
99 } | 100 } |
100 if (storage_mask & StoragePartition::kQuotaManagedPersistentStorage) { | 101 if (storage_mask & StoragePartition::kQuotaManagedPersistentStorage) { |
101 quota_manager->GetOriginsModifiedSince( | 102 quota_manager->GetOriginsModifiedSince( |
102 quota::kStorageTypePersistent, base::Time(), | 103 quota::kStorageTypePersistent, base::Time(), |
103 base::Bind(&ClearQuotaManagedOriginsOnIOThread, quota_manager)); | 104 base::Bind(&ClearQuotaManagedOriginsOnIOThread, quota_manager)); |
104 } | 105 } |
105 } | 106 } |
106 | 107 |
| 108 void ClearedShaderCacheOnIOThread(base::Closure callback) { |
| 109 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 110 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback); |
| 111 } |
| 112 |
| 113 void ClearShaderCacheOnIOThread(base::FilePath path, |
| 114 base::Time begin, base::Time end, base::Closure callback) { |
| 115 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 116 ShaderCacheFactory::GetInstance()->ClearByPath( |
| 117 path, begin, end, |
| 118 base::Bind(&ClearedShaderCacheOnIOThread, callback)); |
| 119 } |
| 120 |
107 void OnLocalStorageUsageInfo( | 121 void OnLocalStorageUsageInfo( |
108 const scoped_refptr<DOMStorageContextImpl>& dom_storage_context, | 122 const scoped_refptr<DOMStorageContextImpl>& dom_storage_context, |
109 const std::vector<dom_storage::LocalStorageUsageInfo>& infos) { | 123 const std::vector<dom_storage::LocalStorageUsageInfo>& infos) { |
110 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
111 | 125 |
112 for (size_t i = 0; i < infos.size(); ++i) { | 126 for (size_t i = 0; i < infos.size(); ++i) { |
113 dom_storage_context->DeleteLocalStorage(infos[i].origin); | 127 dom_storage_context->DeleteLocalStorage(infos[i].origin); |
114 } | 128 } |
115 } | 129 } |
116 | 130 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 dom_storage_context_->GetLocalStorageUsage( | 300 dom_storage_context_->GetLocalStorageUsage( |
287 base::Bind(&OnLocalStorageUsageInfo, dom_storage_context_)); | 301 base::Bind(&OnLocalStorageUsageInfo, dom_storage_context_)); |
288 } | 302 } |
289 | 303 |
290 if (storage_mask & kSessionDomStorage) { | 304 if (storage_mask & kSessionDomStorage) { |
291 dom_storage_context_->GetSessionStorageUsage( | 305 dom_storage_context_->GetSessionStorageUsage( |
292 base::Bind(&OnSessionStorageUsageInfo, dom_storage_context_)); | 306 base::Bind(&OnSessionStorageUsageInfo, dom_storage_context_)); |
293 } | 307 } |
294 } | 308 } |
295 | 309 |
| 310 void StoragePartitionImpl::AsyncClearDataBetween(uint32 storage_mask, |
| 311 const base::Time& begin, const base::Time& end, |
| 312 const base::Closure& callback) { |
| 313 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 314 DCHECK(storage_mask == kShaderStorage); |
| 315 |
| 316 if (storage_mask & kShaderStorage) { |
| 317 BrowserThread::PostTask( |
| 318 BrowserThread::IO, FROM_HERE, |
| 319 base::Bind(&ClearShaderCacheOnIOThread, GetPath(), begin, end, |
| 320 callback)); |
| 321 } |
| 322 } |
| 323 |
296 void StoragePartitionImpl::SetURLRequestContext( | 324 void StoragePartitionImpl::SetURLRequestContext( |
297 net::URLRequestContextGetter* url_request_context) { | 325 net::URLRequestContextGetter* url_request_context) { |
298 url_request_context_ = url_request_context; | 326 url_request_context_ = url_request_context; |
299 } | 327 } |
300 | 328 |
301 void StoragePartitionImpl::SetMediaURLRequestContext( | 329 void StoragePartitionImpl::SetMediaURLRequestContext( |
302 net::URLRequestContextGetter* media_url_request_context) { | 330 net::URLRequestContextGetter* media_url_request_context) { |
303 media_url_request_context_ = media_url_request_context; | 331 media_url_request_context_ = media_url_request_context; |
304 } | 332 } |
305 | 333 |
306 } // namespace content | 334 } // namespace content |
OLD | NEW |