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 #include "components/metrics/call_stack_profile_collector.h" | 5 #include "components/metrics/call_stack_profile_collector.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "components/metrics/call_stack_profile_metrics_provider.h" | 8 #include "components/metrics/call_stack_profile_metrics_provider.h" |
9 #include "mojo/public/cpp/bindings/interface_request.h" | 9 #include "mojo/public/cpp/bindings/interface_request.h" |
10 #include "mojo/public/cpp/bindings/strong_binding.h" | 10 #include "mojo/public/cpp/bindings/strong_binding.h" |
11 | 11 |
12 namespace metrics { | 12 namespace metrics { |
13 | 13 |
14 CallStackProfileCollector::CallStackProfileCollector() {} | 14 CallStackProfileCollector::CallStackProfileCollector( |
| 15 CallStackProfileParams::Process expected_process) |
| 16 : expected_process_(expected_process) {} |
15 | 17 |
16 CallStackProfileCollector::~CallStackProfileCollector() {} | 18 CallStackProfileCollector::~CallStackProfileCollector() {} |
17 | 19 |
18 // static | 20 // static |
19 void CallStackProfileCollector::Create( | 21 void CallStackProfileCollector::Create( |
| 22 CallStackProfileParams::Process expected_process, |
20 mojom::CallStackProfileCollectorRequest request) { | 23 mojom::CallStackProfileCollectorRequest request) { |
21 mojo::MakeStrongBinding(base::MakeUnique<CallStackProfileCollector>(), | 24 mojo::MakeStrongBinding( |
22 std::move(request)); | 25 base::MakeUnique<CallStackProfileCollector>(expected_process), |
| 26 std::move(request)); |
23 } | 27 } |
24 | 28 |
25 void CallStackProfileCollector::Collect( | 29 void CallStackProfileCollector::Collect( |
26 const CallStackProfileParams& params, | 30 const CallStackProfileParams& params, |
27 base::TimeTicks start_timestamp, | 31 base::TimeTicks start_timestamp, |
28 const std::vector<CallStackProfile>& profiles) { | 32 const std::vector<CallStackProfile>& profiles) { |
| 33 if (params.process != expected_process_) |
| 34 return; |
| 35 |
29 CallStackProfileMetricsProvider::ReceiveCompletedProfiles(params, | 36 CallStackProfileMetricsProvider::ReceiveCompletedProfiles(params, |
30 start_timestamp, | 37 start_timestamp, |
31 profiles); | 38 profiles); |
32 } | 39 } |
33 | 40 |
34 } // namespace metrics | 41 } // namespace metrics |
OLD | NEW |