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