Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: content/browser/indexed_db/indexed_db_quota_client.cc

Issue 1841553002: IndexedDB: Use url::Origin rather than GURL for representing origins (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@origin-idb
Patch Set: Rebased Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 18 matching lines...) Expand all
29 29
30 int64_t GetOriginUsageOnIndexedDBThread(IndexedDBContextImpl* context, 30 int64_t GetOriginUsageOnIndexedDBThread(IndexedDBContextImpl* context,
31 const GURL& origin) { 31 const GURL& origin) {
32 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); 32 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread());
33 return context->GetOriginDiskUsage(origin); 33 return context->GetOriginDiskUsage(origin);
34 } 34 }
35 35
36 void GetAllOriginsOnIndexedDBThread(IndexedDBContextImpl* context, 36 void GetAllOriginsOnIndexedDBThread(IndexedDBContextImpl* context,
37 std::set<GURL>* origins_to_return) { 37 std::set<GURL>* origins_to_return) {
38 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); 38 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread());
39 std::vector<GURL> all_origins = context->GetAllOrigins(); 39 for (const auto& origin : context->GetAllOrigins())
40 origins_to_return->insert(all_origins.begin(), all_origins.end()); 40 origins_to_return->insert(GURL(origin.Serialize()));
41 } 41 }
42 42
43 void DidGetOrigins(const IndexedDBQuotaClient::GetOriginsCallback& callback, 43 void DidGetOrigins(const IndexedDBQuotaClient::GetOriginsCallback& callback,
44 const std::set<GURL>* origins) { 44 const std::set<GURL>* origins) {
45 DCHECK_CURRENTLY_ON(BrowserThread::IO); 45 DCHECK_CURRENTLY_ON(BrowserThread::IO);
46 callback.Run(*origins); 46 callback.Run(*origins);
47 } 47 }
48 48
49 void GetOriginsForHostOnIndexedDBThread(IndexedDBContextImpl* context, 49 void GetOriginsForHostOnIndexedDBThread(IndexedDBContextImpl* context,
50 const std::string& host, 50 const std::string& host,
51 std::set<GURL>* origins_to_return) { 51 std::set<GURL>* origins_to_return) {
52 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); 52 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread());
53 std::vector<GURL> all_origins = context->GetAllOrigins(); 53 for (const auto& origin : context->GetAllOrigins()) {
54 for (const auto& origin_url : all_origins) { 54 GURL origin_url(origin.Serialize());
55 if (host == net::GetHostOrSpecFromURL(origin_url)) 55 if (host == net::GetHostOrSpecFromURL(origin_url))
56 origins_to_return->insert(origin_url); 56 origins_to_return->insert(origin_url);
57 } 57 }
58 } 58 }
59 59
60 } // namespace 60 } // namespace
61 61
62 // IndexedDBQuotaClient -------------------------------------------------------- 62 // IndexedDBQuotaClient --------------------------------------------------------
63 63
64 IndexedDBQuotaClient::IndexedDBQuotaClient( 64 IndexedDBQuotaClient::IndexedDBQuotaClient(
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 base::Bind(&DeleteOriginDataOnIndexedDBThread, 168 base::Bind(&DeleteOriginDataOnIndexedDBThread,
169 base::RetainedRef(indexed_db_context_), origin), 169 base::RetainedRef(indexed_db_context_), origin),
170 callback); 170 callback);
171 } 171 }
172 172
173 bool IndexedDBQuotaClient::DoesSupport(storage::StorageType type) const { 173 bool IndexedDBQuotaClient::DoesSupport(storage::StorageType type) const {
174 return type == storage::kStorageTypeTemporary; 174 return type == storage::kStorageTypeTemporary;
175 } 175 }
176 176
177 } // namespace content 177 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_internals_ui.cc ('k') | content/browser/indexed_db/indexed_db_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698