Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: content/browser/storage_partition_impl_map.cc

Issue 2249473002: Remove use of stl_util's STLDeleteContainerPairSecondPointers from content/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/storage_partition_impl_map.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/storage_partition_impl_map.h" 5 #include "content/browser/storage_partition_impl_map.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/files/file_enumerator.h" 12 #include "base/files/file_enumerator.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/stl_util.h"
19 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
21 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
22 #include "base/threading/sequenced_worker_pool.h" 21 #include "base/threading/sequenced_worker_pool.h"
23 #include "base/threading/thread_task_runner_handle.h" 22 #include "base/threading/thread_task_runner_handle.h"
24 #include "build/build_config.h" 23 #include "build/build_config.h"
25 #include "content/browser/appcache/appcache_interceptor.h" 24 #include "content/browser/appcache/appcache_interceptor.h"
26 #include "content/browser/appcache/chrome_appcache_service.h" 25 #include "content/browser/appcache/chrome_appcache_service.h"
27 #include "content/browser/blob_storage/chrome_blob_storage_context.h" 26 #include "content/browser/blob_storage/chrome_blob_storage_context.h"
28 #include "content/browser/fileapi/browser_file_system_helper.h" 27 #include "content/browser/fileapi/browser_file_system_helper.h"
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 BrowserContext* browser_context) 369 BrowserContext* browser_context)
371 : browser_context_(browser_context), 370 : browser_context_(browser_context),
372 resource_context_initialized_(false) { 371 resource_context_initialized_(false) {
373 // Doing here instead of initializer list cause it's just too ugly to read. 372 // Doing here instead of initializer list cause it's just too ugly to read.
374 base::SequencedWorkerPool* blocking_pool = BrowserThread::GetBlockingPool(); 373 base::SequencedWorkerPool* blocking_pool = BrowserThread::GetBlockingPool();
375 file_access_runner_ = 374 file_access_runner_ =
376 blocking_pool->GetSequencedTaskRunner(blocking_pool->GetSequenceToken()); 375 blocking_pool->GetSequencedTaskRunner(blocking_pool->GetSequenceToken());
377 } 376 }
378 377
379 StoragePartitionImplMap::~StoragePartitionImplMap() { 378 StoragePartitionImplMap::~StoragePartitionImplMap() {
380 base::STLDeleteContainerPairSecondPointers(partitions_.begin(),
381 partitions_.end());
382 } 379 }
383 380
384 StoragePartitionImpl* StoragePartitionImplMap::Get( 381 StoragePartitionImpl* StoragePartitionImplMap::Get(
385 const std::string& partition_domain, 382 const std::string& partition_domain,
386 const std::string& partition_name, 383 const std::string& partition_name,
387 bool in_memory) { 384 bool in_memory) {
388 // Find the previously created partition if it's available. 385 // Find the previously created partition if it's available.
389 StoragePartitionConfig partition_config( 386 StoragePartitionConfig partition_config(
390 partition_domain, partition_name, in_memory); 387 partition_domain, partition_name, in_memory);
391 388
392 PartitionMap::const_iterator it = partitions_.find(partition_config); 389 PartitionMap::const_iterator it = partitions_.find(partition_config);
393 if (it != partitions_.end()) 390 if (it != partitions_.end())
394 return it->second; 391 return it->second.get();
395 392
396 base::FilePath relative_partition_path = 393 base::FilePath relative_partition_path =
397 GetStoragePartitionPath(partition_domain, partition_name); 394 GetStoragePartitionPath(partition_domain, partition_name);
398 395
399 StoragePartitionImpl* partition = StoragePartitionImpl::Create( 396 std::unique_ptr<StoragePartitionImpl> partition_ptr(
400 browser_context_, in_memory, relative_partition_path); 397 StoragePartitionImpl::Create(browser_context_, in_memory,
401 partitions_[partition_config] = partition; 398 relative_partition_path));
399 StoragePartitionImpl* partition = partition_ptr.get();
400 partitions_[partition_config] = std::move(partition_ptr);
402 401
403 partition->GetQuotaManager()->SetTemporaryStorageEvictionPolicy( 402 partition->GetQuotaManager()->SetTemporaryStorageEvictionPolicy(
404 GetContentClient()->browser()->GetTemporaryStorageEvictionPolicy( 403 GetContentClient()->browser()->GetTemporaryStorageEvictionPolicy(
405 browser_context_)); 404 browser_context_));
406 405
407 ChromeBlobStorageContext* blob_storage_context = 406 ChromeBlobStorageContext* blob_storage_context =
408 ChromeBlobStorageContext::GetFor(browser_context_); 407 ChromeBlobStorageContext::GetFor(browser_context_);
409 StreamContext* stream_context = StreamContext::GetFor(browser_context_); 408 StreamContext* stream_context = StreamContext::GetFor(browser_context_);
410 ProtocolHandlerMap protocol_handlers; 409 ProtocolHandlerMap protocol_handlers;
411 protocol_handlers[url::kBlobScheme] = 410 protocol_handlers[url::kBlobScheme] =
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 file_access_runner_, 552 file_access_runner_,
554 base::Passed(&active_paths)), 553 base::Passed(&active_paths)),
555 done); 554 done);
556 } 555 }
557 556
558 void StoragePartitionImplMap::ForEach( 557 void StoragePartitionImplMap::ForEach(
559 const BrowserContext::StoragePartitionCallback& callback) { 558 const BrowserContext::StoragePartitionCallback& callback) {
560 for (PartitionMap::const_iterator it = partitions_.begin(); 559 for (PartitionMap::const_iterator it = partitions_.begin();
561 it != partitions_.end(); 560 it != partitions_.end();
562 ++it) { 561 ++it) {
563 callback.Run(it->second); 562 callback.Run(it->second.get());
564 } 563 }
565 } 564 }
566 565
567 void StoragePartitionImplMap::PostCreateInitialization( 566 void StoragePartitionImplMap::PostCreateInitialization(
568 StoragePartitionImpl* partition, 567 StoragePartitionImpl* partition,
569 bool in_memory) { 568 bool in_memory) {
570 // TODO(ajwong): ResourceContexts no longer have any storage related state. 569 // TODO(ajwong): ResourceContexts no longer have any storage related state.
571 // We should move this into a place where it is called once per 570 // We should move this into a place where it is called once per
572 // BrowserContext creation rather than piggybacking off the default context 571 // BrowserContext creation rather than piggybacking off the default context
573 // creation. 572 // creation.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 605
607 // We do not call InitializeURLRequestContext() for media contexts because, 606 // We do not call InitializeURLRequestContext() for media contexts because,
608 // other than the HTTP cache, the media contexts share the same backing 607 // other than the HTTP cache, the media contexts share the same backing
609 // objects as their associated "normal" request context. Thus, the previous 608 // objects as their associated "normal" request context. Thus, the previous
610 // call serves to initialize the media request context for this storage 609 // call serves to initialize the media request context for this storage
611 // partition as well. 610 // partition as well.
612 } 611 }
613 } 612 }
614 613
615 } // namespace content 614 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/storage_partition_impl_map.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698