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

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

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) 87 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)
88 .get())); 88 .get()));
89 } 89 }
90 return blob_protocol_handler_->MaybeCreateJob(request, network_delegate); 90 return blob_protocol_handler_->MaybeCreateJob(request, network_delegate);
91 } 91 }
92 92
93 private: 93 private:
94 const scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; 94 const scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
95 const scoped_refptr<StreamContext> stream_context_; 95 const scoped_refptr<StreamContext> stream_context_;
96 const scoped_refptr<storage::FileSystemContext> file_system_context_; 96 const scoped_refptr<storage::FileSystemContext> file_system_context_;
97 mutable scoped_ptr<storage::BlobProtocolHandler> blob_protocol_handler_; 97 mutable std::unique_ptr<storage::BlobProtocolHandler> blob_protocol_handler_;
98 DISALLOW_COPY_AND_ASSIGN(BlobProtocolHandler); 98 DISALLOW_COPY_AND_ASSIGN(BlobProtocolHandler);
99 }; 99 };
100 100
101 // These constants are used to create the directory structure under the profile 101 // These constants are used to create the directory structure under the profile
102 // where renderers with a non-default storage partition keep their persistent 102 // where renderers with a non-default storage partition keep their persistent
103 // state. This will contain a set of directories that partially mirror the 103 // state. This will contain a set of directories that partially mirror the
104 // directory structure of BrowserContext::GetPath(). 104 // directory structure of BrowserContext::GetPath().
105 // 105 //
106 // The kStoragePartitionDirname contains an extensions directory which is 106 // The kStoragePartitionDirname contains an extensions directory which is
107 // further partitioned by extension id, followed by another level of directories 107 // further partitioned by extension id, followed by another level of directories
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 // This code also ignores failed moves rather than attempting a smarter retry. 306 // This code also ignores failed moves rather than attempting a smarter retry.
307 // Moves shouldn't fail here unless there is some out-of-band error (eg., 307 // Moves shouldn't fail here unless there is some out-of-band error (eg.,
308 // FS corruption). Retry logic is dangerous in the general case because 308 // FS corruption). Retry logic is dangerous in the general case because
309 // there is not necessarily a guaranteed case where the logic may succeed. 309 // there is not necessarily a guaranteed case where the logic may succeed.
310 // 310 //
311 // This function is still named BlockingGarbageCollect() because it does 311 // This function is still named BlockingGarbageCollect() because it does
312 // execute a few filesystem operations synchronously. 312 // execute a few filesystem operations synchronously.
313 void BlockingGarbageCollect( 313 void BlockingGarbageCollect(
314 const base::FilePath& storage_root, 314 const base::FilePath& storage_root,
315 const scoped_refptr<base::TaskRunner>& file_access_runner, 315 const scoped_refptr<base::TaskRunner>& file_access_runner,
316 scoped_ptr<base::hash_set<base::FilePath> > active_paths) { 316 std::unique_ptr<base::hash_set<base::FilePath>> active_paths) {
317 CHECK(storage_root.IsAbsolute()); 317 CHECK(storage_root.IsAbsolute());
318 318
319 NormalizeActivePaths(storage_root, active_paths.get()); 319 NormalizeActivePaths(storage_root, active_paths.get());
320 320
321 base::FileEnumerator enumerator(storage_root, false, kAllFileTypes); 321 base::FileEnumerator enumerator(storage_root, false, kAllFileTypes);
322 base::FilePath trash_directory; 322 base::FilePath trash_directory;
323 if (!base::CreateTemporaryDirInDir(storage_root, kTrashDirname, 323 if (!base::CreateTemporaryDirInDir(storage_root, kTrashDirname,
324 &trash_directory)) { 324 &trash_directory)) {
325 // Unable to continue without creating the trash directory so give up. 325 // Unable to continue without creating the trash directory so give up.
326 return; 326 return;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 GetStoragePartitionDomainPath(partition_domain)); 526 GetStoragePartitionDomainPath(partition_domain));
527 527
528 BrowserThread::PostBlockingPoolTask( 528 BrowserThread::PostBlockingPoolTask(
529 FROM_HERE, 529 FROM_HERE,
530 base::Bind(&BlockingObliteratePath, browser_context_->GetPath(), 530 base::Bind(&BlockingObliteratePath, browser_context_->GetPath(),
531 domain_root, paths_to_keep, 531 domain_root, paths_to_keep,
532 base::ThreadTaskRunnerHandle::Get(), on_gc_required)); 532 base::ThreadTaskRunnerHandle::Get(), on_gc_required));
533 } 533 }
534 534
535 void StoragePartitionImplMap::GarbageCollect( 535 void StoragePartitionImplMap::GarbageCollect(
536 scoped_ptr<base::hash_set<base::FilePath> > active_paths, 536 std::unique_ptr<base::hash_set<base::FilePath>> active_paths,
537 const base::Closure& done) { 537 const base::Closure& done) {
538 // Include all paths for current StoragePartitions in the active_paths since 538 // Include all paths for current StoragePartitions in the active_paths since
539 // they cannot be deleted safely. 539 // they cannot be deleted safely.
540 for (PartitionMap::const_iterator it = partitions_.begin(); 540 for (PartitionMap::const_iterator it = partitions_.begin();
541 it != partitions_.end(); 541 it != partitions_.end();
542 ++it) { 542 ++it) {
543 const StoragePartitionConfig& config = it->first; 543 const StoragePartitionConfig& config = it->first;
544 if (!config.in_memory) 544 if (!config.in_memory)
545 active_paths->insert(it->second->GetPath()); 545 active_paths->insert(it->second->GetPath());
546 } 546 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 609
610 // We do not call InitializeURLRequestContext() for media contexts because, 610 // We do not call InitializeURLRequestContext() for media contexts because,
611 // other than the HTTP cache, the media contexts share the same backing 611 // other than the HTTP cache, the media contexts share the same backing
612 // objects as their associated "normal" request context. Thus, the previous 612 // objects as their associated "normal" request context. Thus, the previous
613 // call serves to initialize the media request context for this storage 613 // call serves to initialize the media request context for this storage
614 // partition as well. 614 // partition as well.
615 } 615 }
616 } 616 }
617 617
618 } // namespace content 618 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/storage_partition_impl_map.h ('k') | content/browser/storage_partition_impl_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698