diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-14 05:37:08 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-14 05:37:08 +0000 |
commit | face3686c641e6d055c424a55a29d0f562a4110a (patch) | |
tree | 29f9eae2bc0c9c65a16924e3d5a330f6257579be /net/test | |
parent | 523e42f663d1b5f8766103c567287f3b33fb7508 (diff) | |
download | chromium_src-face3686c641e6d055c424a55a29d0f562a4110a.zip chromium_src-face3686c641e6d055c424a55a29d0f562a4110a.tar.gz chromium_src-face3686c641e6d055c424a55a29d0f562a4110a.tar.bz2 |
Revert of Implement ScopedFD in terms of ScopedGeneric. (https://codereview.chromium.org/191673003/)
Reason for revert:
Doesn't build on android:
FAILED: /mnt/data/b/build/goma/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/base/memory/base.discardable_memory_allocator_android.o.d -DV8_DEPRECATION_WARNINGS -DBLINK_SCALE_FILTERS_AT_RECORD_TIME -D_FILE_OFFSET_BITS=64 -DNO_TCMALLOC -DDISABLE_NACL -DCHROMIUM_BUILD -DCOMPONENT_BUILD -DUSE_LIBJPEG_TURBO=1 -DENABLE_WEBRTC=1 -DUSE_PROPRIETARY_CODECS -DENABLE_CONFIGURATION_POLICY -DENABLE_NEW_GAMEPAD_API=1 -DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY -DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DENABLE_EGLIMAGE=1 -DENABLE_AUTOFILL_DIALOG=1 -DCLD_VERSION=1 -DENABLE_PRINTING=1 -DENABLE_MANAGED_USERS=1 -DUSE_OPENSSL=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DBASE_IMPLEMENTATION -DANDROID -D__GNU_SOURCE=1 -DUSE_STLPORT=1 -D_STLP_USE_PTR_SPECIALIZATIONS=1 '-DCHROME_BUILD_ID=""' -DHAVE_SYS_UIO_H -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -D_DEBUG -Igen/base -I../../third_party/android_tools/ndk/sources/android/cpufeatures -I../.. -fstack-protector --param=ssp-buffer-size=4 -Werror -fno-exceptions -fno-strict-aliasing -Wall -Wno-unused-parameter -Wno-missing-field-initializers -fvisibility=hidden -pipe -fPIC -Wheader-hygiene -Wno-char-subscripts -Wno-unneeded-internal-declaration -Wno-covered-switch-default -Wstring-conversion -Wno-c++11-narrowing -Wno-reserved-user-defined-literal -Wno-deprecated-register -Xclang -load -Xclang /mnt/data/b/build/slave/Android_Clang_Builder__dbg_/build/src/tools/clang/scripts/../../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-url-directory -fcolor-diagnostics -Wexit-time-destructors -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -mthumb -no-integrated-as -B/mnt/data/b/build/slave/Android_Clang_Builder__dbg_/build/src/third_party/android_tools/ndk//toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin -ffunction-sections -funwind-tables -g -fstack-protector -fno-short-enums -Wa,--noexecstack -D__compiler_offsetof=__builtin_offsetof -Dnan=__builtin_nan -target arm-linux-androideabi -mllvm -arm-enable-ehabi --sysroot=/mnt/data/b/build/slave/Android_Clang_Builder__dbg_/build/src/third_party/android_tools/ndk//platforms/android-14/arch-arm -I/mnt/data/b/build/slave/Android_Clang_Builder__dbg_/build/src/third_party/android_tools/ndk//sources/cxx-stl/stlport/stlport -Os -g -fomit-frame-pointer -fdata-sections -ffunction-sections -funwind-tables -g0 -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -Wsign-compare -std=gnu++11 -Wno-implicit-exception-spec-mismatch -Wno-abi -c ../../base/memory/discardable_memory_allocator_android.cc -o obj/base/memory/base.discardable_memory_allocator_android.o
../../base/memory/discardable_memory_allocator_android.cc:84:25:error: no matching function for call to 'mmap'
void* const address = mmap(
^~~~
/mnt/data/b/build/slave/Android_Clang_Builder__dbg_/build/src/third_party/android_tools/ndk//platforms/android-14/arch-arm/usr/include/sys/mman.h:47:15: note: candidate function not viable: no known conversion from 'base::ScopedFD' (aka 'ScopedGeneric<int, internal::ScopedFDCloseTraits>') to 'int' for 5th argument
extern void* mmap(void *, size_t, int, int, int, off_t);
^
1 error generated.
Original issue's description:
> Implement ScopedFD in terms of ScopedGeneric.
>
> Move to a new file base/files/scoped_file.h. I will also add ScopedFILE to here (currently in file_util.h) later.
>
> I think there is a crash in the old code in content/browser/zygote_host/zygote_host_impl_linux.cc that this patch should fix. The old ScopedFD took the address of something in a vector that is being modified.
>
> I removed SafeScopedFD from content/common/sandbox_linux/sandbox_linux.cc since base's ScopedFD not CHECKs on close failure (this is a more recent addition).
>
> BUG=
> R=agl@chromium.org, viettrungluu@chromium.org
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=257001
TBR=viettrungluu@chromium.org,agl@chromium.org,brettw@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=
Review URL: https://codereview.chromium.org/197873014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257005 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/test')
-rw-r--r-- | net/test/spawned_test_server/local_test_server.h | 4 | ||||
-rw-r--r-- | net/test/spawned_test_server/local_test_server_posix.cc | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/net/test/spawned_test_server/local_test_server.h b/net/test/spawned_test_server/local_test_server.h index d916835..cfd2eb3 100644 --- a/net/test/spawned_test_server/local_test_server.h +++ b/net/test/spawned_test_server/local_test_server.h @@ -8,7 +8,6 @@ #include <string> #include "base/file_util.h" -#include "base/files/scoped_file.h" #include "base/process/process_handle.h" #include "net/test/spawned_test_server/base_test_server.h" @@ -106,7 +105,8 @@ class LocalTestServer : public BaseTestServer { #if defined(OS_POSIX) // The file descriptor the child writes to when it starts. - base::ScopedFD child_fd_; + int child_fd_; + file_util::ScopedFD child_fd_closer_; #endif DISALLOW_COPY_AND_ASSIGN(LocalTestServer); diff --git a/net/test/spawned_test_server/local_test_server_posix.cc b/net/test/spawned_test_server/local_test_server_posix.cc index ea9cab6..10c2d0f 100644 --- a/net/test/spawned_test_server/local_test_server_posix.cc +++ b/net/test/spawned_test_server/local_test_server_posix.cc @@ -10,7 +10,6 @@ #include "base/command_line.h" #include "base/file_util.h" -#include "base/files/scoped_file.h" #include "base/logging.h" #include "base/process/kill.h" #include "base/process/launch.h" @@ -121,8 +120,9 @@ bool LocalTestServer::LaunchPython(const base::FilePath& testserver_path) { } // Save the read half. The write half is sent to the child. - child_fd_.reset(pipefd[0]); - base::ScopedFD write_closer(pipefd[1]); + child_fd_ = pipefd[0]; + child_fd_closer_.reset(&child_fd_); + file_util::ScopedFD write_closer(&pipefd[1]); base::FileHandleMappingVector map_write_fd; map_write_fd.push_back(std::make_pair(pipefd[1], pipefd[1])); @@ -148,19 +148,19 @@ bool LocalTestServer::LaunchPython(const base::FilePath& testserver_path) { } bool LocalTestServer::WaitToStart() { - base::ScopedFD our_fd(child_fd_.release()); + file_util::ScopedFD child_fd_closer(child_fd_closer_.release()); base::TimeDelta remaining_time = TestTimeouts::action_timeout(); uint32 server_data_len = 0; - if (!ReadData(our_fd.get(), sizeof(server_data_len), + if (!ReadData(child_fd_, sizeof(server_data_len), reinterpret_cast<uint8*>(&server_data_len), &remaining_time)) { LOG(ERROR) << "Could not read server_data_len"; return false; } std::string server_data(server_data_len, '\0'); - if (!ReadData(our_fd.get(), server_data_len, + if (!ReadData(child_fd_, server_data_len, reinterpret_cast<uint8*>(&server_data[0]), &remaining_time)) { LOG(ERROR) << "Could not read server_data (" << server_data_len |