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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 new IndexedDBQuotaClient(webkit_thread_loop, this)); | 102 new IndexedDBQuotaClient(webkit_thread_loop, this)); |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 WebIDBFactory* IndexedDBContextImpl::GetIDBFactory() { | 106 WebIDBFactory* IndexedDBContextImpl::GetIDBFactory() { |
107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
108 if (!idb_factory_) { | 108 if (!idb_factory_) { |
109 // Prime our cache of origins with existing databases so we can | 109 // Prime our cache of origins with existing databases so we can |
110 // detect when dbs are newly created. | 110 // detect when dbs are newly created. |
111 GetOriginSet(); | 111 GetOriginSet(); |
112 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewIndexedDB)) | 112 idb_factory_.reset(new content::WebIDBFactoryImpl()); |
113 idb_factory_.reset(new content::WebIDBFactoryImpl()); | |
114 else | |
115 idb_factory_.reset(WebIDBFactory::create()); | |
116 } | 113 } |
117 return idb_factory_.get(); | 114 return idb_factory_.get(); |
118 } | 115 } |
119 | 116 |
120 std::vector<GURL> IndexedDBContextImpl::GetAllOrigins() { | 117 std::vector<GURL> IndexedDBContextImpl::GetAllOrigins() { |
121 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
122 std::vector<GURL> origins; | 119 std::vector<GURL> origins; |
123 std::set<GURL>* origins_set = GetOriginSet(); | 120 std::set<GURL>* origins_set = GetOriginSet(); |
124 for (std::set<GURL>::const_iterator iter = origins_set->begin(); | 121 for (std::set<GURL>::const_iterator iter = origins_set->begin(); |
125 iter != origins_set->end(); | 122 iter != origins_set->end(); |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 return origin_set_.get(); | 407 return origin_set_.get(); |
411 } | 408 } |
412 | 409 |
413 void IndexedDBContextImpl::ResetCaches() { | 410 void IndexedDBContextImpl::ResetCaches() { |
414 origin_set_.reset(); | 411 origin_set_.reset(); |
415 origin_size_map_.clear(); | 412 origin_size_map_.clear(); |
416 space_available_map_.clear(); | 413 space_available_map_.clear(); |
417 } | 414 } |
418 | 415 |
419 } // namespace content | 416 } // namespace content |
OLD | NEW |