Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2902)

Unified Diff: base/files/file.cc

Issue 676873004: Intercept file Open/Close (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/files/file.cc
diff --git a/base/files/file.cc b/base/files/file.cc
index ea8dbf27ac1770d88fc6ce933a4bdd331820d2d9..03e2f40aa2080beb83a4141c7d1f5b19ff5ff9a8 100644
--- a/base/files/file.cc
+++ b/base/files/file.cc
@@ -5,6 +5,10 @@
#include "base/files/file.h"
#include "base/files/file_path.h"
+#if defined(OS_POSIX)
+#include "base/files/file_posix_hooks_internal.h"
+#endif
+
namespace base {
File::Info::Info()
@@ -38,6 +42,8 @@ File::File(PlatformFile platform_file)
async_(false) {
#if defined(OS_POSIX)
DCHECK_GE(platform_file, -1);
+ if (IsValid())
+ ProtectFileDescriptor(platform_file);
#endif
}
@@ -52,6 +58,8 @@ File::File(RValue other)
error_details_(other.object->error_details()),
created_(other.object->created()),
async_(other.object->async_) {
+ if (IsValid())
+ ProtectFileDescriptor(GetPlatformFile());
}
File::~File() {

Powered by Google App Engine
This is Rietveld 408576698