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

Side by Side Diff: base/files/file.cc

Issue 676873004: Intercept file Open/Close (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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 unified diff | Download patch
« no previous file with comments | « base/base.gyp ('k') | base/files/file_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/files/file.h" 5 #include "base/files/file.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 7
8 #if defined(OS_POSIX)
9 #include "base/files/file_posix_hooks_internal.h"
10 #endif
11
8 namespace base { 12 namespace base {
9 13
10 File::Info::Info() 14 File::Info::Info()
11 : size(0), 15 : size(0),
12 is_directory(false), 16 is_directory(false),
13 is_symbolic_link(false) { 17 is_symbolic_link(false) {
14 } 18 }
15 19
16 File::Info::~Info() { 20 File::Info::~Info() {
17 } 21 }
(...skipping 13 matching lines...) Expand all
31 } 35 }
32 #endif 36 #endif
33 37
34 File::File(PlatformFile platform_file) 38 File::File(PlatformFile platform_file)
35 : file_(platform_file), 39 : file_(platform_file),
36 error_details_(FILE_OK), 40 error_details_(FILE_OK),
37 created_(false), 41 created_(false),
38 async_(false) { 42 async_(false) {
39 #if defined(OS_POSIX) 43 #if defined(OS_POSIX)
40 DCHECK_GE(platform_file, -1); 44 DCHECK_GE(platform_file, -1);
45 if (IsValid())
46 ProtectFileDescriptor(platform_file);
41 #endif 47 #endif
42 } 48 }
43 49
44 File::File(Error error_details) 50 File::File(Error error_details)
45 : error_details_(error_details), 51 : error_details_(error_details),
46 created_(false), 52 created_(false),
47 async_(false) { 53 async_(false) {
48 } 54 }
49 55
50 File::File(RValue other) 56 File::File(RValue other)
51 : file_(other.object->TakePlatformFile()), 57 : file_(other.object->TakePlatformFile()),
52 error_details_(other.object->error_details()), 58 error_details_(other.object->error_details()),
53 created_(other.object->created()), 59 created_(other.object->created()),
54 async_(other.object->async_) { 60 async_(other.object->async_) {
61 #if defined(OS_POSIX)
62 if (IsValid())
63 ProtectFileDescriptor(GetPlatformFile());
64 #endif
55 } 65 }
56 66
57 File::~File() { 67 File::~File() {
58 // Go through the AssertIOAllowed logic. 68 // Go through the AssertIOAllowed logic.
59 Close(); 69 Close();
60 } 70 }
61 71
62 File& File::operator=(RValue other) { 72 File& File::operator=(RValue other) {
63 if (this != other.object) { 73 if (this != other.object) {
64 Close(); 74 Close();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return "FILE_ERROR_IO"; 128 return "FILE_ERROR_IO";
119 case FILE_ERROR_MAX: 129 case FILE_ERROR_MAX:
120 break; 130 break;
121 } 131 }
122 132
123 NOTREACHED(); 133 NOTREACHED();
124 return ""; 134 return "";
125 } 135 }
126 136
127 } // namespace base 137 } // namespace base
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | base/files/file_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698