| 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 <vector> | 24 #include <vector> |
| 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_snapshot.h" |
| 29 #include "snapshot/module_snapshot.h" | 30 #include "snapshot/module_snapshot.h" |
| 30 #include "snapshot/process_snapshot.h" | 31 #include "snapshot/process_snapshot.h" |
| 31 #include "snapshot/system_snapshot.h" | 32 #include "snapshot/system_snapshot.h" |
| 32 #include "snapshot/thread_snapshot.h" | 33 #include "snapshot/thread_snapshot.h" |
| 33 #include "util/misc/uuid.h" | 34 #include "util/misc/uuid.h" |
| 34 #include "util/stdlib/pointer_container.h" | 35 #include "util/stdlib/pointer_container.h" |
| 35 | 36 |
| 36 namespace crashpad { | 37 namespace crashpad { |
| 37 namespace test { | 38 namespace test { |
| 38 | 39 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 89 } |
| 89 | 90 |
| 90 //! \brief Sets the exception snapshot to be returned by Exception(). | 91 //! \brief Sets the exception snapshot to be returned by Exception(). |
| 91 //! | 92 //! |
| 92 //! \param[in] exception The exception snapshot that Exception() will return. | 93 //! \param[in] exception The exception snapshot that Exception() will return. |
| 93 //! The TestProcessSnapshot object takes ownership of \a exception. | 94 //! The TestProcessSnapshot object takes ownership of \a exception. |
| 94 void SetException(scoped_ptr<ExceptionSnapshot> exception) { | 95 void SetException(scoped_ptr<ExceptionSnapshot> exception) { |
| 95 exception_ = exception.Pass(); | 96 exception_ = exception.Pass(); |
| 96 } | 97 } |
| 97 | 98 |
| 99 //! \brief Add a memory snapshot to be returned by ExtraMemory(). |
| 100 //! |
| 101 //! \param[in] peb The memory snapshot that will be included in ExtraMemory(). |
| 102 //! The TestProcessSnapshot object takes ownership of \a extra_memory. |
| 103 void AddExtraMemory(scoped_ptr<MemorySnapshot> extra_memory) { |
| 104 extra_memory_.push_back(extra_memory.release()); |
| 105 } |
| 106 |
| 98 // ProcessSnapshot: | 107 // ProcessSnapshot: |
| 99 | 108 |
| 100 pid_t ProcessID() const override; | 109 pid_t ProcessID() const override; |
| 101 pid_t ParentProcessID() const override; | 110 pid_t ParentProcessID() const override; |
| 102 void SnapshotTime(timeval* snapshot_time) const override; | 111 void SnapshotTime(timeval* snapshot_time) const override; |
| 103 void ProcessStartTime(timeval* start_time) const override; | 112 void ProcessStartTime(timeval* start_time) const override; |
| 104 void ProcessCPUTimes(timeval* user_time, timeval* system_time) const override; | 113 void ProcessCPUTimes(timeval* user_time, timeval* system_time) const override; |
| 105 void ReportID(UUID* report_id) const override; | 114 void ReportID(UUID* report_id) const override; |
| 106 void ClientID(UUID* client_id) const override; | 115 void ClientID(UUID* client_id) const override; |
| 107 const std::map<std::string, std::string>& AnnotationsSimpleMap() | 116 const std::map<std::string, std::string>& AnnotationsSimpleMap() |
| 108 const override; | 117 const override; |
| 109 const SystemSnapshot* System() const override; | 118 const SystemSnapshot* System() const override; |
| 110 std::vector<const ThreadSnapshot*> Threads() const override; | 119 std::vector<const ThreadSnapshot*> Threads() const override; |
| 111 std::vector<const ModuleSnapshot*> Modules() const override; | 120 std::vector<const ModuleSnapshot*> Modules() const override; |
| 112 const ExceptionSnapshot* Exception() const override; | 121 const ExceptionSnapshot* Exception() const override; |
| 122 std::vector<const MemorySnapshot*> ExtraMemory() const override; |
| 113 | 123 |
| 114 private: | 124 private: |
| 115 pid_t process_id_; | 125 pid_t process_id_; |
| 116 pid_t parent_process_id_; | 126 pid_t parent_process_id_; |
| 117 timeval snapshot_time_; | 127 timeval snapshot_time_; |
| 118 timeval process_start_time_; | 128 timeval process_start_time_; |
| 119 timeval process_cpu_user_time_; | 129 timeval process_cpu_user_time_; |
| 120 timeval process_cpu_system_time_; | 130 timeval process_cpu_system_time_; |
| 121 UUID report_id_; | 131 UUID report_id_; |
| 122 UUID client_id_; | 132 UUID client_id_; |
| 123 std::map<std::string, std::string> annotations_simple_map_; | 133 std::map<std::string, std::string> annotations_simple_map_; |
| 124 scoped_ptr<SystemSnapshot> system_; | 134 scoped_ptr<SystemSnapshot> system_; |
| 125 PointerVector<ThreadSnapshot> threads_; | 135 PointerVector<ThreadSnapshot> threads_; |
| 126 PointerVector<ModuleSnapshot> modules_; | 136 PointerVector<ModuleSnapshot> modules_; |
| 127 scoped_ptr<ExceptionSnapshot> exception_; | 137 scoped_ptr<ExceptionSnapshot> exception_; |
| 138 PointerVector<MemorySnapshot> extra_memory_; |
| 128 | 139 |
| 129 DISALLOW_COPY_AND_ASSIGN(TestProcessSnapshot); | 140 DISALLOW_COPY_AND_ASSIGN(TestProcessSnapshot); |
| 130 }; | 141 }; |
| 131 | 142 |
| 132 } // namespace test | 143 } // namespace test |
| 133 } // namespace crashpad | 144 } // namespace crashpad |
| 134 | 145 |
| 135 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ | 146 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ |
| OLD | NEW |