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