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

Side by Side Diff: tools/generate_dump.cc

Issue 815053004: Switch [String]FileWriter to use new file_io.h functions/types (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@file_io_seek-2
Patch Set: fixes Created 6 years 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 | « no previous file | util/file/file_io.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 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 suspend.reset(new ScopedTaskSuspend(task)); 145 suspend.reset(new ScopedTaskSuspend(task));
146 } 146 }
147 147
148 ProcessSnapshotMac process_snapshot; 148 ProcessSnapshotMac process_snapshot;
149 if (!process_snapshot.Initialize(task)) { 149 if (!process_snapshot.Initialize(task)) {
150 return EXIT_FAILURE; 150 return EXIT_FAILURE;
151 } 151 }
152 152
153 FileWriter file_writer; 153 FileWriter file_writer;
154 if (!file_writer.Open(base::FilePath(options.dump_path), 154 if (!file_writer.Open(base::FilePath(options.dump_path),
155 O_WRONLY | O_CREAT | O_TRUNC, 155 FileWriteMode::kTruncateOrCreate,
156 0644)) { 156 true)) {
157 return EXIT_FAILURE; 157 return EXIT_FAILURE;
158 } 158 }
159 159
160 MinidumpFileWriter minidump; 160 MinidumpFileWriter minidump;
161 minidump.InitializeFromSnapshot(&process_snapshot); 161 minidump.InitializeFromSnapshot(&process_snapshot);
162 if (!minidump.WriteEverything(&file_writer)) { 162 if (!minidump.WriteEverything(&file_writer)) {
163 if (unlink(options.dump_path.c_str()) != 0) { 163 if (unlink(options.dump_path.c_str()) != 0) {
164 PLOG(ERROR) << "unlink"; 164 PLOG(ERROR) << "unlink";
165 } 165 }
166 return EXIT_FAILURE; 166 return EXIT_FAILURE;
167 } 167 }
168 } 168 }
169 169
170 return EXIT_SUCCESS; 170 return EXIT_SUCCESS;
171 } 171 }
172 172
173 } // namespace 173 } // namespace
174 } // namespace crashpad 174 } // namespace crashpad
175 175
176 int main(int argc, char* argv[]) { 176 int main(int argc, char* argv[]) {
177 return crashpad::GenerateDumpMain(argc, argv); 177 return crashpad::GenerateDumpMain(argc, argv);
178 } 178 }
OLDNEW
« no previous file with comments | « no previous file | util/file/file_io.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698