| 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/indexed_db/indexed_db_quota_client.h" | 5 #include "content/browser/indexed_db/indexed_db_quota_client.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 storage::QuotaStatusCode DeleteOriginDataOnIndexedDBThread( | 24 storage::QuotaStatusCode DeleteOriginDataOnIndexedDBThread( |
| 25 IndexedDBContextImpl* context, | 25 IndexedDBContextImpl* context, |
| 26 const GURL& origin) { | 26 const GURL& origin) { |
| 27 context->DeleteForOrigin(origin); | 27 context->DeleteForOrigin(origin); |
| 28 return storage::kQuotaStatusOk; | 28 return storage::kQuotaStatusOk; |
| 29 } | 29 } |
| 30 | 30 |
| 31 int64_t GetOriginUsageOnIndexedDBThread(IndexedDBContextImpl* context, | 31 int64_t GetOriginUsageOnIndexedDBThread(IndexedDBContextImpl* context, |
| 32 const GURL& origin) { | 32 const GURL& origin) { |
| 33 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); | 33 DCHECK(context->TaskRunner()->RunsTasksInCurrentSequence()); |
| 34 return context->GetOriginDiskUsage(origin); | 34 return context->GetOriginDiskUsage(origin); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void GetAllOriginsOnIndexedDBThread(IndexedDBContextImpl* context, | 37 void GetAllOriginsOnIndexedDBThread(IndexedDBContextImpl* context, |
| 38 std::set<GURL>* origins_to_return) { | 38 std::set<GURL>* origins_to_return) { |
| 39 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); | 39 DCHECK(context->TaskRunner()->RunsTasksInCurrentSequence()); |
| 40 for (const auto& origin : context->GetAllOrigins()) | 40 for (const auto& origin : context->GetAllOrigins()) |
| 41 origins_to_return->insert(origin.GetURL()); | 41 origins_to_return->insert(origin.GetURL()); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void DidGetOrigins(const IndexedDBQuotaClient::GetOriginsCallback& callback, | 44 void DidGetOrigins(const IndexedDBQuotaClient::GetOriginsCallback& callback, |
| 45 const std::set<GURL>* origins) { | 45 const std::set<GURL>* origins) { |
| 46 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 46 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 47 callback.Run(*origins); | 47 callback.Run(*origins); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void GetOriginsForHostOnIndexedDBThread(IndexedDBContextImpl* context, | 50 void GetOriginsForHostOnIndexedDBThread(IndexedDBContextImpl* context, |
| 51 const std::string& host, | 51 const std::string& host, |
| 52 std::set<GURL>* origins_to_return) { | 52 std::set<GURL>* origins_to_return) { |
| 53 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); | 53 DCHECK(context->TaskRunner()->RunsTasksInCurrentSequence()); |
| 54 for (const auto& origin : context->GetAllOrigins()) { | 54 for (const auto& origin : context->GetAllOrigins()) { |
| 55 GURL origin_url(origin.Serialize()); | 55 GURL origin_url(origin.Serialize()); |
| 56 if (host == net::GetHostOrSpecFromURL(origin_url)) | 56 if (host == net::GetHostOrSpecFromURL(origin_url)) |
| 57 origins_to_return->insert(origin_url); | 57 origins_to_return->insert(origin_url); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| 63 // IndexedDBQuotaClient -------------------------------------------------------- | 63 // IndexedDBQuotaClient -------------------------------------------------------- |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 base::Bind(&DeleteOriginDataOnIndexedDBThread, | 169 base::Bind(&DeleteOriginDataOnIndexedDBThread, |
| 170 base::RetainedRef(indexed_db_context_), origin), | 170 base::RetainedRef(indexed_db_context_), origin), |
| 171 callback); | 171 callback); |
| 172 } | 172 } |
| 173 | 173 |
| 174 bool IndexedDBQuotaClient::DoesSupport(storage::StorageType type) const { | 174 bool IndexedDBQuotaClient::DoesSupport(storage::StorageType type) const { |
| 175 return type == storage::kStorageTypeTemporary; | 175 return type == storage::kStorageTypeTemporary; |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace content | 178 } // namespace content |
| OLD | NEW |