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

Side by Side Diff: util/file/file_io_win.cc

Issue 1390023002: Add FileWriteMode::kCreateOrFail (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Test that kReuseOrCreate can create Created 5 years, 2 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 | « util/file/file_io_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 25 matching lines...) Expand all
36 namespace crashpad { 36 namespace crashpad {
37 37
38 namespace { 38 namespace {
39 39
40 FileHandle LoggingOpenFileForOutput(DWORD access, 40 FileHandle LoggingOpenFileForOutput(DWORD access,
41 const base::FilePath& path, 41 const base::FilePath& path,
42 FileWriteMode mode, 42 FileWriteMode mode,
43 FilePermissions permissions) { 43 FilePermissions permissions) {
44 DWORD disposition = 0; 44 DWORD disposition = 0;
45 switch (mode) { 45 switch (mode) {
46 case FileWriteMode::kReuseOrFail:
47 disposition = OPEN_EXISTING;
48 break;
46 case FileWriteMode::kReuseOrCreate: 49 case FileWriteMode::kReuseOrCreate:
47 disposition = OPEN_ALWAYS; 50 disposition = OPEN_ALWAYS;
48 break; 51 break;
49 case FileWriteMode::kTruncateOrCreate: 52 case FileWriteMode::kTruncateOrCreate:
50 disposition = CREATE_ALWAYS; 53 disposition = CREATE_ALWAYS;
51 break; 54 break;
52 case FileWriteMode::kCreateOrFail: 55 case FileWriteMode::kCreateOrFail:
53 disposition = CREATE_NEW; 56 disposition = CREATE_NEW;
54 break; 57 break;
55 } 58 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 return true; 206 return true;
204 } 207 }
205 208
206 bool LoggingCloseFile(FileHandle file) { 209 bool LoggingCloseFile(FileHandle file) {
207 BOOL rv = CloseHandle(file); 210 BOOL rv = CloseHandle(file);
208 PLOG_IF(ERROR, !rv) << "CloseHandle"; 211 PLOG_IF(ERROR, !rv) << "CloseHandle";
209 return rv; 212 return rv;
210 } 213 }
211 214
212 } // namespace crashpad 215 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/file/file_io_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698