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

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

Issue 2163063002: Make File::Duplicate() const (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert unneeded 'private:' label Created 4 years, 5 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/files/file_tracing.cc ('k') | content/browser/tracing/file_tracing_provider_impl.h » ('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 "base/files/file.h" 5 #include "base/files/file.h"
6 6
7 #include <io.h> 7 #include <io.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 DCHECK(IsValid()); 242 DCHECK(IsValid());
243 243
244 SCOPED_FILE_TRACE("Unlock"); 244 SCOPED_FILE_TRACE("Unlock");
245 245
246 BOOL result = UnlockFile(file_.Get(), 0, 0, MAXDWORD, MAXDWORD); 246 BOOL result = UnlockFile(file_.Get(), 0, 0, MAXDWORD, MAXDWORD);
247 if (!result) 247 if (!result)
248 return OSErrorToFileError(GetLastError()); 248 return OSErrorToFileError(GetLastError());
249 return FILE_OK; 249 return FILE_OK;
250 } 250 }
251 251
252 File File::Duplicate() { 252 File File::Duplicate() const {
253 if (!IsValid()) 253 if (!IsValid())
254 return File(); 254 return File();
255 255
256 SCOPED_FILE_TRACE("Duplicate"); 256 SCOPED_FILE_TRACE("Duplicate");
257 257
258 HANDLE other_handle = nullptr; 258 HANDLE other_handle = nullptr;
259 259
260 if (!::DuplicateHandle(GetCurrentProcess(), // hSourceProcessHandle 260 if (!::DuplicateHandle(GetCurrentProcess(), // hSourceProcessHandle
261 GetPlatformFile(), 261 GetPlatformFile(),
262 GetCurrentProcess(), // hTargetProcessHandle 262 GetCurrentProcess(), // hTargetProcessHandle
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 ThreadRestrictions::AssertIOAllowed(); 400 ThreadRestrictions::AssertIOAllowed();
401 DCHECK(IsValid()); 401 DCHECK(IsValid());
402 return ::FlushFileBuffers(file_.Get()) != FALSE; 402 return ::FlushFileBuffers(file_.Get()) != FALSE;
403 } 403 }
404 404
405 void File::SetPlatformFile(PlatformFile file) { 405 void File::SetPlatformFile(PlatformFile file) {
406 file_.Set(file); 406 file_.Set(file);
407 } 407 }
408 408
409 } // namespace base 409 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_tracing.cc ('k') | content/browser/tracing/file_tracing_provider_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698