| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 const scoped_refptr<DOMStorageContextWrapper>& dom_storage_context, | 164 const scoped_refptr<DOMStorageContextWrapper>& dom_storage_context, |
| 165 const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy, | 165 const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy, |
| 166 const StoragePartition::OriginMatcherFunction& origin_matcher, | 166 const StoragePartition::OriginMatcherFunction& origin_matcher, |
| 167 const base::Closure& callback, | 167 const base::Closure& callback, |
| 168 const std::vector<SessionStorageUsageInfo>& infos) { | 168 const std::vector<SessionStorageUsageInfo>& infos) { |
| 169 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 169 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 170 | 170 |
| 171 for (size_t i = 0; i < infos.size(); ++i) { | 171 for (size_t i = 0; i < infos.size(); ++i) { |
| 172 if (!origin_matcher.is_null() && | 172 if (!origin_matcher.is_null() && |
| 173 !origin_matcher.Run(infos[i].origin, special_storage_policy.get())) { | 173 !origin_matcher.Run(infos[i].origin, special_storage_policy.get())) { |
| 174 LOG(ERROR) << "skip session storage: " << infos[i].origin; |
| 174 continue; | 175 continue; |
| 175 } | 176 } |
| 177 LOG(ERROR) << "delete session storage: " << infos[i].origin; |
| 176 dom_storage_context->DeleteSessionStorage(infos[i]); | 178 dom_storage_context->DeleteSessionStorage(infos[i]); |
| 177 } | 179 } |
| 178 | 180 |
| 179 callback.Run(); | 181 callback.Run(); |
| 180 } | 182 } |
| 181 | 183 |
| 182 void ClearLocalStorageOnUIThread( | 184 void ClearLocalStorageOnUIThread( |
| 183 const scoped_refptr<DOMStorageContextWrapper>& dom_storage_context, | 185 const scoped_refptr<DOMStorageContextWrapper>& dom_storage_context, |
| 184 const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy, | 186 const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy, |
| 185 const StoragePartition::OriginMatcherFunction& origin_matcher, | 187 const StoragePartition::OriginMatcherFunction& origin_matcher, |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 const std::set<GURL>& origins, | 716 const std::set<GURL>& origins, |
| 715 storage::StorageType quota_storage_type) { | 717 storage::StorageType quota_storage_type) { |
| 716 // The QuotaManager manages all storage other than cookies, LocalStorage, | 718 // The QuotaManager manages all storage other than cookies, LocalStorage, |
| 717 // and SessionStorage. This loop wipes out most HTML5 storage for the given | 719 // and SessionStorage. This loop wipes out most HTML5 storage for the given |
| 718 // origins. | 720 // origins. |
| 719 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 721 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 720 if (origins.empty()) { | 722 if (origins.empty()) { |
| 721 callback.Run(); | 723 callback.Run(); |
| 722 return; | 724 return; |
| 723 } | 725 } |
| 724 | 726 for(auto origin: origins) LOG(ERROR) << origin.spec(); |
| 725 size_t* deletion_task_count = new size_t(0u); | 727 size_t* deletion_task_count = new size_t(0u); |
| 726 (*deletion_task_count)++; | 728 (*deletion_task_count)++; |
| 727 for (std::set<GURL>::const_iterator origin = origins.begin(); | 729 for (std::set<GURL>::const_iterator origin = origins.begin(); |
| 728 origin != origins.end(); ++origin) { | 730 origin != origins.end(); ++origin) { |
| 729 // TODO(mkwst): Clean this up, it's slow. http://crbug.com/130746 | 731 // TODO(mkwst): Clean this up, it's slow. http://crbug.com/130746 |
| 730 if (!storage_origin.is_empty() && origin->GetOrigin() != storage_origin) | 732 if (!storage_origin.is_empty() && origin->GetOrigin() != storage_origin) |
| 731 continue; | 733 continue; |
| 732 | 734 |
| 733 if (!origin_matcher.is_null() && | 735 if (!origin_matcher.is_null() && |
| 734 !origin_matcher.Run(*origin, special_storage_policy.get())) { | 736 !origin_matcher.Run(*origin, special_storage_policy.get())) { |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 net::URLRequestContextGetter* url_request_context) { | 929 net::URLRequestContextGetter* url_request_context) { |
| 928 url_request_context_ = url_request_context; | 930 url_request_context_ = url_request_context; |
| 929 } | 931 } |
| 930 | 932 |
| 931 void StoragePartitionImpl::SetMediaURLRequestContext( | 933 void StoragePartitionImpl::SetMediaURLRequestContext( |
| 932 net::URLRequestContextGetter* media_url_request_context) { | 934 net::URLRequestContextGetter* media_url_request_context) { |
| 933 media_url_request_context_ = media_url_request_context; | 935 media_url_request_context_ = media_url_request_context; |
| 934 } | 936 } |
| 935 | 937 |
| 936 } // namespace content | 938 } // namespace content |
| OLD | NEW |