| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/in_process_webkit/indexed_db_dispatcher_host.h" | 5 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 10 #include "chrome/browser/metrics/user_metrics.h" | 10 #include "chrome/browser/metrics/user_metrics.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 uint64 quota = kDefaultQuota; | 233 uint64 quota = kDefaultQuota; |
| 234 if (Context()->IsUnlimitedStorageGranted(url) || | 234 if (Context()->IsUnlimitedStorageGranted(url) || |
| 235 CommandLine::ForCurrentProcess()->HasSwitch( | 235 CommandLine::ForCurrentProcess()->HasSwitch( |
| 236 switches::kUnlimitedQuotaForIndexedDB)) { | 236 switches::kUnlimitedQuotaForIndexedDB)) { |
| 237 // TODO(jorlow): For the IsUnlimitedStorageGranted case, we need some | 237 // TODO(jorlow): For the IsUnlimitedStorageGranted case, we need some |
| 238 // way to revoke it. | 238 // way to revoke it. |
| 239 // TODO(jorlow): Use kint64max once we think we can scale over 1GB. | 239 // TODO(jorlow): Use kint64max once we think we can scale over 1GB. |
| 240 quota = 1024 * 1024 * 1024; // 1GB. More or less "unlimited". | 240 quota = 1024 * 1024 * 1024; // 1GB. More or less "unlimited". |
| 241 } | 241 } |
| 242 | 242 |
| 243 WebKit::WebIDBFactory::BackingStoreImpl backingStoreImpl |
| 244 = WebKit::WebIDBFactory::DefaultBackingStore; |
| 245 |
| 246 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 247 switches::kLevelDBIndexedDatabase)) { |
| 248 backingStoreImpl = WebKit::WebIDBFactory::LevelDBBackingStore; |
| 249 } |
| 250 |
| 251 |
| 243 Context()->GetIDBFactory()->open( | 252 Context()->GetIDBFactory()->open( |
| 244 params.name, | 253 params.name, |
| 245 new IndexedDBCallbacks<WebIDBDatabase>(this, params.response_id), origin, | 254 new IndexedDBCallbacks<WebIDBDatabase>(this, params.response_id), origin, |
| 246 NULL, webkit_glue::FilePathToWebString(indexed_db_path), quota); | 255 NULL, webkit_glue::FilePathToWebString(indexed_db_path), quota, |
| 256 backingStoreImpl); |
| 247 } | 257 } |
| 248 | 258 |
| 249 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( | 259 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( |
| 250 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { | 260 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { |
| 251 FilePath base_path = webkit_context_->data_path(); | 261 FilePath base_path = webkit_context_->data_path(); |
| 252 FilePath indexed_db_path; | 262 FilePath indexed_db_path; |
| 253 if (!base_path.empty()) { | 263 if (!base_path.empty()) { |
| 254 indexed_db_path = base_path.Append( | 264 indexed_db_path = base_path.Append( |
| 255 IndexedDBContext::kIndexedDBDirectory); | 265 IndexedDBContext::kIndexedDBDirectory); |
| 256 } | 266 } |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 if (!idb_transaction) | 1056 if (!idb_transaction) |
| 1047 return; | 1057 return; |
| 1048 | 1058 |
| 1049 idb_transaction->didCompleteTaskEvents(); | 1059 idb_transaction->didCompleteTaskEvents(); |
| 1050 } | 1060 } |
| 1051 | 1061 |
| 1052 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 1062 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
| 1053 int32 object_id) { | 1063 int32 object_id) { |
| 1054 parent_->DestroyObject(&map_, object_id); | 1064 parent_->DestroyObject(&map_, object_id); |
| 1055 } | 1065 } |
| OLD | NEW |