Commit f5d5aff9 authored by Olivier Yiptong's avatar Olivier Yiptong Committed by Commit Bot

[Native File System] Atomic Writes review changes

Adding review changes from https://chromium-review.googlesource.com/c/chromium/src/+/1692325
I prematurely hit the submit button.

Bug: 968550
Change-Id: I52b85c70d5b47845a60398d1c453a118e1be5a6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1726660Reviewed-by: default avatarMarijn Kruisselbrink <mek@chromium.org>
Commit-Queue: Olivier Yiptong <oyiptong@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682557}
parent 98ccf8be
...@@ -156,8 +156,7 @@ void NativeFileSystemFileHandleImpl::CreateFileWriterImpl( ...@@ -156,8 +156,7 @@ void NativeFileSystemFileHandleImpl::CreateFileWriterImpl(
auto base_swap_path = auto base_swap_path =
base::FilePath(url().path()).AddExtensionASCII(".crswap"); base::FilePath(url().path()).AddExtensionASCII(".crswap");
CreateSwapFile( CreateSwapFile(
/*count=*/0, std::move(base_swap_path), keep_existing_data, /*count=*/0, base_swap_path, keep_existing_data, std::move(callback));
std::move(callback));
} }
void NativeFileSystemFileHandleImpl::CreateSwapFile( void NativeFileSystemFileHandleImpl::CreateSwapFile(
......
...@@ -89,6 +89,9 @@ class CONTENT_EXPORT NativeFileSystemFileWriterImpl ...@@ -89,6 +89,9 @@ class CONTENT_EXPORT NativeFileSystemFileWriterImpl
kClosed, kClosed,
}; };
bool is_closed() const { return state_ != State::kOpen; } bool is_closed() const { return state_ != State::kOpen; }
// Returns whether the File Writer is in a state where any files can be
// deleted. We do not want to delete the files if there are clean-up
// operations in-flight.
bool can_purge() const { bool can_purge() const {
return state_ == State::kOpen || state_ == State::kCloseError; return state_ == State::kOpen || state_ == State::kCloseError;
} }
......
...@@ -285,7 +285,8 @@ void NativeFileSystemWriter::CloseComplete( ...@@ -285,7 +285,8 @@ void NativeFileSystemWriter::CloseComplete(
} }
file_ = nullptr; file_ = nullptr;
pending_operation_ = nullptr; pending_operation_ = nullptr;
// Closes the mojo pipe. Subsequent operations will fail. // We close the mojo pipe because we intend this writer to be discarded after
// close. Subsequent operations will fail.
mojo_ptr_ = nullptr; mojo_ptr_ = nullptr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment