| 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 service_manager { |
| 12 struct BindSourceInfo; |
| 13 } |
| 14 |
| 11 namespace metrics { | 15 namespace metrics { |
| 12 | 16 |
| 13 class CallStackProfileCollector : public mojom::CallStackProfileCollector { | 17 class CallStackProfileCollector : public mojom::CallStackProfileCollector { |
| 14 public: | 18 public: |
| 15 using CallStackProfile = base::StackSamplingProfiler::CallStackProfile; | 19 using CallStackProfile = base::StackSamplingProfiler::CallStackProfile; |
| 16 | 20 |
| 17 explicit CallStackProfileCollector( | 21 explicit CallStackProfileCollector( |
| 18 CallStackProfileParams::Process expected_process); | 22 CallStackProfileParams::Process expected_process); |
| 19 ~CallStackProfileCollector() override; | 23 ~CallStackProfileCollector() override; |
| 20 | 24 |
| 21 // Create a collector to receive profiles from |expected_process|. | 25 // Create a collector to receive profiles from |expected_process|. |
| 22 static void Create(CallStackProfileParams::Process expected_process, | 26 static void Create(CallStackProfileParams::Process expected_process, |
| 27 const service_manager::BindSourceInfo& source_info, |
| 23 mojom::CallStackProfileCollectorRequest request); | 28 mojom::CallStackProfileCollectorRequest request); |
| 24 | 29 |
| 25 // mojom::CallStackProfileCollector: | 30 // mojom::CallStackProfileCollector: |
| 26 void Collect(const CallStackProfileParams& params, | 31 void Collect(const CallStackProfileParams& params, |
| 27 base::TimeTicks start_timestamp, | 32 base::TimeTicks start_timestamp, |
| 28 std::vector<CallStackProfile> profiles) override; | 33 std::vector<CallStackProfile> profiles) override; |
| 29 | 34 |
| 30 private: | 35 private: |
| 31 // Profile params are validated to come from this process. Profiles with a | 36 // Profile params are validated to come from this process. Profiles with a |
| 32 // different process declared in the params are considered untrustworthy and | 37 // different process declared in the params are considered untrustworthy and |
| 33 // ignored. | 38 // ignored. |
| 34 const CallStackProfileParams::Process expected_process_; | 39 const CallStackProfileParams::Process expected_process_; |
| 35 | 40 |
| 36 DISALLOW_COPY_AND_ASSIGN(CallStackProfileCollector); | 41 DISALLOW_COPY_AND_ASSIGN(CallStackProfileCollector); |
| 37 }; | 42 }; |
| 38 | 43 |
| 39 } // namespace metrics | 44 } // namespace metrics |
| 40 | 45 |
| 41 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_COLLECTOR_H_ | 46 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_COLLECTOR_H_ |
| OLD | NEW |