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

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

Issue 1935863002: mojo: Fix leveldb unittests by making fs::Directories cloneable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Gyp continues to exist. Created 4 years, 7 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 | « components/filesystem/file_system_impl.h ('k') | components/filesystem/filesystem.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 36
37 void FileSystemImpl::OpenTempDirectory( 37 void FileSystemImpl::OpenTempDirectory(
38 mojo::InterfaceRequest<Directory> directory, 38 mojo::InterfaceRequest<Directory> directory,
39 const OpenTempDirectoryCallback& callback) { 39 const OpenTempDirectoryCallback& callback) {
40 // Set only if the |DirectoryImpl| will own a temporary directory. 40 // Set only if the |DirectoryImpl| will own a temporary directory.
41 std::unique_ptr<base::ScopedTempDir> temp_dir(new base::ScopedTempDir); 41 std::unique_ptr<base::ScopedTempDir> temp_dir(new base::ScopedTempDir);
42 CHECK(temp_dir->CreateUniqueTempDir()); 42 CHECK(temp_dir->CreateUniqueTempDir());
43 43
44 base::FilePath path = temp_dir->path(); 44 base::FilePath path = temp_dir->path();
45 scoped_refptr<SharedTempDir> shared_temp_dir =
46 new SharedTempDir(std::move(temp_dir));
45 new DirectoryImpl( 47 new DirectoryImpl(
46 std::move(directory), path, std::move(temp_dir), lock_table_); 48 std::move(directory), path, std::move(shared_temp_dir), lock_table_);
47 callback.Run(FileError::OK); 49 callback.Run(FileError::OK);
48 } 50 }
49 51
50 void FileSystemImpl::OpenPersistentFileSystem( 52 void FileSystemImpl::OpenPersistentFileSystem(
51 mojo::InterfaceRequest<Directory> directory, 53 mojo::InterfaceRequest<Directory> directory,
52 const OpenPersistentFileSystemCallback& callback) { 54 const OpenPersistentFileSystemCallback& callback) {
53 std::unique_ptr<base::ScopedTempDir> temp_dir; 55 std::unique_ptr<base::ScopedTempDir> temp_dir;
54 base::FilePath path = persistent_dir_; 56 base::FilePath path = persistent_dir_;
55 if (!base::PathExists(path)) 57 if (!base::PathExists(path))
56 base::CreateDirectory(path); 58 base::CreateDirectory(path);
57 59
60 scoped_refptr<SharedTempDir> shared_temp_dir =
61 new SharedTempDir(std::move(temp_dir));
62
58 new DirectoryImpl( 63 new DirectoryImpl(
59 std::move(directory), path, std::move(temp_dir), lock_table_); 64 std::move(directory), path, std::move(shared_temp_dir), lock_table_);
60 callback.Run(FileError::OK); 65 callback.Run(FileError::OK);
61 } 66 }
62 67
63 } // namespace filesystem 68 } // namespace filesystem
OLDNEW
« no previous file with comments | « components/filesystem/file_system_impl.h ('k') | components/filesystem/filesystem.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698