| 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_THREAD_SNAPSHOT_H_ | 15 #ifndef CRASHPAD_SNAPSHOT_TEST_TEST_THREAD_SNAPSHOT_H_ |
| 16 #define CRASHPAD_SNAPSHOT_TEST_TEST_THREAD_SNAPSHOT_H_ | 16 #define CRASHPAD_SNAPSHOT_TEST_TEST_THREAD_SNAPSHOT_H_ |
| 17 | 17 |
| 18 #include <stdint.h> | 18 #include <stdint.h> |
| 19 | 19 |
| 20 #include <vector> | 20 #include <vector> |
| 21 | 21 |
| 22 #include "base/basictypes.h" | 22 #include "base/basictypes.h" |
| 23 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
| 24 #include "snapshot/cpu_context.h" | 24 #include "snapshot/cpu_context.h" |
| 25 #include "snapshot/memory_snapshot.h" | 25 #include "snapshot/memory_snapshot.h" |
| 26 #include "snapshot/thread_snapshot.h" | 26 #include "snapshot/thread_snapshot.h" |
| 27 #include "util/stdlib/move.h" |
| 27 #include "util/stdlib/pointer_container.h" | 28 #include "util/stdlib/pointer_container.h" |
| 28 | 29 |
| 29 namespace crashpad { | 30 namespace crashpad { |
| 30 namespace test { | 31 namespace test { |
| 31 | 32 |
| 32 //! \brief A test ThreadSnapshot that can carry arbitrary data for testing | 33 //! \brief A test ThreadSnapshot that can carry arbitrary data for testing |
| 33 //! purposes. | 34 //! purposes. |
| 34 class TestThreadSnapshot final : public ThreadSnapshot { | 35 class TestThreadSnapshot final : public ThreadSnapshot { |
| 35 public: | 36 public: |
| 36 TestThreadSnapshot(); | 37 TestThreadSnapshot(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 48 //! data so that a caller can populate the context structure directly. | 49 //! data so that a caller can populate the context structure directly. |
| 49 //! This is done because providing setter interfaces to each field in the | 50 //! This is done because providing setter interfaces to each field in the |
| 50 //! context structure would be unwieldy and cumbersome. Care must be taken | 51 //! context structure would be unwieldy and cumbersome. Care must be taken |
| 51 //! to populate the context structure correctly. | 52 //! to populate the context structure correctly. |
| 52 CPUContext* MutableContext() { return &context_; } | 53 CPUContext* MutableContext() { return &context_; } |
| 53 | 54 |
| 54 //! \brief Sets the memory region to be returned by Stack(). | 55 //! \brief Sets the memory region to be returned by Stack(). |
| 55 //! | 56 //! |
| 56 //! \param[in] stack The memory region that Stack() will return. The | 57 //! \param[in] stack The memory region that Stack() will return. The |
| 57 //! TestThreadSnapshot object takes ownership of \a stack. | 58 //! TestThreadSnapshot object takes ownership of \a stack. |
| 58 void SetStack(scoped_ptr<MemorySnapshot> stack) { stack_ = stack.Pass(); } | 59 void SetStack(scoped_ptr<MemorySnapshot> stack) { |
| 60 stack_ = crashpad::move(stack); |
| 61 } |
| 59 | 62 |
| 60 void SetThreadID(uint64_t thread_id) { thread_id_ = thread_id; } | 63 void SetThreadID(uint64_t thread_id) { thread_id_ = thread_id; } |
| 61 void SetSuspendCount(int suspend_count) { suspend_count_ = suspend_count; } | 64 void SetSuspendCount(int suspend_count) { suspend_count_ = suspend_count; } |
| 62 void SetPriority(int priority) { priority_ = priority; } | 65 void SetPriority(int priority) { priority_ = priority; } |
| 63 void SetThreadSpecificDataAddress(uint64_t thread_specific_data_address) { | 66 void SetThreadSpecificDataAddress(uint64_t thread_specific_data_address) { |
| 64 thread_specific_data_address_ = thread_specific_data_address; | 67 thread_specific_data_address_ = thread_specific_data_address; |
| 65 } | 68 } |
| 66 | 69 |
| 67 //! \brief Add a memory snapshot to be returned by ExtraMemory(). | 70 //! \brief Add a memory snapshot to be returned by ExtraMemory(). |
| 68 //! | 71 //! |
| (...skipping 27 matching lines...) Expand all Loading... |
| 96 uint64_t thread_specific_data_address_; | 99 uint64_t thread_specific_data_address_; |
| 97 PointerVector<MemorySnapshot> extra_memory_; | 100 PointerVector<MemorySnapshot> extra_memory_; |
| 98 | 101 |
| 99 DISALLOW_COPY_AND_ASSIGN(TestThreadSnapshot); | 102 DISALLOW_COPY_AND_ASSIGN(TestThreadSnapshot); |
| 100 }; | 103 }; |
| 101 | 104 |
| 102 } // namespace test | 105 } // namespace test |
| 103 } // namespace crashpad | 106 } // namespace crashpad |
| 104 | 107 |
| 105 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_THREAD_SNAPSHOT_H_ | 108 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_THREAD_SNAPSHOT_H_ |
| OLD | NEW |