OLD | NEW |
1 // Copyright (c) 2011 The LevelDB Authors. All rights reserved. | 1 // Copyright (c) 2011 The LevelDB 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. See the AUTHORS file for names of contributors. | 3 // found in the LICENSE file. See the AUTHORS file for names of contributors. |
4 | 4 |
5 #include "third_party/leveldatabase/env_chromium.h" | 5 #include "third_party/leveldatabase/env_chromium.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <io.h> | 8 #include <io.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 331 |
332 std::string FilePathToString(const base::FilePath& file_path) { | 332 std::string FilePathToString(const base::FilePath& file_path) { |
333 #if defined(OS_WIN) | 333 #if defined(OS_WIN) |
334 return base::UTF16ToUTF8(file_path.value()); | 334 return base::UTF16ToUTF8(file_path.value()); |
335 #else | 335 #else |
336 return file_path.value(); | 336 return file_path.value(); |
337 #endif | 337 #endif |
338 } | 338 } |
339 | 339 |
340 base::FilePath ChromiumEnv::CreateFilePath(const std::string& file_path) { | 340 base::FilePath ChromiumEnv::CreateFilePath(const std::string& file_path) { |
341 #if defined(OS_WIN) | 341 return base::FilePath::FromUTF8Unsafe(file_path); |
342 return base::FilePath(base::UTF8ToUTF16(file_path)); | |
343 #else | |
344 return base::FilePath(file_path); | |
345 #endif | |
346 } | 342 } |
347 | 343 |
348 bool ChromiumEnv::MakeBackup(const std::string& fname) { | 344 bool ChromiumEnv::MakeBackup(const std::string& fname) { |
349 base::FilePath original_table_name = CreateFilePath(fname); | 345 base::FilePath original_table_name = CreateFilePath(fname); |
350 base::FilePath backup_table_name = | 346 base::FilePath backup_table_name = |
351 original_table_name.ReplaceExtension(backup_table_extension); | 347 original_table_name.ReplaceExtension(backup_table_extension); |
352 return base::CopyFile(original_table_name, backup_table_name); | 348 return base::CopyFile(original_table_name, backup_table_name); |
353 } | 349 } |
354 | 350 |
355 bool ChromiumEnv::HasTableExtension(const base::FilePath& path) { | 351 bool ChromiumEnv::HasTableExtension(const base::FilePath& path) { |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 | 848 |
853 Env* IDBEnv() { | 849 Env* IDBEnv() { |
854 return leveldb_env::idb_env.Pointer(); | 850 return leveldb_env::idb_env.Pointer(); |
855 } | 851 } |
856 | 852 |
857 Env* Env::Default() { | 853 Env* Env::Default() { |
858 return leveldb_env::default_env.Pointer(); | 854 return leveldb_env::default_env.Pointer(); |
859 } | 855 } |
860 | 856 |
861 } // namespace leveldb | 857 } // namespace leveldb |
OLD | NEW |