| 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 <deque> | 5 #include <deque> |
| 6 #include <errno.h> | 6 #include <errno.h> |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 245 |
| 246 class ChromiumFileLock : public FileLock { | 246 class ChromiumFileLock : public FileLock { |
| 247 public: | 247 public: |
| 248 ::base::PlatformFile file_; | 248 ::base::PlatformFile file_; |
| 249 }; | 249 }; |
| 250 | 250 |
| 251 class ChromiumEnv : public Env { | 251 class ChromiumEnv : public Env { |
| 252 public: | 252 public: |
| 253 ChromiumEnv(); | 253 ChromiumEnv(); |
| 254 virtual ~ChromiumEnv() { | 254 virtual ~ChromiumEnv() { |
| 255 NOTREACHED(); | 255 fprintf(stderr, "Destroying Env::Default()\n"); |
| 256 exit(1); |
| 256 } | 257 } |
| 257 | 258 |
| 258 virtual Status NewSequentialFile(const std::string& fname, | 259 virtual Status NewSequentialFile(const std::string& fname, |
| 259 SequentialFile** result) { | 260 SequentialFile** result) { |
| 260 FILE* f = fopen_internal(fname.c_str(), "rb"); | 261 FILE* f = fopen_internal(fname.c_str(), "rb"); |
| 261 if (f == NULL) { | 262 if (f == NULL) { |
| 262 *result = NULL; | 263 *result = NULL; |
| 263 return Status::IOError(fname, strerror(errno)); | 264 return Status::IOError(fname, strerror(errno)); |
| 264 } else { | 265 } else { |
| 265 *result = new ChromiumSequentialFile(fname, f); | 266 *result = new ChromiumSequentialFile(fname, f); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 ::base::LazyInstance<ChromiumEnv>::Leaky | 547 ::base::LazyInstance<ChromiumEnv>::Leaky |
| 547 default_env = LAZY_INSTANCE_INITIALIZER; | 548 default_env = LAZY_INSTANCE_INITIALIZER; |
| 548 | 549 |
| 549 } | 550 } |
| 550 | 551 |
| 551 Env* Env::Default() { | 552 Env* Env::Default() { |
| 552 return default_env.Pointer(); | 553 return default_env.Pointer(); |
| 553 } | 554 } |
| 554 | 555 |
| 555 } | 556 } |
| OLD | NEW |