OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Crashpad Authors. All rights reserved. |
| 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (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 |
| 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. |
| 14 |
| 15 #ifndef CRASHPAD_HANDLER_USER_STREAM_DATA_SOURCE_H_ |
| 16 #define CRASHPAD_HANDLER_USER_STREAM_DATA_SOURCE_H_ |
| 17 |
| 18 #include <memory> |
| 19 #include <vector> |
| 20 |
| 21 namespace crashpad { |
| 22 |
| 23 class MinidumpFileWriter; |
| 24 class MinidumpUserExtensionStreamDataSource; |
| 25 class ProcessSnapshot; |
| 26 |
| 27 //! \brief Extensibility interface for embedders who wish to add custom streams |
| 28 //! to minidumps. |
| 29 class UserStreamDataSource { |
| 30 public: |
| 31 virtual ~UserStreamDataSource() {} |
| 32 |
| 33 //! \brief Produce the contents for an extension stream for a crashed program. |
| 34 //! |
| 35 //! Called after \a process_snapshot has been initialized for the crashed |
| 36 //! process to (optionally) produce the contents of a user extension stream |
| 37 //! that will be attached to the minidump. |
| 38 //! |
| 39 //! \param[in] process_snapshot An initialized snapshot for the crashed |
| 40 //! process. |
| 41 //! |
| 42 //! \return A new data source for the stream to add to the minidump or |
| 43 //! `nullptr` on failure or to opt out of adding a stream. |
| 44 virtual std::unique_ptr<MinidumpUserExtensionStreamDataSource> |
| 45 ProduceStreamData(ProcessSnapshot* process_snapshot) = 0; |
| 46 }; |
| 47 |
| 48 using UserStreamDataSources = |
| 49 std::vector<std::unique_ptr<UserStreamDataSource>>; |
| 50 |
| 51 //! \brief Adds user extension streams to a minidump. |
| 52 //! |
| 53 //! Dispatches to each source in \a user_stream_data_sources and adds returned |
| 54 //! extension streams to \a minidump_file_writer. |
| 55 //! |
| 56 //! \param[in] user_stream_data_sources A pointer to the data sources, or |
| 57 //! `nullptr`. |
| 58 //! \param[in] process_snapshot An initialized snapshot to the crashing process. |
| 59 //! \param[in] minidump_file_writer Any extension streams will be added to this |
| 60 //! minidump. |
| 61 void AddUserExtensionStreams( |
| 62 const UserStreamDataSources* user_stream_data_sources, |
| 63 ProcessSnapshot* process_snapshot, |
| 64 MinidumpFileWriter* minidump_file_writer); |
| 65 |
| 66 } // namespace crashpad |
| 67 |
| 68 #endif // CRASHPAD_HANDLER_USER_STREAM_DATA_SOURCE_H_ |
OLD | NEW |