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

Unified Diff: third_party/leveldatabase/chromium_logger.h

Issue 710373002: LevelDB: Using base::File for all file I/O (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment for GetDirectoryEntries, using ReadAtCurrentPosNoBestEffort Created 6 years, 1 month 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 | « third_party/leveldatabase/README.chromium ('k') | third_party/leveldatabase/env_chromium.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/leveldatabase/chromium_logger.h
diff --git a/third_party/leveldatabase/chromium_logger.h b/third_party/leveldatabase/chromium_logger.h
index 2967abc61ee7bb2a3ae6ab4c72a6a7de0a60c736..649b19e0db211cf2d34ccc0791974260ba27b3f9 100644
--- a/third_party/leveldatabase/chromium_logger.h
+++ b/third_party/leveldatabase/chromium_logger.h
@@ -5,10 +5,7 @@
#ifndef THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_
#define THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_
-#include <stdio.h>
-
-#include <algorithm>
-
+#include "base/files/file.h"
#include "base/format_macros.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
@@ -18,10 +15,8 @@ namespace leveldb {
class ChromiumLogger : public Logger {
public:
- explicit ChromiumLogger(FILE* f) : file_(f) {}
- virtual ~ChromiumLogger() {
- fclose(file_);
- }
+ explicit ChromiumLogger(base::File* f) : file_(f) {}
+ virtual ~ChromiumLogger() {}
virtual void Logv(const char* format, va_list ap) {
const base::PlatformThreadId thread_id =
::base::PlatformThread::CurrentId();
@@ -79,8 +74,7 @@ class ChromiumLogger : public Logger {
}
assert(p <= limit);
- fwrite(base, 1, p - base, file_);
- fflush(file_);
+ file_->WriteAtCurrentPos(base, p - base);
if (base != buffer) {
delete[] base;
}
@@ -89,7 +83,7 @@ class ChromiumLogger : public Logger {
}
private:
- FILE* file_;
+ scoped_ptr<base::File> file_;
};
} // namespace leveldb
« no previous file with comments | « third_party/leveldatabase/README.chromium ('k') | third_party/leveldatabase/env_chromium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698