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

Unified Diff: chrome/browser/chromeos/drive/file_system/truncate_operation.cc

Issue 211483004: Remove some PlatformFile instances from ChromeOS Drive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change FileStream destruction logic Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/drive/file_system/truncate_operation.cc
diff --git a/chrome/browser/chromeos/drive/file_system/truncate_operation.cc b/chrome/browser/chromeos/drive/file_system/truncate_operation.cc
index 2659760b723285d1cfee84a46a18364745a65b06..da64092c3e4d67913409e8ee7144e9f8441afc08 100644
--- a/chrome/browser/chromeos/drive/file_system/truncate_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/truncate_operation.cc
@@ -6,11 +6,10 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
-#include "base/files/scoped_platform_file_closer.h"
#include "base/logging.h"
#include "base/message_loop/message_loop_proxy.h"
-#include "base/platform_file.h"
#include "base/sequenced_task_runner.h"
#include "base/task_runner_util.h"
#include "chrome/browser/chromeos/drive/drive.pb.h"
@@ -42,19 +41,12 @@ FileError TruncateOnBlockingPool(internal::ResourceMetadata* metadata,
if (error != FILE_ERROR_OK)
return error;
- base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED;
- base::PlatformFile file = base::CreatePlatformFile(
- local_cache_path,
- base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE,
- NULL,
- &result);
- if (result != base::PLATFORM_FILE_OK)
+ base::File file(local_cache_path,
+ base::File::FLAG_OPEN | base::File::FLAG_WRITE);
+ if (!file.IsValid())
return FILE_ERROR_FAILED;
- DCHECK_NE(base::kInvalidPlatformFileValue, file);
- base::ScopedPlatformFileCloser platform_file_closer(&file);
-
- if (!base::TruncatePlatformFile(file, length))
+ if (!file.SetLength(length))
return FILE_ERROR_FAILED;
return FILE_ERROR_OK;
« no previous file with comments | « chrome/browser/chromeos/drive/drive_file_stream_reader.cc ('k') | chrome/browser/chromeos/drive/local_file_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698