OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ | 5 #ifndef THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ |
6 #define THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ | 6 #define THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "base/files/file.h" | 12 #include "base/files/file.h" |
11 #include "base/format_macros.h" | 13 #include "base/format_macros.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
15 #include "third_party/leveldatabase/src/include/leveldb/env.h" | 16 #include "third_party/leveldatabase/src/include/leveldb/env.h" |
16 | 17 |
17 namespace leveldb { | 18 namespace leveldb { |
18 | 19 |
19 class ChromiumLogger : public Logger { | 20 class ChromiumLogger : public Logger { |
20 public: | 21 public: |
21 explicit ChromiumLogger(base::File* f) : file_(f) {} | 22 explicit ChromiumLogger(base::File* f) : file_(f) {} |
22 virtual ~ChromiumLogger() {} | 23 virtual ~ChromiumLogger() {} |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 assert(p <= limit); | 79 assert(p <= limit); |
79 file_->WriteAtCurrentPos(base, p - base); | 80 file_->WriteAtCurrentPos(base, p - base); |
80 if (base != buffer) { | 81 if (base != buffer) { |
81 delete[] base; | 82 delete[] base; |
82 } | 83 } |
83 break; | 84 break; |
84 } | 85 } |
85 } | 86 } |
86 | 87 |
87 private: | 88 private: |
88 scoped_ptr<base::File> file_; | 89 std::unique_ptr<base::File> file_; |
89 }; | 90 }; |
90 | 91 |
91 } // namespace leveldb | 92 } // namespace leveldb |
92 | 93 |
93 #endif // THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ | 94 #endif // THIRD_PARTY_LEVELDATABASE_CHROMIUM_LOGGER_H_ |
OLD | NEW |