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

Side by Side Diff: client/crash_report_database.h

Issue 1018853006: crashpad_database_util: add --new-report (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@crashpad_database_util
Patch Set: Rebase Created 5 years, 9 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 | « no previous file | client/crash_report_database.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 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 FileHandle handle; 99 FileHandle handle;
100 100
101 //! A unique identifier by which this report will always be known to the 101 //! A unique identifier by which this report will always be known to the
102 //! database. 102 //! database.
103 UUID uuid; 103 UUID uuid;
104 104
105 //! The path to the crash report being written. 105 //! The path to the crash report being written.
106 base::FilePath path; 106 base::FilePath path;
107 }; 107 };
108 108
109 //! \brief A scoper to cleanly handle the interface requirement imposed by
110 //! PrepareNewCrashReport().
111 //!
112 //! Calls ErrorWritingCrashReport() upon destruction unless disarmed by
113 //! calling Disarm(). Armed upon construction.
114 class CallErrorWritingCrashReport {
115 public:
116 //! \brief Arms the object to call ErrorWritingCrashReport() on \a database
117 //! with an argument of \a new_report on destruction.
118 CallErrorWritingCrashReport(CrashReportDatabase* database,
119 NewReport* new_report);
120
121 //! \brief Calls ErrorWritingCrashReport() if the object is armed.
122 ~CallErrorWritingCrashReport();
123
124 //! \brief Disarms the object so that CallErrorWritingCrashReport() will not
125 //! be called upon destruction.
126 void Disarm();
127
128 private:
129 CrashReportDatabase* database_; // weak
130 NewReport* new_report_; // weak
131
132 DISALLOW_COPY_AND_ASSIGN(CallErrorWritingCrashReport);
133 };
134
109 //! \brief The result code for operations performed on a database. 135 //! \brief The result code for operations performed on a database.
110 enum OperationStatus { 136 enum OperationStatus {
111 //! \brief No error occurred. 137 //! \brief No error occurred.
112 kNoError = 0, 138 kNoError = 0,
113 139
114 //! \brief The report that was requested could not be located. 140 //! \brief The report that was requested could not be located.
115 kReportNotFound, 141 kReportNotFound,
116 142
117 //! \brief An error occured while performing a file operation on a crash 143 //! \brief An error occured while performing a file operation on a crash
118 //! report. 144 //! report.
(...skipping 30 matching lines...) Expand all
149 175
150 //! \brief Returns the Settings object for this database. 176 //! \brief Returns the Settings object for this database.
151 //! 177 //!
152 //! \return A weak pointer to the Settings object, which is owned by the 178 //! \return A weak pointer to the Settings object, which is owned by the
153 //! database. 179 //! database.
154 virtual Settings* GetSettings() = 0; 180 virtual Settings* GetSettings() = 0;
155 181
156 //! \brief Creates a record of a new crash report. 182 //! \brief Creates a record of a new crash report.
157 //! 183 //!
158 //! Callers can then write the crash report using the file handle provided. 184 //! Callers can then write the crash report using the file handle provided.
159 //! The caller does not own this handle, and it must be explicitly closed with 185 //! The caller does not own the new crash report record or its file handle,
186 //! both of which must be explicitly disposed of by calling
160 //! FinishedWritingCrashReport() or ErrorWritingCrashReport(). 187 //! FinishedWritingCrashReport() or ErrorWritingCrashReport().
161 //! 188 //!
162 //! \param[out] report A file handle to which the crash report data should be 189 //! To arrange to call ErrorWritingCrashReport() during any early return, use
163 //! written. Only valid if this returns #kNoError. The caller must not 190 //! CallErrorWritingCrashReport.
164 //! close this handle. 191 //!
192 //! \param[out] report A NewReport object containing a file handle to which
193 //! the crash report data should be written. Only valid if this returns
194 //! #kNoError. The caller must not delete the NewReport object or close
195 //! the file handle within.
165 //! 196 //!
166 //! \return The operation status code. 197 //! \return The operation status code.
167 virtual OperationStatus PrepareNewCrashReport(NewReport** report) = 0; 198 virtual OperationStatus PrepareNewCrashReport(NewReport** report) = 0;
168 199
169 //! \brief Informs the database that a crash report has been written. 200 //! \brief Informs the database that a crash report has been written.
170 //! 201 //!
171 //! After calling this method, the database is permitted to move and rename 202 //! After calling this method, the database is permitted to move and rename
172 //! the file at NewReport::path. 203 //! the file at NewReport::path.
173 //! 204 //!
174 //! \param[in] report A handle obtained with PrepareNewCrashReport(). The 205 //! \param[in] report A NewReport obtained with PrepareNewCrashReport(). The
175 //! handle will be invalidated as part of this call. 206 //! NewReport object and file handle within will be invalidated as part of
207 //! this call.
176 //! \param[out] uuid The UUID of this crash report. 208 //! \param[out] uuid The UUID of this crash report.
177 //! 209 //!
178 //! \return The operation status code. 210 //! \return The operation status code.
179 virtual OperationStatus FinishedWritingCrashReport(NewReport* report, 211 virtual OperationStatus FinishedWritingCrashReport(NewReport* report,
180 UUID* uuid) = 0; 212 UUID* uuid) = 0;
181 213
182 //! \brief Informs the database that an error occurred while attempting to 214 //! \brief Informs the database that an error occurred while attempting to
183 //! write a crash report, and that any resources associated with it should 215 //! write a crash report, and that any resources associated with it should
184 //! be cleaned up. 216 //! be cleaned up.
185 //! 217 //!
186 //! After calling this method, the database is permitted to remove the file at 218 //! After calling this method, the database is permitted to remove the file at
187 //! NewReport::path. 219 //! NewReport::path.
188 //! 220 //!
189 //! \param[in] report A handle obtained with PrepareNewCrashReport(). The 221 //! \param[in] report A NewReport obtained with PrepareNewCrashReport(). The
190 //! handle will be invalidated as part of this call. 222 //! NewReport object and file handle within will be invalidated as part of
223 //! this call.
191 //! 224 //!
192 //! \return The operation status code. 225 //! \return The operation status code.
193 virtual OperationStatus ErrorWritingCrashReport(NewReport* report) = 0; 226 virtual OperationStatus ErrorWritingCrashReport(NewReport* report) = 0;
194 227
195 //! \brief Returns the crash report record for the unique identifier. 228 //! \brief Returns the crash report record for the unique identifier.
196 //! 229 //!
197 //! \param[in] uuid The crash report record unique identifier. 230 //! \param[in] uuid The crash report record unique identifier.
198 //! \param[out] report A crash report record. Only valid if this returns 231 //! \param[out] report A crash report record. Only valid if this returns
199 //! #kNoError. 232 //! #kNoError.
200 //! 233 //!
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 protected: 303 protected:
271 CrashReportDatabase() {} 304 CrashReportDatabase() {}
272 305
273 private: 306 private:
274 DISALLOW_COPY_AND_ASSIGN(CrashReportDatabase); 307 DISALLOW_COPY_AND_ASSIGN(CrashReportDatabase);
275 }; 308 };
276 309
277 } // namespace crashpad 310 } // namespace crashpad
278 311
279 #endif // CRASHPAD_CLIENT_CRASH_REPORT_DATABASE_H_ 312 #endif // CRASHPAD_CLIENT_CRASH_REPORT_DATABASE_H_
OLDNEW
« no previous file with comments | « no previous file | client/crash_report_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698