| OLD | NEW |
| 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, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 | 14 |
| 15 #ifndef CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ | 15 #ifndef CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ |
| 16 #define CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ | 16 #define CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ |
| 17 | 17 |
| 18 #include <stdint.h> | 18 #include <stdint.h> |
| 19 #include <sys/time.h> | 19 #include <sys/time.h> |
| 20 #include <sys/types.h> | 20 #include <sys/types.h> |
| 21 | 21 |
| 22 #include <map> | 22 #include <map> |
| 23 #include <string> | 23 #include <string> |
| 24 #include <utility> |
| 24 #include <vector> | 25 #include <vector> |
| 25 | 26 |
| 26 #include "base/basictypes.h" | 27 #include "base/basictypes.h" |
| 27 #include "base/memory/scoped_ptr.h" | 28 #include "base/memory/scoped_ptr.h" |
| 28 #include "snapshot/exception_snapshot.h" | 29 #include "snapshot/exception_snapshot.h" |
| 29 #include "snapshot/memory_map_region_snapshot.h" | 30 #include "snapshot/memory_map_region_snapshot.h" |
| 30 #include "snapshot/memory_snapshot.h" | 31 #include "snapshot/memory_snapshot.h" |
| 31 #include "snapshot/module_snapshot.h" | 32 #include "snapshot/module_snapshot.h" |
| 32 #include "snapshot/process_snapshot.h" | 33 #include "snapshot/process_snapshot.h" |
| 33 #include "snapshot/system_snapshot.h" | 34 #include "snapshot/system_snapshot.h" |
| 34 #include "snapshot/thread_snapshot.h" | 35 #include "snapshot/thread_snapshot.h" |
| 35 #include "util/stdlib/move.h" | |
| 36 #include "util/misc/uuid.h" | 36 #include "util/misc/uuid.h" |
| 37 #include "util/stdlib/pointer_container.h" | 37 #include "util/stdlib/pointer_container.h" |
| 38 | 38 |
| 39 namespace crashpad { | 39 namespace crashpad { |
| 40 namespace test { | 40 namespace test { |
| 41 | 41 |
| 42 //! \brief A test ProcessSnapshot that can carry arbitrary data for testing | 42 //! \brief A test ProcessSnapshot that can carry arbitrary data for testing |
| 43 //! purposes. | 43 //! purposes. |
| 44 class TestProcessSnapshot final : public ProcessSnapshot { | 44 class TestProcessSnapshot final : public ProcessSnapshot { |
| 45 public: | 45 public: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 66 void SetAnnotationsSimpleMap( | 66 void SetAnnotationsSimpleMap( |
| 67 const std::map<std::string, std::string>& annotations_simple_map) { | 67 const std::map<std::string, std::string>& annotations_simple_map) { |
| 68 annotations_simple_map_ = annotations_simple_map; | 68 annotations_simple_map_ = annotations_simple_map; |
| 69 } | 69 } |
| 70 | 70 |
| 71 //! \brief Sets the system snapshot to be returned by System(). | 71 //! \brief Sets the system snapshot to be returned by System(). |
| 72 //! | 72 //! |
| 73 //! \param[in] system The system snapshot that System() will return. The | 73 //! \param[in] system The system snapshot that System() will return. The |
| 74 //! TestProcessSnapshot object takes ownership of \a system. | 74 //! TestProcessSnapshot object takes ownership of \a system. |
| 75 void SetSystem(scoped_ptr<SystemSnapshot> system) { | 75 void SetSystem(scoped_ptr<SystemSnapshot> system) { |
| 76 system_ = crashpad::move(system); | 76 system_ = std::move(system); |
| 77 } | 77 } |
| 78 | 78 |
| 79 //! \brief Adds a thread snapshot to be returned by Threads(). | 79 //! \brief Adds a thread snapshot to be returned by Threads(). |
| 80 //! | 80 //! |
| 81 //! \param[in] thread The thread snapshot that will be included in Threads(). | 81 //! \param[in] thread The thread snapshot that will be included in Threads(). |
| 82 //! The TestProcessSnapshot object takes ownership of \a thread. | 82 //! The TestProcessSnapshot object takes ownership of \a thread. |
| 83 void AddThread(scoped_ptr<ThreadSnapshot> thread) { | 83 void AddThread(scoped_ptr<ThreadSnapshot> thread) { |
| 84 threads_.push_back(thread.release()); | 84 threads_.push_back(thread.release()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 //! \brief Adds a module snapshot to be returned by Modules(). | 87 //! \brief Adds a module snapshot to be returned by Modules(). |
| 88 //! | 88 //! |
| 89 //! \param[in] module The module snapshot that will be included in Modules(). | 89 //! \param[in] module The module snapshot that will be included in Modules(). |
| 90 //! The TestProcessSnapshot object takes ownership of \a module. | 90 //! The TestProcessSnapshot object takes ownership of \a module. |
| 91 void AddModule(scoped_ptr<ModuleSnapshot> module) { | 91 void AddModule(scoped_ptr<ModuleSnapshot> module) { |
| 92 modules_.push_back(module.release()); | 92 modules_.push_back(module.release()); |
| 93 } | 93 } |
| 94 | 94 |
| 95 //! \brief Sets the exception snapshot to be returned by Exception(). | 95 //! \brief Sets the exception snapshot to be returned by Exception(). |
| 96 //! | 96 //! |
| 97 //! \param[in] exception The exception snapshot that Exception() will return. | 97 //! \param[in] exception The exception snapshot that Exception() will return. |
| 98 //! The TestProcessSnapshot object takes ownership of \a exception. | 98 //! The TestProcessSnapshot object takes ownership of \a exception. |
| 99 void SetException(scoped_ptr<ExceptionSnapshot> exception) { | 99 void SetException(scoped_ptr<ExceptionSnapshot> exception) { |
| 100 exception_ = crashpad::move(exception); | 100 exception_ = std::move(exception); |
| 101 } | 101 } |
| 102 | 102 |
| 103 //! \brief Adds a memory map region snapshot to be returned by MemoryMap(). | 103 //! \brief Adds a memory map region snapshot to be returned by MemoryMap(). |
| 104 //! | 104 //! |
| 105 //! \param[in] region The memory map region snapshot that will be included in | 105 //! \param[in] region The memory map region snapshot that will be included in |
| 106 //! MemoryMap(). The TestProcessSnapshot object takes ownership of \a | 106 //! MemoryMap(). The TestProcessSnapshot object takes ownership of \a |
| 107 //! region. | 107 //! region. |
| 108 void AddMemoryMapRegion(scoped_ptr<MemoryMapRegionSnapshot> region) { | 108 void AddMemoryMapRegion(scoped_ptr<MemoryMapRegionSnapshot> region) { |
| 109 memory_map_.push_back(region.release()); | 109 memory_map_.push_back(region.release()); |
| 110 } | 110 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 std::vector<HandleSnapshot> handles_; | 162 std::vector<HandleSnapshot> handles_; |
| 163 PointerVector<MemorySnapshot> extra_memory_; | 163 PointerVector<MemorySnapshot> extra_memory_; |
| 164 | 164 |
| 165 DISALLOW_COPY_AND_ASSIGN(TestProcessSnapshot); | 165 DISALLOW_COPY_AND_ASSIGN(TestProcessSnapshot); |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 } // namespace test | 168 } // namespace test |
| 169 } // namespace crashpad | 169 } // namespace crashpad |
| 170 | 170 |
| 171 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ | 171 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ |
| OLD | NEW |