| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "storage/browser/fileapi/sandbox_prioritized_origin_database.h" | 5 #include "storage/browser/fileapi/sandbox_prioritized_origin_database.h" |
| 6 | 6 |
| 7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 return true; | 37 return true; |
| 38 } | 38 } |
| 39 | 39 |
| 40 bool ReadPrimaryOriginFile(const base::FilePath& path, | 40 bool ReadPrimaryOriginFile(const base::FilePath& path, |
| 41 std::string* origin) { | 41 std::string* origin) { |
| 42 std::string buffer; | 42 std::string buffer; |
| 43 if (!base::ReadFileToString(path, &buffer)) | 43 if (!base::ReadFileToString(path, &buffer)) |
| 44 return false; | 44 return false; |
| 45 Pickle pickle(buffer.data(), buffer.size()); | 45 Pickle pickle(buffer.data(), buffer.size()); |
| 46 PickleIterator iter(pickle); | 46 PickleIterator iter(pickle); |
| 47 return iter.ReadString(origin) && !origin->empty(); | 47 return pickle.ReadString(&iter, origin) && !origin->empty(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 SandboxPrioritizedOriginDatabase::SandboxPrioritizedOriginDatabase( | 52 SandboxPrioritizedOriginDatabase::SandboxPrioritizedOriginDatabase( |
| 53 const base::FilePath& file_system_directory, | 53 const base::FilePath& file_system_directory, |
| 54 leveldb::Env* env_override) | 54 leveldb::Env* env_override) |
| 55 : file_system_directory_(file_system_directory), | 55 : file_system_directory_(file_system_directory), |
| 56 env_override_(env_override), | 56 env_override_(env_override), |
| 57 primary_origin_file_( | 57 primary_origin_file_( |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 SandboxOriginDatabase* | 219 SandboxOriginDatabase* |
| 220 SandboxPrioritizedOriginDatabase::GetSandboxOriginDatabase() { | 220 SandboxPrioritizedOriginDatabase::GetSandboxOriginDatabase() { |
| 221 MaybeInitializeNonPrimaryDatabase(true); | 221 MaybeInitializeNonPrimaryDatabase(true); |
| 222 return origin_database_.get(); | 222 return origin_database_.get(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace storage | 225 } // namespace storage |
| OLD | NEW |