| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "app/data_pack.h" | 5 #include "ui/base/resource/data_pack.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/ref_counted_memory.h" | 12 #include "base/ref_counted_memory.h" |
| 13 #include "base/string_piece.h" | 13 #include "base/string_piece.h" |
| 14 | 14 |
| 15 // For details of the file layout, see | 15 // For details of the file layout, see |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // http://crbug.com/58056 | 50 // http://crbug.com/58056 |
| 51 enum LoadErrors { | 51 enum LoadErrors { |
| 52 INIT_FAILED = 1, | 52 INIT_FAILED = 1, |
| 53 BAD_VERSION, | 53 BAD_VERSION, |
| 54 INDEX_TRUNCATED, | 54 INDEX_TRUNCATED, |
| 55 ENTRY_NOT_FOUND, | 55 ENTRY_NOT_FOUND, |
| 56 | 56 |
| 57 LOAD_ERRORS_COUNT, | 57 LOAD_ERRORS_COUNT, |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 } // anonymous namespace | 60 } // namespace |
| 61 | 61 |
| 62 namespace app { | 62 namespace ui { |
| 63 | 63 |
| 64 // In .cc for MemoryMappedFile dtor. | 64 // In .cc for MemoryMappedFile dtor. |
| 65 DataPack::DataPack() : resource_count_(0) { | 65 DataPack::DataPack() : resource_count_(0) { |
| 66 } | 66 } |
| 67 DataPack::~DataPack() { | 67 DataPack::~DataPack() { |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool DataPack::Load(const FilePath& path) { | 70 bool DataPack::Load(const FilePath& path) { |
| 71 mmap_.reset(new file_util::MemoryMappedFile); | 71 mmap_.reset(new file_util::MemoryMappedFile); |
| 72 if (!mmap_->Initialize(path)) { | 72 if (!mmap_->Initialize(path)) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 file_util::CloseFile(file); | 209 file_util::CloseFile(file); |
| 210 return false; | 210 return false; |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 | 213 |
| 214 file_util::CloseFile(file); | 214 file_util::CloseFile(file); |
| 215 | 215 |
| 216 return true; | 216 return true; |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace app | 219 } // namespace ui |
| OLD | NEW |