OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
ncarter (slow)
2016/12/05 19:50:50
2016 (I think you missed this)
Navid Zolghadr
2016/12/06 19:10:33
Done.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_RAPPOR_PUBLIC_RAPPOR_PUBLIC_SERVICE_H_ | |
ncarter (slow)
2016/12/05 19:50:50
This file should be renamed to rappor/public/rappo
Navid Zolghadr
2016/12/06 19:10:33
Done.
| |
6 #define COMPONENTS_RAPPOR_PUBLIC_RAPPOR_PUBLIC_SERVICE_H_ | |
7 | |
8 #include <memory> | |
9 #include <string> | |
10 | |
11 #include "base/memory/weak_ptr.h" | |
12 #include "components/rappor/public/rappor_parameters.h" | |
13 #include "components/rappor/public/sample.h" | |
14 | |
15 namespace rappor { | |
16 | |
17 // This class provides a public interface for recording samples for rappor | |
18 // metrics, which other components can be depended on. | |
19 class RapporService : public base::SupportsWeakPtr<RapporService> { | |
20 public: | |
21 // Constructs a Sample object for the caller to record fields in. | |
22 virtual std::unique_ptr<Sample> CreateSample(RapporType) = 0; | |
23 | |
24 // Records a Sample of rappor metric specified by |metric_name|. | |
25 // | |
26 // example: | |
27 // std::unique_ptr<Sample> sample = | |
28 // rappor_service->CreateSample(MY_METRIC_TYPE); | |
29 // sample->SetStringField("Field1", "some string"); | |
30 // sample->SetFlagsValue("Field2", SOME|FLAGS); | |
31 // rappor_service->RecordSample("MyMetric", std::move(sample)); | |
32 virtual void RecordSample(const std::string& metric_name, | |
33 std::unique_ptr<Sample> sample) = 0; | |
34 | |
35 // Records a sample of the rappor metric specified by |metric_name|. | |
36 // Creates and initializes the metric, if it doesn't yet exist. | |
37 virtual void RecordSampleString(const std::string& metric_name, | |
38 RapporType type, | |
39 const std::string& sample) = 0; | |
40 }; | |
41 | |
42 } // namespace rappor | |
43 | |
44 #endif // COMPONENTS_RAPPOR_PUBLIC_RAPPOR_PUBLIC_SERVICE_H_ | |
OLD | NEW |