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

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

Issue 313883003: Split IndexedDBFactory into virtual base + impl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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_context_impl.h" 5 #include "content/browser/indexed_db/indexed_db_context_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/files/file_enumerator.h" 12 #include "base/files/file_enumerator.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/sequenced_task_runner.h" 15 #include "base/sequenced_task_runner.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 #include "base/values.h" 20 #include "base/values.h"
21 #include "content/browser/browser_main_loop.h" 21 #include "content/browser/browser_main_loop.h"
22 #include "content/browser/indexed_db/indexed_db_connection.h" 22 #include "content/browser/indexed_db/indexed_db_connection.h"
23 #include "content/browser/indexed_db/indexed_db_database.h" 23 #include "content/browser/indexed_db/indexed_db_database.h"
24 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" 24 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h"
25 #include "content/browser/indexed_db/indexed_db_factory.h" 25 #include "content/browser/indexed_db/indexed_db_factory_impl.h"
26 #include "content/browser/indexed_db/indexed_db_quota_client.h" 26 #include "content/browser/indexed_db/indexed_db_quota_client.h"
27 #include "content/browser/indexed_db/indexed_db_tracing.h" 27 #include "content/browser/indexed_db/indexed_db_tracing.h"
28 #include "content/browser/indexed_db/indexed_db_transaction.h" 28 #include "content/browser/indexed_db/indexed_db_transaction.h"
29 #include "content/public/browser/browser_thread.h" 29 #include "content/public/browser/browser_thread.h"
30 #include "content/public/browser/indexed_db_info.h" 30 #include "content/public/browser/indexed_db_info.h"
31 #include "content/public/common/content_switches.h" 31 #include "content/public/common/content_switches.h"
32 #include "ui/base/text/bytes_formatting.h" 32 #include "ui/base/text/bytes_formatting.h"
33 #include "webkit/browser/database/database_util.h" 33 #include "webkit/browser/database/database_util.h"
34 #include "webkit/browser/quota/quota_manager_proxy.h" 34 #include "webkit/browser/quota/quota_manager_proxy.h"
35 #include "webkit/browser/quota/special_storage_policy.h" 35 #include "webkit/browser/quota/special_storage_policy.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 quota_manager_proxy->RegisterClient(new IndexedDBQuotaClient(this)); 115 quota_manager_proxy->RegisterClient(new IndexedDBQuotaClient(this));
116 } 116 }
117 } 117 }
118 118
119 IndexedDBFactory* IndexedDBContextImpl::GetIDBFactory() { 119 IndexedDBFactory* IndexedDBContextImpl::GetIDBFactory() {
120 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); 120 DCHECK(TaskRunner()->RunsTasksOnCurrentThread());
121 if (!factory_) { 121 if (!factory_) {
122 // Prime our cache of origins with existing databases so we can 122 // Prime our cache of origins with existing databases so we can
123 // detect when dbs are newly created. 123 // detect when dbs are newly created.
124 GetOriginSet(); 124 GetOriginSet();
125 factory_ = new IndexedDBFactory(this); 125 factory_ = new IndexedDBFactoryImpl(this);
126 } 126 }
127 return factory_; 127 return factory_;
128 } 128 }
129 129
130 std::vector<GURL> IndexedDBContextImpl::GetAllOrigins() { 130 std::vector<GURL> IndexedDBContextImpl::GetAllOrigins() {
131 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); 131 DCHECK(TaskRunner()->RunsTasksOnCurrentThread());
132 std::vector<GURL> origins; 132 std::vector<GURL> origins;
133 std::set<GURL>* origins_set = GetOriginSet(); 133 std::set<GURL>* origins_set = GetOriginSet();
134 for (std::set<GURL>::const_iterator iter = origins_set->begin(); 134 for (std::set<GURL>::const_iterator iter = origins_set->begin();
135 iter != origins_set->end(); 135 iter != origins_set->end();
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 origin_set_.reset(); 570 origin_set_.reset();
571 origin_size_map_.clear(); 571 origin_size_map_.clear();
572 space_available_map_.clear(); 572 space_available_map_.clear();
573 } 573 }
574 574
575 base::TaskRunner* IndexedDBContextImpl::TaskRunner() const { 575 base::TaskRunner* IndexedDBContextImpl::TaskRunner() const {
576 return task_runner_; 576 return task_runner_;
577 } 577 }
578 578
579 } // namespace content 579 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698