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