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

Unified Diff: webkit/browser/fileapi/sandbox_prioritized_origin_database.cc

Issue 167403002: Remove some PlatformFile uses from WebKit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
« no previous file with comments | « webkit/browser/fileapi/sandbox_origin_database_unittest.cc ('k') | webkit/browser/fileapi/test_file_set.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/browser/fileapi/sandbox_prioritized_origin_database.cc
diff --git a/webkit/browser/fileapi/sandbox_prioritized_origin_database.cc b/webkit/browser/fileapi/sandbox_prioritized_origin_database.cc
index a17ba957d9fbd0ec3c356373382d7b25502cc3ff..55ce362a9b1d80da027708da030c867d919ed7c6 100644
--- a/webkit/browser/fileapi/sandbox_prioritized_origin_database.cc
+++ b/webkit/browser/fileapi/sandbox_prioritized_origin_database.cc
@@ -5,11 +5,10 @@
#include "webkit/browser/fileapi/sandbox_prioritized_origin_database.h"
#include "base/file_util.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/pickle.h"
-#include "base/platform_file.h"
#include "webkit/browser/fileapi/sandbox_isolated_origin_database.h"
#include "webkit/browser/fileapi/sandbox_origin_database.h"
@@ -24,23 +23,15 @@ const base::FilePath::CharType kPrimaryOriginFile[] =
bool WritePrimaryOriginFile(const base::FilePath& path,
const std::string& origin) {
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
- bool created;
- base::PlatformFile file = base::CreatePlatformFile(
- path,
- base::PLATFORM_FILE_OPEN_ALWAYS |
- base::PLATFORM_FILE_WRITE,
- &created, &error);
- base::ScopedPlatformFileCloser closer(&file);
- if (error != base::PLATFORM_FILE_OK ||
- file == base::kInvalidPlatformFileValue)
+ base::File file(path, base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_WRITE);
+ if (!file.IsValid())
return false;
- base::TruncatePlatformFile(file, 0);
+ if (!file.created())
+ file.SetLength(0);
Pickle pickle;
pickle.WriteString(origin);
- base::WritePlatformFile(file, 0, static_cast<const char*>(pickle.data()),
- pickle.size());
- base::FlushPlatformFile(file);
+ file.Write(0, static_cast<const char*>(pickle.data()), pickle.size());
+ file.Flush();
return true;
}
« no previous file with comments | « webkit/browser/fileapi/sandbox_origin_database_unittest.cc ('k') | webkit/browser/fileapi/test_file_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698