Chromium Code Reviews| Index: components/metrics/leak_detector/gnu_build_id_reader.h |
| diff --git a/components/metrics/leak_detector/gnu_build_id_reader.h b/components/metrics/leak_detector/gnu_build_id_reader.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2445f55778b2bc983d00a9b885960666023e2871 |
| --- /dev/null |
| +++ b/components/metrics/leak_detector/gnu_build_id_reader.h |
| @@ -0,0 +1,35 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_METRICS_LEAK_DETECTOR_GNU_BUILD_ID_READER_H_ |
| +#define COMPONENTS_METRICS_LEAK_DETECTOR_GNU_BUILD_ID_READER_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include <vector> |
| + |
| +namespace metrics { |
| +namespace leak_detector { |
| + |
| +// Reads the build ID from the GNU build notes and stores it internally. Since |
| +// the build ID is not expected to change over a process, the stored build ID |
| +// can be referenced repeatedly. |
| +class GNUBuildIDReader { |
| + public: |
| + GNUBuildIDReader(); |
| + ~GNUBuildIDReader(); |
| + |
| + // Reads the build ID and stores it in |build_id_|. |
| + void ReadBuildID(); |
|
Will Harris
2016/07/18 22:03:53
why not just a static function to return the build
Simon Que
2016/07/19 00:29:34
Done.
|
| + |
| + const std::vector<uint8_t>& build_id() const { return build_id_; } |
|
Will Harris
2016/07/18 22:03:53
DCHECK if the build_id_ hasn't been read?
Simon Que
2016/07/19 00:29:34
Done.
|
| + |
| + private: |
| + std::vector<uint8_t> build_id_; |
| +}; |
| + |
| +} // namespace leak_detector |
| +} // namespace metrics |
| + |
| +#endif // COMPONENTS_METRICS_LEAK_DETECTOR_GNU_BUILD_ID_READER_H_ |