| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/dom_storage/dom_storage_context_wrapper.h" | 5 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 base::Bind(&MojoState::OnUserServiceConnectionComplete, | 160 base::Bind(&MojoState::OnUserServiceConnectionComplete, |
| 161 weak_ptr_factory_.GetWeakPtr())); | 161 weak_ptr_factory_.GetWeakPtr())); |
| 162 file_service_connection_->SetConnectionLostClosure( | 162 file_service_connection_->SetConnectionLostClosure( |
| 163 base::Bind(&MojoState::OnUserServiceConnectionError, | 163 base::Bind(&MojoState::OnUserServiceConnectionError, |
| 164 weak_ptr_factory_.GetWeakPtr())); | 164 weak_ptr_factory_.GetWeakPtr())); |
| 165 | 165 |
| 166 if (!subdirectory_.empty()) { | 166 if (!subdirectory_.empty()) { |
| 167 // We were given a subdirectory to write to. Get it and use a disk backed | 167 // We were given a subdirectory to write to. Get it and use a disk backed |
| 168 // database. | 168 // database. |
| 169 file_service_connection_->GetInterface(&file_system_); | 169 file_service_connection_->GetInterface(&file_system_); |
| 170 file_system_->GetSubDirectory( | 170 file_system_->GetSubDirectory(subdirectory_.AsUTF8Unsafe(), |
| 171 mojo::String::From(subdirectory_.AsUTF8Unsafe()), | 171 GetProxy(&directory_), |
| 172 GetProxy(&directory_), | 172 base::Bind(&MojoState::OnDirectoryOpened, |
| 173 base::Bind(&MojoState::OnDirectoryOpened, | 173 weak_ptr_factory_.GetWeakPtr())); |
| 174 weak_ptr_factory_.GetWeakPtr())); | |
| 175 } else { | 174 } else { |
| 176 // We were not given a subdirectory. Use a memory backed database. | 175 // We were not given a subdirectory. Use a memory backed database. |
| 177 file_service_connection_->GetInterface(&leveldb_service_); | 176 file_service_connection_->GetInterface(&leveldb_service_); |
| 178 leveldb_service_->OpenInMemory( | 177 leveldb_service_->OpenInMemory( |
| 179 GetProxy(&database_), | 178 GetProxy(&database_), |
| 180 base::Bind(&MojoState::OnDatabaseOpened, | 179 base::Bind(&MojoState::OnDatabaseOpened, |
| 181 weak_ptr_factory_.GetWeakPtr())); | 180 weak_ptr_factory_.GetWeakPtr())); |
| 182 } | 181 } |
| 183 } | 182 } |
| 184 | 183 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 } | 436 } |
| 438 | 437 |
| 439 void DOMStorageContextWrapper::PurgeMemory(DOMStorageContextImpl::PurgeOption | 438 void DOMStorageContextWrapper::PurgeMemory(DOMStorageContextImpl::PurgeOption |
| 440 purge_option) { | 439 purge_option) { |
| 441 context_->task_runner()->PostTask( | 440 context_->task_runner()->PostTask( |
| 442 FROM_HERE, | 441 FROM_HERE, |
| 443 base::Bind(&DOMStorageContextImpl::PurgeMemory, context_, purge_option)); | 442 base::Bind(&DOMStorageContextImpl::PurgeMemory, context_, purge_option)); |
| 444 } | 443 } |
| 445 | 444 |
| 446 } // namespace content | 445 } // namespace content |
| OLD | NEW |