| 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     fprintf(stderr, "Destroying Env::Default()\n"); | 255     NOTREACHED(); | 
| 256     exit(1); |  | 
| 257   } | 256   } | 
| 258 | 257 | 
| 259   virtual Status NewSequentialFile(const std::string& fname, | 258   virtual Status NewSequentialFile(const std::string& fname, | 
| 260                                    SequentialFile** result) { | 259                                    SequentialFile** result) { | 
| 261     FILE* f = fopen_internal(fname.c_str(), "rb"); | 260     FILE* f = fopen_internal(fname.c_str(), "rb"); | 
| 262     if (f == NULL) { | 261     if (f == NULL) { | 
| 263       *result = NULL; | 262       *result = NULL; | 
| 264       return Status::IOError(fname, strerror(errno)); | 263       return Status::IOError(fname, strerror(errno)); | 
| 265     } else { | 264     } else { | 
| 266       *result = new ChromiumSequentialFile(fname, f); | 265       *result = new ChromiumSequentialFile(fname, f); | 
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 547 ::base::LazyInstance<ChromiumEnv>::Leaky | 546 ::base::LazyInstance<ChromiumEnv>::Leaky | 
| 548     default_env = LAZY_INSTANCE_INITIALIZER; | 547     default_env = LAZY_INSTANCE_INITIALIZER; | 
| 549 | 548 | 
| 550 } | 549 } | 
| 551 | 550 | 
| 552 Env* Env::Default() { | 551 Env* Env::Default() { | 
| 553   return default_env.Pointer(); | 552   return default_env.Pointer(); | 
| 554 } | 553 } | 
| 555 | 554 | 
| 556 } | 555 } | 
| OLD | NEW | 
|---|