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

Side by Side Diff: components/filesystem/file_system_impl.cc

Issue 1918083002: Convert //components/[f-n]* 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/filesystem/file_system_impl.h" 5 #include "components/filesystem/file_system_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8
9 #include <memory>
8 #include <utility> 10 #include <utility>
9 11
10 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
12 #include "base/files/scoped_file.h" 14 #include "base/files/scoped_file.h"
13 #include "base/files/scoped_temp_dir.h" 15 #include "base/files/scoped_temp_dir.h"
14 #include "base/logging.h" 16 #include "base/logging.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "build/build_config.h" 17 #include "build/build_config.h"
17 #include "components/filesystem/directory_impl.h" 18 #include "components/filesystem/directory_impl.h"
18 #include "components/filesystem/lock_table.h" 19 #include "components/filesystem/lock_table.h"
19 #include "services/shell/public/cpp/connection.h" 20 #include "services/shell/public/cpp/connection.h"
20 #include "url/gurl.h" 21 #include "url/gurl.h"
21 22
22 namespace filesystem { 23 namespace filesystem {
23 24
24 FileSystemImpl::FileSystemImpl(shell::Connection* connection, 25 FileSystemImpl::FileSystemImpl(shell::Connection* connection,
25 FileSystemRequest request, 26 FileSystemRequest request,
26 base::FilePath persistent_dir, 27 base::FilePath persistent_dir,
27 scoped_refptr<LockTable> lock_table) 28 scoped_refptr<LockTable> lock_table)
28 : remote_application_name_(connection->GetRemoteIdentity().name()), 29 : remote_application_name_(connection->GetRemoteIdentity().name()),
29 binding_(this, std::move(request)), 30 binding_(this, std::move(request)),
30 lock_table_(std::move(lock_table)), 31 lock_table_(std::move(lock_table)),
31 persistent_dir_(persistent_dir) {} 32 persistent_dir_(persistent_dir) {}
32 33
33 FileSystemImpl::~FileSystemImpl() { 34 FileSystemImpl::~FileSystemImpl() {
34 } 35 }
35 36
36 void FileSystemImpl::OpenTempDirectory( 37 void FileSystemImpl::OpenTempDirectory(
37 mojo::InterfaceRequest<Directory> directory, 38 mojo::InterfaceRequest<Directory> directory,
38 const OpenTempDirectoryCallback& callback) { 39 const OpenTempDirectoryCallback& callback) {
39 // Set only if the |DirectoryImpl| will own a temporary directory. 40 // Set only if the |DirectoryImpl| will own a temporary directory.
40 scoped_ptr<base::ScopedTempDir> temp_dir(new base::ScopedTempDir); 41 std::unique_ptr<base::ScopedTempDir> temp_dir(new base::ScopedTempDir);
41 CHECK(temp_dir->CreateUniqueTempDir()); 42 CHECK(temp_dir->CreateUniqueTempDir());
42 43
43 base::FilePath path = temp_dir->path(); 44 base::FilePath path = temp_dir->path();
44 new DirectoryImpl( 45 new DirectoryImpl(
45 std::move(directory), path, std::move(temp_dir), lock_table_); 46 std::move(directory), path, std::move(temp_dir), lock_table_);
46 callback.Run(FileError::OK); 47 callback.Run(FileError::OK);
47 } 48 }
48 49
49 void FileSystemImpl::OpenPersistentFileSystem( 50 void FileSystemImpl::OpenPersistentFileSystem(
50 mojo::InterfaceRequest<Directory> directory, 51 mojo::InterfaceRequest<Directory> directory,
51 const OpenPersistentFileSystemCallback& callback) { 52 const OpenPersistentFileSystemCallback& callback) {
52 scoped_ptr<base::ScopedTempDir> temp_dir; 53 std::unique_ptr<base::ScopedTempDir> temp_dir;
53 base::FilePath path = persistent_dir_; 54 base::FilePath path = persistent_dir_;
54 if (!base::PathExists(path)) 55 if (!base::PathExists(path))
55 base::CreateDirectory(path); 56 base::CreateDirectory(path);
56 57
57 new DirectoryImpl( 58 new DirectoryImpl(
58 std::move(directory), path, std::move(temp_dir), lock_table_); 59 std::move(directory), path, std::move(temp_dir), lock_table_);
59 callback.Run(FileError::OK); 60 callback.Run(FileError::OK);
60 } 61 }
61 62
62 } // namespace filesystem 63 } // namespace filesystem
OLDNEW
« no previous file with comments | « components/filesystem/file_system_app.cc ('k') | components/filesystem/public/cpp/prefs/filesystem_json_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698