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

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

Issue 593113004: Remove implicit HANDLE conversions from base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 months 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/debug/gdi_debug_util_win.cc ('k') | base/files/file_util_win.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // Creates a reparse point from |source| (an empty directory) to |target|. 132 // Creates a reparse point from |source| (an empty directory) to |target|.
133 ReparsePoint(const FilePath& source, const FilePath& target) { 133 ReparsePoint(const FilePath& source, const FilePath& target) {
134 dir_.Set( 134 dir_.Set(
135 ::CreateFile(source.value().c_str(), 135 ::CreateFile(source.value().c_str(),
136 FILE_ALL_ACCESS, 136 FILE_ALL_ACCESS,
137 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 137 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
138 NULL, 138 NULL,
139 OPEN_EXISTING, 139 OPEN_EXISTING,
140 FILE_FLAG_BACKUP_SEMANTICS, // Needed to open a directory. 140 FILE_FLAG_BACKUP_SEMANTICS, // Needed to open a directory.
141 NULL)); 141 NULL));
142 created_ = dir_.IsValid() && SetReparsePoint(dir_, target); 142 created_ = dir_.IsValid() && SetReparsePoint(dir_.Get(), target);
143 } 143 }
144 144
145 ~ReparsePoint() { 145 ~ReparsePoint() {
146 if (created_) 146 if (created_)
147 DeleteReparsePoint(dir_); 147 DeleteReparsePoint(dir_.Get());
148 } 148 }
149 149
150 bool IsValid() { return created_; } 150 bool IsValid() { return created_; }
151 151
152 private: 152 private:
153 win::ScopedHandle dir_; 153 win::ScopedHandle dir_;
154 bool created_; 154 bool created_;
155 DISALLOW_COPY_AND_ASSIGN(ReparsePoint); 155 DISALLOW_COPY_AND_ASSIGN(ReparsePoint);
156 }; 156 };
157 157
(...skipping 2429 matching lines...) Expand 10 before | Expand all | Expand 10 after
2587 // Trying to close it should crash. This is important for security. 2587 // Trying to close it should crash. This is important for security.
2588 EXPECT_DEATH(CloseWithScopedFD(fds[1]), ""); 2588 EXPECT_DEATH(CloseWithScopedFD(fds[1]), "");
2589 #endif 2589 #endif
2590 } 2590 }
2591 2591
2592 #endif // defined(OS_POSIX) 2592 #endif // defined(OS_POSIX)
2593 2593
2594 } // namespace 2594 } // namespace
2595 2595
2596 } // namespace base 2596 } // namespace base
OLDNEW
« no previous file with comments | « base/debug/gdi_debug_util_win.cc ('k') | base/files/file_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698