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

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

Issue 1995753002: [mojo-edk] Expose portable API for platform handle wrapping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits 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 | « no previous file | components/filesystem/file_impl.cc » ('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/directory_impl.h" 5 #include "components/filesystem/directory_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "components/filesystem/file_impl.h" 15 #include "components/filesystem/file_impl.h"
16 #include "components/filesystem/lock_table.h" 16 #include "components/filesystem/lock_table.h"
17 #include "components/filesystem/util.h" 17 #include "components/filesystem/util.h"
18 #include "mojo/common/common_type_converters.h" 18 #include "mojo/common/common_type_converters.h"
19 #include "mojo/platform_handle/platform_handle_functions.h" 19 #include "mojo/public/cpp/system/platform_handle.h"
20 20
21 namespace filesystem { 21 namespace filesystem {
22 22
23 DirectoryImpl::DirectoryImpl(mojo::InterfaceRequest<mojom::Directory> request, 23 DirectoryImpl::DirectoryImpl(mojo::InterfaceRequest<mojom::Directory> request,
24 base::FilePath directory_path, 24 base::FilePath directory_path,
25 scoped_refptr<SharedTempDir> temp_dir, 25 scoped_refptr<SharedTempDir> temp_dir,
26 scoped_refptr<LockTable> lock_table) 26 scoped_refptr<LockTable> lock_table)
27 : binding_(this, std::move(request)), 27 : binding_(this, std::move(request)),
28 directory_path_(directory_path), 28 directory_path_(directory_path),
29 temp_dir_(std::move(temp_dir)), 29 temp_dir_(std::move(temp_dir)),
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 *error = mojom::FileError::NOT_A_FILE; 345 *error = mojom::FileError::NOT_A_FILE;
346 return mojo::ScopedHandle(); 346 return mojo::ScopedHandle();
347 } 347 }
348 348
349 base::File base_file(path, open_flags); 349 base::File base_file(path, open_flags);
350 if (!base_file.IsValid()) { 350 if (!base_file.IsValid()) {
351 *error = GetError(base_file); 351 *error = GetError(base_file);
352 return mojo::ScopedHandle(); 352 return mojo::ScopedHandle();
353 } 353 }
354 354
355 MojoHandle mojo_handle;
356 MojoResult create_result = MojoCreatePlatformHandleWrapper(
357 base_file.TakePlatformFile(), &mojo_handle);
358 if (create_result != MOJO_RESULT_OK) {
359 *error = mojom::FileError::FAILED;
360 return mojo::ScopedHandle();
361 }
362
363 *error = mojom::FileError::OK; 355 *error = mojom::FileError::OK;
364 return mojo::ScopedHandle(mojo::Handle(mojo_handle)); 356 return mojo::WrapPlatformFile(base_file.TakePlatformFile());
365 } 357 }
366 358
367 } // namespace filesystem 359 } // namespace filesystem
OLDNEW
« no previous file with comments | « no previous file | components/filesystem/file_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698