OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "components/leveldb/env_mojo.h" | 5 #include "components/leveldb/env_mojo.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 | 8 |
| 9 #include <memory> |
| 10 |
9 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
10 #include "third_party/leveldatabase/chromium_logger.h" | 12 #include "third_party/leveldatabase/chromium_logger.h" |
11 #include "third_party/leveldatabase/src/include/leveldb/status.h" | 13 #include "third_party/leveldatabase/src/include/leveldb/status.h" |
12 | 14 |
13 namespace leveldb { | 15 namespace leveldb { |
14 | 16 |
15 namespace { | 17 namespace { |
16 | 18 |
17 const base::FilePath::CharType table_extension[] = FILE_PATH_LITERAL(".ldb"); | 19 const base::FilePath::CharType table_extension[] = FILE_PATH_LITERAL(".ldb"); |
18 | 20 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 // TODO(erg): This method is actually only used from the test harness in | 357 // TODO(erg): This method is actually only used from the test harness in |
356 // leveldb. And when we go and port that test stuff to a mojo apptest, we | 358 // leveldb. And when we go and port that test stuff to a mojo apptest, we |
357 // probably won't use it since the mojo filesystem actually handles temporary | 359 // probably won't use it since the mojo filesystem actually handles temporary |
358 // filesystems just fine. | 360 // filesystems just fine. |
359 NOTREACHED(); | 361 NOTREACHED(); |
360 return Status::OK(); | 362 return Status::OK(); |
361 } | 363 } |
362 | 364 |
363 Status MojoEnv::NewLogger(const std::string& fname, Logger** result) { | 365 Status MojoEnv::NewLogger(const std::string& fname, Logger** result) { |
364 TRACE_EVENT1("leveldb", "MojoEnv::NewLogger", "fname", fname); | 366 TRACE_EVENT1("leveldb", "MojoEnv::NewLogger", "fname", fname); |
365 scoped_ptr<base::File> f(new base::File(thread_->OpenFileHandle( | 367 std::unique_ptr<base::File> f(new base::File(thread_->OpenFileHandle( |
366 dir_, mojo::String::From(fname), | 368 dir_, mojo::String::From(fname), |
367 filesystem::kCreateAlways | filesystem::kFlagWrite))); | 369 filesystem::kCreateAlways | filesystem::kFlagWrite))); |
368 if (!f->IsValid()) { | 370 if (!f->IsValid()) { |
369 *result = NULL; | 371 *result = NULL; |
370 return MakeIOError(fname, "Unable to create log file", | 372 return MakeIOError(fname, "Unable to create log file", |
371 leveldb_env::kNewLogger, f->error_details()); | 373 leveldb_env::kNewLogger, f->error_details()); |
372 } else { | 374 } else { |
373 *result = new leveldb::ChromiumLogger(f.release()); | 375 *result = new leveldb::ChromiumLogger(f.release()); |
374 return Status::OK(); | 376 return Status::OK(); |
375 } | 377 } |
376 } | 378 } |
377 | 379 |
378 } // namespace leveldb | 380 } // namespace leveldb |
OLD | NEW |