| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/file_util.h" | 5 #include "base/file_util.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 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 #if defined(OS_WIN) | 261 #if defined(OS_WIN) |
| 262 LARGE_INTEGER li = { info.nFileSizeLow, info.nFileSizeHigh }; | 262 LARGE_INTEGER li = { info.nFileSizeLow, info.nFileSizeHigh }; |
| 263 running_size += li.QuadPart; | 263 running_size += li.QuadPart; |
| 264 #else | 264 #else |
| 265 running_size += info.stat.st_size; | 265 running_size += info.stat.st_size; |
| 266 #endif | 266 #endif |
| 267 } | 267 } |
| 268 return running_size; | 268 return running_size; |
| 269 } | 269 } |
| 270 | 270 |
| 271 int64 ComputeFilesSize(const FilePath& directory, |
| 272 const FilePath::StringType& pattern) { |
| 273 int64 running_size = 0; |
| 274 FileEnumerator file_iter(directory, false, FileEnumerator::FILES, pattern); |
| 275 for (FilePath current = file_iter.Next(); !current.empty(); |
| 276 current = file_iter.Next()) { |
| 277 FileEnumerator::FindInfo info; |
| 278 file_iter.GetFindInfo(&info); |
| 279 #if defined(OS_WIN) |
| 280 LARGE_INTEGER li = { info.nFileSizeLow, info.nFileSizeHigh }; |
| 281 running_size += li.QuadPart; |
| 282 #else |
| 283 running_size += info.stat.st_size; |
| 284 #endif |
| 285 } |
| 286 return running_size; |
| 287 } |
| 288 |
| 271 /////////////////////////////////////////////// | 289 /////////////////////////////////////////////// |
| 272 // MemoryMappedFile | 290 // MemoryMappedFile |
| 273 | 291 |
| 274 MemoryMappedFile::~MemoryMappedFile() { | 292 MemoryMappedFile::~MemoryMappedFile() { |
| 275 CloseHandles(); | 293 CloseHandles(); |
| 276 } | 294 } |
| 277 | 295 |
| 278 bool MemoryMappedFile::Initialize(base::PlatformFile file) { | 296 bool MemoryMappedFile::Initialize(base::PlatformFile file) { |
| 279 if (IsValid()) | 297 if (IsValid()) |
| 280 return false; | 298 return false; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 // FileEnumerator | 423 // FileEnumerator |
| 406 // | 424 // |
| 407 // Note: the main logic is in file_util_<platform>.cc | 425 // Note: the main logic is in file_util_<platform>.cc |
| 408 | 426 |
| 409 bool FileEnumerator::ShouldSkip(const FilePath& path) { | 427 bool FileEnumerator::ShouldSkip(const FilePath& path) { |
| 410 FilePath::StringType basename = path.BaseName().value(); | 428 FilePath::StringType basename = path.BaseName().value(); |
| 411 return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_)); | 429 return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_)); |
| 412 } | 430 } |
| 413 | 431 |
| 414 } // namespace | 432 } // namespace |
| OLD | NEW |