Chromium Code Reviews| Index: base/debug/activity_tracker.h |
| diff --git a/base/debug/activity_tracker.h b/base/debug/activity_tracker.h |
| index 9ffcfaa844ba22ee9edee16dcade2481f5a4f011..114e2daeda65f633cd550d6d224610a148dbd14d 100644 |
| --- a/base/debug/activity_tracker.h |
| +++ b/base/debug/activity_tracker.h |
| @@ -61,6 +61,11 @@ enum : int { |
| // sized types to ensure no interoperability problems between 32-bit and |
| // 64-bit systems. |
| union ActivityData { |
| + // SHA1(base::debug::ActivityData): Increment this if structure changes! |
| + static constexpr uint32_t kPersistentTypeId = 0x72DC176D + 1; |
| + // Expected size for 32/64-bit check. Update this if structure changes! |
| + static constexpr size_t kExpectedInstanceSize = 8; |
|
manzagop (departed)
2017/02/17 15:50:55
static_assert for this? Same below.
bcwhite
2017/02/17 15:52:11
These sizes are asserted by the PMA when using the
|
| + |
| // Generic activities don't have any defined structure. |
| struct { |
| uint32_t id; // An arbitrary identifier used for association. |
| @@ -162,7 +167,7 @@ class BASE_EXPORT ActivityTrackerMemoryAllocator { |
| // Helper function to access an object allocated using this instance. |
| template <typename T> |
| T* GetAsObject(Reference ref) { |
| - return allocator_->GetAsObject<T>(ref, object_type_); |
| + return allocator_->GetAsObject<T>(ref); |
| } |
| // Similar to GetAsObject() but converts references to arrays of objects. |
| @@ -198,6 +203,12 @@ class BASE_EXPORT ActivityTrackerMemoryAllocator { |
| // the |data| field. All fields must be explicitly sized types to ensure no |
| // interoperability problems between 32-bit and 64-bit systems. |
| struct Activity { |
| + // SHA1(base::debug::Activity): Increment this if structure changes! |
| + static constexpr uint32_t kPersistentTypeId = 0x99425159 + 1; |
| + // Expected size for 32/64-bit check. Update this if structure changes! |
| + static constexpr size_t kExpectedInstanceSize = |
| + 48 + ActivityData::kExpectedInstanceSize; |
| + |
| // The type of an activity on the stack. Activities are broken into |
| // categories with the category ID taking the top 4 bits and the lower |
| // bits representing an action within that category. This combination |