activity_tracker_annotation.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_BROWSER_WATCHER_ACTIVITY_TRACKER_ANNOTATION_H_
  5. #define COMPONENTS_BROWSER_WATCHER_ACTIVITY_TRACKER_ANNOTATION_H_
  6. #include <stdint.h>
  7. #include "third_party/crashpad/crashpad/client/annotation.h"
  8. namespace browser_watcher {
  9. // A Crashpad annotation to store the location and size of the buffer used
  10. // for activity tracking. This is used to retrieve and record tracked activities
  11. // from the handler at crash time.
  12. class ActivityTrackerAnnotation : public crashpad::Annotation {
  13. public:
  14. struct ValueType {
  15. uint64_t address;
  16. uint64_t size;
  17. };
  18. static constexpr Type kAnnotationType = Annotation::UserDefinedType(0xBAB);
  19. static const char kAnnotationName[];
  20. void SetValue(const void* address, size_t size);
  21. // Returns the sole instance of this class.
  22. static ActivityTrackerAnnotation* GetInstance();
  23. private:
  24. ActivityTrackerAnnotation();
  25. ValueType value_;
  26. };
  27. } // namespace browser_watcher
  28. #endif // COMPONENTS_BROWSER_WATCHER_ACTIVITY_TRACKER_ANNOTATION_H_