diff options
author | 2016-07-16 04:46:46 +0000 | |
---|---|---|
committer | 2016-07-16 04:46:46 +0000 | |
commit | 173f435e56acfd0501fc460747572a4796dcffe0 (patch) | |
tree | 5e5716d1b07f229efb78783d26518511539ef5a3 /compiler | |
parent | 161c866ca742049f5c916696e1503c697be30e87 (diff) | |
parent | 43e10b031e3bb42df54adf8f0525a29d2b308a4e (diff) |
Merge "ART: Replace ScopedFd with FdFile"
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/oat_test.cc | 6 | ||||
-rw-r--r-- | compiler/oat_writer.cc | 10 | ||||
-rw-r--r-- | compiler/oat_writer.h | 3 |
3 files changed, 9 insertions, 10 deletions
diff --git a/compiler/oat_test.cc b/compiler/oat_test.cc index 41b19601b9..18ebfeb7f4 100644 --- a/compiler/oat_test.cc +++ b/compiler/oat_test.cc @@ -158,7 +158,7 @@ class OatTest : public CommonCompilerTest { } bool WriteElf(File* file, - ScopedFd&& zip_fd, + File&& zip_fd, const char* location, SafeMap<std::string, std::string>& key_value_store, bool verify) { @@ -708,8 +708,8 @@ void OatTest::TestZipFileInput(bool verify) { { // Test using the AddZipDexFileSource() interface with the zip file handle. - ScopedFd zip_fd(dup(zip_file.GetFd())); - ASSERT_NE(-1, zip_fd.get()); + File zip_fd(dup(zip_file.GetFd()), /* check_usage */ false); + ASSERT_NE(-1, zip_fd.Fd()); ScratchFile oat_file; success = WriteElf(oat_file.GetFile(), diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc index cdc7df11b6..b32199f0a5 100644 --- a/compiler/oat_writer.cc +++ b/compiler/oat_writer.cc @@ -323,14 +323,14 @@ bool OatWriter::AddDexFileSource(const char* filename, DCHECK(write_state_ == WriteState::kAddingDexFileSources); uint32_t magic; std::string error_msg; - ScopedFd fd(OpenAndReadMagic(filename, &magic, &error_msg)); - if (fd.get() == -1) { + File fd = OpenAndReadMagic(filename, &magic, &error_msg); + if (fd.Fd() == -1) { PLOG(ERROR) << "Failed to read magic number from dex file: '" << filename << "'"; return false; } else if (IsDexMagic(magic)) { // The file is open for reading, not writing, so it's OK to let the File destructor // close it without checking for explicit Close(), so pass checkUsage = false. - raw_dex_files_.emplace_back(new File(fd.release(), location, /* checkUsage */ false)); + raw_dex_files_.emplace_back(new File(fd.Release(), location, /* checkUsage */ false)); oat_dex_files_.emplace_back(location, DexFileSource(raw_dex_files_.back().get()), create_type_lookup_table); @@ -346,12 +346,12 @@ bool OatWriter::AddDexFileSource(const char* filename, } // Add dex file source(s) from a zip file specified by a file handle. -bool OatWriter::AddZippedDexFilesSource(ScopedFd&& zip_fd, +bool OatWriter::AddZippedDexFilesSource(File&& zip_fd, const char* location, CreateTypeLookupTable create_type_lookup_table) { DCHECK(write_state_ == WriteState::kAddingDexFileSources); std::string error_msg; - zip_archives_.emplace_back(ZipArchive::OpenFromFd(zip_fd.release(), location, &error_msg)); + zip_archives_.emplace_back(ZipArchive::OpenFromFd(zip_fd.Release(), location, &error_msg)); ZipArchive* zip_archive = zip_archives_.back().get(); if (zip_archive == nullptr) { LOG(ERROR) << "Failed to open zip from file descriptor for '" << location << "': " diff --git a/compiler/oat_writer.h b/compiler/oat_writer.h index cc81f39f36..decb7dbc26 100644 --- a/compiler/oat_writer.h +++ b/compiler/oat_writer.h @@ -29,7 +29,6 @@ #include "oat.h" #include "os.h" #include "safe_map.h" -#include "ScopedFd.h" #include "utils/array_ref.h" namespace art { @@ -132,7 +131,7 @@ class OatWriter { CreateTypeLookupTable create_type_lookup_table = CreateTypeLookupTable::kDefault); // Add dex file source(s) from a zip file specified by a file handle. bool AddZippedDexFilesSource( - ScopedFd&& zip_fd, + File&& zip_fd, const char* location, CreateTypeLookupTable create_type_lookup_table = CreateTypeLookupTable::kDefault); // Add dex file source from raw memory. |