Index: components/metrics/call_stack_profile_collector.h |
diff --git a/components/metrics/call_stack_profile_collector.h b/components/metrics/call_stack_profile_collector.h |
index cfae8c8f9e05351a09e877029141faf18305c52b..f6a2ca1ce53925053a1e89ccbb4fb29cefa3486a 100644 |
--- a/components/metrics/call_stack_profile_collector.h |
+++ b/components/metrics/call_stack_profile_collector.h |
@@ -14,10 +14,13 @@ class CallStackProfileCollector : public mojom::CallStackProfileCollector { |
public: |
using CallStackProfile = base::StackSamplingProfiler::CallStackProfile; |
- CallStackProfileCollector(); |
+ explicit CallStackProfileCollector( |
+ CallStackProfileParams::Process expected_process); |
~CallStackProfileCollector() override; |
- static void Create(mojom::CallStackProfileCollectorRequest request); |
+ // Create a collector to receive profiles from |expected_process|. |
+ static void Create(CallStackProfileParams::Process expected_process, |
+ mojom::CallStackProfileCollectorRequest request); |
// mojom::CallStackProfileCollector: |
void Collect(const CallStackProfileParams& params, |
@@ -25,6 +28,11 @@ class CallStackProfileCollector : public mojom::CallStackProfileCollector { |
const std::vector<CallStackProfile>& profiles) override; |
private: |
+ // Profile params are validated to come from this process. Profiles with a |
+ // different process declared in the params are considered untrustworthy and |
+ // ignored. |
+ const CallStackProfileParams::Process expected_process_; |
+ |
DISALLOW_COPY_AND_ASSIGN(CallStackProfileCollector); |
}; |