Revert "Intercept base::File Open/Close"
This reverts commit 45a0dc0b75b52e026eb15526ef441edc5dbe9ba5.
> Intercept base::File Open/Close
>
> When a file descriptor is opened by the base::File, all calls to close(3) from
> the same dynamic library will hit a CHECK unless they are made from a
> whitelist of callsites belonging to base::File.
>
> There is a handy protect_file_posix.gypi introduced to make it easy to enable
> on Chrome-for-Android.
>
> This 'linker magic' is somewhat crazy, so:
> 1. it will be *removed *when crbug.com/424562 is fixed
> 2. it should only be used by a whitelist of binaries/libraries (in the
> opensource part: libchromeshell only)
>
> BUG=424562
>
> Review URL: https://codereview.chromium.org/676873004
>
> Cr-Commit-Position: refs/heads/master@{#304592}
Reason: crashes are not numerous, not much sense to fix, some explanations found
elsewhere.
BUG=424562
Review URL: https://codereview.chromium.org/1101723004
Cr-Commit-Position: refs/heads/master@{#327051}
CrOS-Libchrome-Original-Commit: e1ceecf5545568261956de95fda59270a91d4ef0
diff --git a/base/files/file_posix.cc b/base/files/file_posix.cc
index dab9cc2..4c79057 100644
--- a/base/files/file_posix.cc
+++ b/base/files/file_posix.cc
@@ -10,7 +10,6 @@
#include <unistd.h>
#include "base/files/file_path.h"
-#include "base/files/file_posix_hooks_internal.h"
#include "base/logging.h"
#include "base/metrics/sparse_histogram.h"
#include "base/posix/eintr_wrapper.h"
@@ -158,14 +157,6 @@
Time::kNanosecondsPerMicrosecond);
}
-// Default implementations of Protect/Unprotect hooks defined as weak symbols
-// where possible.
-void ProtectFileDescriptor(int fd) {
-}
-
-void UnprotectFileDescriptor(int fd) {
-}
-
bool File::IsValid() const {
return file_.is_valid();
}
@@ -175,8 +166,6 @@
}
PlatformFile File::TakePlatformFile() {
- if (IsValid())
- UnprotectFileDescriptor(GetPlatformFile());
return file_.release();
}
@@ -185,7 +174,6 @@
return;
ThreadRestrictions::AssertIOAllowed();
- UnprotectFileDescriptor(GetPlatformFile());
file_.reset();
}
@@ -537,7 +525,6 @@
async_ = ((flags & FLAG_ASYNC) == FLAG_ASYNC);
error_details_ = FILE_OK;
file_.reset(descriptor);
- ProtectFileDescriptor(descriptor);
}
#endif // !defined(OS_NACL)
@@ -555,10 +542,8 @@
}
void File::SetPlatformFile(PlatformFile file) {
- CHECK(!file_.is_valid());
+ DCHECK(!file_.is_valid());
file_.reset(file);
- if (file_.is_valid())
- ProtectFileDescriptor(GetPlatformFile());
}
} // namespace base