| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include <dirent.h> | 7 #include <dirent.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <fnmatch.h> | 10 #include <fnmatch.h> |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 } | 626 } |
| 627 | 627 |
| 628 bool MemoryMappedFile::MapFileToMemory(const FilePath& file_name) { | 628 bool MemoryMappedFile::MapFileToMemory(const FilePath& file_name) { |
| 629 file_ = -1; | 629 file_ = -1; |
| 630 #if defined(OS_LINUX) | 630 #if defined(OS_LINUX) |
| 631 base::ZygoteManager* zm = base::ZygoteManager::Get(); | 631 base::ZygoteManager* zm = base::ZygoteManager::Get(); |
| 632 if (zm) { | 632 if (zm) { |
| 633 file_ = zm->OpenFile(file_name.value().c_str()); | 633 file_ = zm->OpenFile(file_name.value().c_str()); |
| 634 if (file_ == -1) { | 634 if (file_ == -1) { |
| 635 LOG(INFO) << "Zygote manager can't open " << file_name.value() | 635 LOG(INFO) << "Zygote manager can't open " << file_name.value() |
| 636 << ", retrying locally"; | 636 << ", retrying locally. (OK at start of ui_tests.)"; |
| 637 } | 637 } |
| 638 } | 638 } |
| 639 #endif // defined(OS_LINUX) | 639 #endif // defined(OS_LINUX) |
| 640 if (file_ == -1) | 640 if (file_ == -1) |
| 641 file_ = open(file_name.value().c_str(), O_RDONLY); | 641 file_ = open(file_name.value().c_str(), O_RDONLY); |
| 642 if (file_ == -1) { | 642 if (file_ == -1) { |
| 643 LOG(ERROR) << "Couldn't open " << file_name.value(); | 643 LOG(ERROR) << "Couldn't open " << file_name.value(); |
| 644 return false; | 644 return false; |
| 645 } | 645 } |
| 646 | 646 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 664 munmap(data_, length_); | 664 munmap(data_, length_); |
| 665 if (file_ != -1) | 665 if (file_ != -1) |
| 666 close(file_); | 666 close(file_); |
| 667 | 667 |
| 668 data_ = NULL; | 668 data_ = NULL; |
| 669 length_ = 0; | 669 length_ = 0; |
| 670 file_ = -1; | 670 file_ = -1; |
| 671 } | 671 } |
| 672 | 672 |
| 673 } // namespace file_util | 673 } // namespace file_util |
| OLD | NEW |