blob: 2470ffe849753c6847e514d9e30238fbaa447112 [file] [log] [blame]
James Robinson51b4cd62015-02-04 11:27:40 -08001// Copyright 2014 The Chromium Authors. All rights reserved.
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 SERVICES_TEST_SERVICE_TRACKED_SERVICE_H_
6#define SERVICES_TEST_SERVICE_TRACKED_SERVICE_H_
7
8#include "mojo/public/cpp/system/macros.h"
9#include "services/test_service/test_request_tracker.mojom.h"
10
11namespace mojo {
12namespace test {
13
14class TrackedService {
15 public:
16 TrackedService(TestRequestTrackerPtr tracker,
17 const std::string& service_name,
18 const mojo::Callback<void()>& tracking_connected_callback);
19 ~TrackedService();
20
21 // Call whenever an event happens that you want to be recorded.
22 void RecordNewRequest();
23
24 private:
25 void SetId(uint64_t id);
26 void SendStats();
27
28 uint64_t id_;
29 uint64_t requests_since_upload_;
30 const std::string service_name_;
31 TestRequestTrackerPtr tracker_;
32 mojo::Callback<void()> tracking_connected_callback_;
33};
34
35} // namespace test
36} // namespace mojo
37
38#endif // SERVICES_TEST_SERVICE_TRACKED_SERVICE_H_