Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: components/metrics/public/cpp/call_stack_profile_struct_traits.h

Issue 2444143002: Add process lifetime annotations to stack samples. (Closed)
Patch Set: abandon generator for on-the-fly Profiles creation Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/metrics/public/cpp/call_stack_profile_struct_traits.h
diff --git a/components/metrics/public/cpp/call_stack_profile_struct_traits.h b/components/metrics/public/cpp/call_stack_profile_struct_traits.h
index d2ec654205dfe019590e0d52f16b61edfd72e274..d76325c758624a153267f59b95e66387e190ae67 100644
--- a/components/metrics/public/cpp/call_stack_profile_struct_traits.h
+++ b/components/metrics/public/cpp/call_stack_profile_struct_traits.h
@@ -80,6 +80,31 @@ struct StructTraits<metrics::mojom::CallStackFrameDataView,
};
template <>
+struct StructTraits<metrics::mojom::CallStackSampleDataView,
+ base::StackSamplingProfiler::Sample> {
+ static const std::vector<base::StackSamplingProfiler::Frame>& frames(
+ const base::StackSamplingProfiler::Sample& sample) {
+ return sample.frames;
+ }
+ static int32_t process_phases(
+ const base::StackSamplingProfiler::Sample& sample) {
+ return sample.process_phases;
+ }
+
+ static bool Read(metrics::mojom::CallStackSampleDataView data,
+ base::StackSamplingProfiler::Sample* out) {
+ std::vector<base::StackSamplingProfiler::Frame> frames;
+ if (!data.ReadFrames(&frames))
+ return false;
+
+ *out = base::StackSamplingProfiler::Sample();
+ out->frames = std::move(frames);
+ out->process_phases = data.process_phases();
+ return true;
+ }
+};
+
+template <>
struct StructTraits<metrics::mojom::CallStackProfileDataView,
base::StackSamplingProfiler::CallStackProfile> {
static const std::vector<base::StackSamplingProfiler::Module>& modules(
@@ -103,7 +128,7 @@ struct StructTraits<metrics::mojom::CallStackProfileDataView,
std::vector<base::StackSamplingProfiler::Sample> samples,
size_t module_count) {
for (const base::StackSamplingProfiler::Sample& sample : samples) {
- for (const base::StackSamplingProfiler::Frame& frame : sample) {
+ for (const base::StackSamplingProfiler::Frame& frame : sample.frames) {
if (frame.module_index >= module_count &&
frame.module_index !=
base::StackSamplingProfiler::Frame::kUnknownModuleIndex)

Powered by Google App Engine
This is Rietveld 408576698