Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_METRICS_CALL_STACK_PROFILE_COLLECTOR_H_ | 5 #ifndef COMPONENTS_METRICS_CALL_STACK_PROFILE_COLLECTOR_H_ |
| 6 #define COMPONENTS_METRICS_CALL_STACK_PROFILE_COLLECTOR_H_ | 6 #define COMPONENTS_METRICS_CALL_STACK_PROFILE_COLLECTOR_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "components/metrics/public/interfaces/call_stack_profile_collector.mojo m.h" | 9 #include "components/metrics/public/interfaces/call_stack_profile_collector.mojo m.h" |
| 10 | 10 |
| 11 namespace metrics { | 11 namespace metrics { |
| 12 | 12 |
| 13 class CallStackProfileCollector : public mojom::CallStackProfileCollector { | 13 class CallStackProfileCollector : public mojom::CallStackProfileCollector { |
| 14 public: | 14 public: |
| 15 using CallStackProfile = base::StackSamplingProfiler::CallStackProfile; | 15 using CallStackProfile = base::StackSamplingProfiler::CallStackProfile; |
| 16 | 16 |
| 17 CallStackProfileCollector(); | 17 CallStackProfileCollector(CallStackProfileParams::Process expected_process); |
|
sky
2016/09/21 22:06:16
explicit
Mike Wittman
2016/09/21 22:26:21
Done.
| |
| 18 ~CallStackProfileCollector() override; | 18 ~CallStackProfileCollector() override; |
| 19 | 19 |
| 20 static void Create(mojom::CallStackProfileCollectorRequest request); | 20 // Create a collector to receive profiles from |expected_process|. |
| 21 static void Create(CallStackProfileParams::Process expected_process, | |
| 22 mojom::CallStackProfileCollectorRequest request); | |
| 21 | 23 |
| 22 // mojom::CallStackProfileCollector: | 24 // mojom::CallStackProfileCollector: |
| 23 void Collect(const CallStackProfileParams& params, | 25 void Collect(const CallStackProfileParams& params, |
| 24 base::TimeTicks start_timestamp, | 26 base::TimeTicks start_timestamp, |
| 25 const std::vector<CallStackProfile>& profiles) override; | 27 const std::vector<CallStackProfile>& profiles) override; |
| 26 | 28 |
| 27 private: | 29 private: |
| 30 // Profile params are validated to come from this process. Profiles with a | |
| 31 // different process declared in the params are considered untrustworthy and | |
| 32 // ignored. | |
| 33 CallStackProfileParams::Process expected_process_; | |
|
sky
2016/09/21 22:06:16
const
Mike Wittman
2016/09/21 22:26:21
Done.
| |
| 34 | |
| 28 DISALLOW_COPY_AND_ASSIGN(CallStackProfileCollector); | 35 DISALLOW_COPY_AND_ASSIGN(CallStackProfileCollector); |
| 29 }; | 36 }; |
| 30 | 37 |
| 31 } // namespace metrics | 38 } // namespace metrics |
| 32 | 39 |
| 33 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_COLLECTOR_H_ | 40 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_COLLECTOR_H_ |
| OLD | NEW |