OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/local_storage_context_mojo.h" | 5 #include "content/browser/dom_storage/local_storage_context_mojo.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "components/leveldb/public/cpp/util.h" | 10 #include "components/leveldb/public/cpp/util.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 void LocalStorageContextMojo::PurgeMemory() { | 283 void LocalStorageContextMojo::PurgeMemory() { |
284 for (const auto& it : level_db_wrappers_) | 284 for (const auto& it : level_db_wrappers_) |
285 it.second->level_db_wrapper()->PurgeMemory(); | 285 it.second->level_db_wrapper()->PurgeMemory(); |
286 } | 286 } |
287 | 287 |
288 leveldb::mojom::LevelDBDatabaseAssociatedRequest | 288 leveldb::mojom::LevelDBDatabaseAssociatedRequest |
289 LocalStorageContextMojo::DatabaseRequestForTesting() { | 289 LocalStorageContextMojo::DatabaseRequestForTesting() { |
290 DCHECK_EQ(connection_state_, NO_CONNECTION); | 290 DCHECK_EQ(connection_state_, NO_CONNECTION); |
291 connection_state_ = CONNECTION_IN_PROGRESS; | 291 connection_state_ = CONNECTION_IN_PROGRESS; |
292 leveldb::mojom::LevelDBDatabaseAssociatedRequest request = | 292 leveldb::mojom::LevelDBDatabaseAssociatedRequest request = |
293 MakeRequestForTesting(&database_); | 293 MakeIsolatedRequest(&database_); |
294 OnDatabaseOpened(true, leveldb::mojom::DatabaseError::OK); | 294 OnDatabaseOpened(true, leveldb::mojom::DatabaseError::OK); |
295 return request; | 295 return request; |
296 } | 296 } |
297 | 297 |
298 void LocalStorageContextMojo::RunWhenConnected(base::OnceClosure callback) { | 298 void LocalStorageContextMojo::RunWhenConnected(base::OnceClosure callback) { |
299 // If we don't have a filesystem_connection_, we'll need to establish one. | 299 // If we don't have a filesystem_connection_, we'll need to establish one. |
300 if (connection_state_ == NO_CONNECTION) { | 300 if (connection_state_ == NO_CONNECTION) { |
301 CHECK(connector_); | 301 CHECK(connector_); |
302 file_service_connection_ = connector_->Connect(file::mojom::kServiceName); | 302 file_service_connection_ = connector_->Connect(file::mojom::kServiceName); |
303 connection_state_ = CONNECTION_IN_PROGRESS; | 303 connection_state_ = CONNECTION_IN_PROGRESS; |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 for (const auto& info : usage) { | 589 for (const auto& info : usage) { |
590 url::Origin origin_candidate(info.origin); | 590 url::Origin origin_candidate(info.origin); |
591 if (!origin_candidate.IsSameOriginWith(origin) && | 591 if (!origin_candidate.IsSameOriginWith(origin) && |
592 origin_candidate.IsSamePhysicalOriginWith(origin)) | 592 origin_candidate.IsSamePhysicalOriginWith(origin)) |
593 DeleteStorage(origin_candidate); | 593 DeleteStorage(origin_candidate); |
594 } | 594 } |
595 DeleteStorage(origin); | 595 DeleteStorage(origin); |
596 } | 596 } |
597 | 597 |
598 } // namespace content | 598 } // namespace content |
OLD | NEW |