| 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> |
| 23 #include <string> |
| 22 #include <vector> | 24 #include <vector> |
| 23 | 25 |
| 24 #include "base/basictypes.h" | 26 #include "base/basictypes.h" |
| 25 #include "base/memory/scoped_ptr.h" | 27 #include "base/memory/scoped_ptr.h" |
| 26 #include "snapshot/exception_snapshot.h" | 28 #include "snapshot/exception_snapshot.h" |
| 27 #include "snapshot/module_snapshot.h" | 29 #include "snapshot/module_snapshot.h" |
| 28 #include "snapshot/process_snapshot.h" | 30 #include "snapshot/process_snapshot.h" |
| 29 #include "snapshot/system_snapshot.h" | 31 #include "snapshot/system_snapshot.h" |
| 30 #include "snapshot/thread_snapshot.h" | 32 #include "snapshot/thread_snapshot.h" |
| 31 #include "util/stdlib/pointer_container.h" | 33 #include "util/stdlib/pointer_container.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 48 snapshot_time_ = snapshot_time; | 50 snapshot_time_ = snapshot_time; |
| 49 } | 51 } |
| 50 void SetProcessStartTime(const timeval& start_time) { | 52 void SetProcessStartTime(const timeval& start_time) { |
| 51 process_start_time_ = start_time; | 53 process_start_time_ = start_time; |
| 52 } | 54 } |
| 53 void SetProcessCPUTimes(const timeval& user_time, | 55 void SetProcessCPUTimes(const timeval& user_time, |
| 54 const timeval& system_time) { | 56 const timeval& system_time) { |
| 55 process_cpu_user_time_ = user_time; | 57 process_cpu_user_time_ = user_time; |
| 56 process_cpu_system_time_ = system_time; | 58 process_cpu_system_time_ = system_time; |
| 57 } | 59 } |
| 60 void SetAnnotationsSimpleMap( |
| 61 const std::map<std::string, std::string>& annotations_simple_map) { |
| 62 annotations_simple_map_ = annotations_simple_map; |
| 63 } |
| 58 | 64 |
| 59 //! \brief Sets the system snapshot to be returned by System(). | 65 //! \brief Sets the system snapshot to be returned by System(). |
| 60 //! | 66 //! |
| 61 //! \param[in] system The system snapshot that System() will return. The | 67 //! \param[in] system The system snapshot that System() will return. The |
| 62 //! TestProcessSnapshot object takes ownership of \a system. | 68 //! TestProcessSnapshot object takes ownership of \a system. |
| 63 void SetSystem(scoped_ptr<SystemSnapshot> system) { system_ = system.Pass(); } | 69 void SetSystem(scoped_ptr<SystemSnapshot> system) { system_ = system.Pass(); } |
| 64 | 70 |
| 65 //! \brief Adds a thread snapshot to be returned by Threads(). | 71 //! \brief Adds a thread snapshot to be returned by Threads(). |
| 66 //! | 72 //! |
| 67 //! \param[in] thread The thread snapshot that will be included in Threads(). | 73 //! \param[in] thread The thread snapshot that will be included in Threads(). |
| (...skipping 18 matching lines...) Expand all Loading... |
| 86 exception_ = exception.Pass(); | 92 exception_ = exception.Pass(); |
| 87 } | 93 } |
| 88 | 94 |
| 89 // ProcessSnapshot: | 95 // ProcessSnapshot: |
| 90 | 96 |
| 91 pid_t ProcessID() const override; | 97 pid_t ProcessID() const override; |
| 92 pid_t ParentProcessID() const override; | 98 pid_t ParentProcessID() const override; |
| 93 void SnapshotTime(timeval* snapshot_time) const override; | 99 void SnapshotTime(timeval* snapshot_time) const override; |
| 94 void ProcessStartTime(timeval* start_time) const override; | 100 void ProcessStartTime(timeval* start_time) const override; |
| 95 void ProcessCPUTimes(timeval* user_time, timeval* system_time) const override; | 101 void ProcessCPUTimes(timeval* user_time, timeval* system_time) const override; |
| 102 const std::map<std::string, std::string>& AnnotationsSimpleMap() |
| 103 const override; |
| 96 const SystemSnapshot* System() const override; | 104 const SystemSnapshot* System() const override; |
| 97 std::vector<const ThreadSnapshot*> Threads() const override; | 105 std::vector<const ThreadSnapshot*> Threads() const override; |
| 98 std::vector<const ModuleSnapshot*> Modules() const override; | 106 std::vector<const ModuleSnapshot*> Modules() const override; |
| 99 const ExceptionSnapshot* Exception() const override; | 107 const ExceptionSnapshot* Exception() const override; |
| 100 | 108 |
| 101 private: | 109 private: |
| 102 pid_t process_id_; | 110 pid_t process_id_; |
| 103 pid_t parent_process_id_; | 111 pid_t parent_process_id_; |
| 104 timeval snapshot_time_; | 112 timeval snapshot_time_; |
| 105 timeval process_start_time_; | 113 timeval process_start_time_; |
| 106 timeval process_cpu_user_time_; | 114 timeval process_cpu_user_time_; |
| 107 timeval process_cpu_system_time_; | 115 timeval process_cpu_system_time_; |
| 116 std::map<std::string, std::string> annotations_simple_map_; |
| 108 scoped_ptr<SystemSnapshot> system_; | 117 scoped_ptr<SystemSnapshot> system_; |
| 109 PointerVector<ThreadSnapshot> threads_; | 118 PointerVector<ThreadSnapshot> threads_; |
| 110 PointerVector<ModuleSnapshot> modules_; | 119 PointerVector<ModuleSnapshot> modules_; |
| 111 scoped_ptr<ExceptionSnapshot> exception_; | 120 scoped_ptr<ExceptionSnapshot> exception_; |
| 112 | 121 |
| 113 DISALLOW_COPY_AND_ASSIGN(TestProcessSnapshot); | 122 DISALLOW_COPY_AND_ASSIGN(TestProcessSnapshot); |
| 114 }; | 123 }; |
| 115 | 124 |
| 116 } // namespace test | 125 } // namespace test |
| 117 } // namespace crashpad | 126 } // namespace crashpad |
| 118 | 127 |
| 119 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ | 128 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ |
| OLD | NEW |