| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef SERVICES_TEST_SERVICE_TEST_REQUEST_TRACKER_CLIENT_IMPL_H_ | 5 #ifndef SERVICES_TEST_SERVICE_TRACKED_SERVICE_H_ |
| 6 #define SERVICES_TEST_SERVICE_TEST_REQUEST_TRACKER_CLIENT_IMPL_H_ | 6 #define SERVICES_TEST_SERVICE_TRACKED_SERVICE_H_ |
| 7 | 7 |
| 8 #include "mojo/public/cpp/system/macros.h" | 8 #include "mojo/public/cpp/system/macros.h" |
| 9 #include "services/test_service/test_request_tracker.mojom.h" | 9 #include "services/test_service/test_request_tracker.mojom.h" |
| 10 | 10 |
| 11 namespace mojo { | 11 namespace mojo { |
| 12 namespace test { | 12 namespace test { |
| 13 | 13 |
| 14 class TestRequestTrackerClientImpl : public TestRequestTrackerClient { | 14 class TrackedService { |
| 15 public: | 15 public: |
| 16 TestRequestTrackerClientImpl( | 16 TrackedService(TestRequestTrackerPtr tracker, |
| 17 TestRequestTrackerPtr tracker, | 17 const std::string& service_name, |
| 18 const std::string& service_name, | 18 const mojo::Callback<void()>& tracking_connected_callback); |
| 19 const mojo::Callback<void()>& tracking_connected_callback); | 19 ~TrackedService(); |
| 20 ~TestRequestTrackerClientImpl() override; | |
| 21 | 20 |
| 22 // Call whenever an event happens that you want to be recorded. | 21 // Call whenever an event happens that you want to be recorded. |
| 23 void RecordNewRequest(); | 22 void RecordNewRequest(); |
| 24 | 23 |
| 25 // TestRequestTrackerClient impl. | 24 private: |
| 26 void SetIdAndReturnName( | 25 void SetId(uint64_t id); |
| 27 uint64_t id, | 26 void SendStats(); |
| 28 const mojo::Callback<void(mojo::String)>& callback) override; | |
| 29 | 27 |
| 30 private: | |
| 31 void SendStats(); | |
| 32 uint64_t id_; | 28 uint64_t id_; |
| 33 uint64_t requests_since_upload_; | 29 uint64_t requests_since_upload_; |
| 34 const std::string service_name_; | 30 const std::string service_name_; |
| 35 TestRequestTrackerPtr tracker_; | 31 TestRequestTrackerPtr tracker_; |
| 36 mojo::Callback<void()> tracking_connected_callback_; | 32 mojo::Callback<void()> tracking_connected_callback_; |
| 37 }; | 33 }; |
| 38 | 34 |
| 39 } // namespace test | 35 } // namespace test |
| 40 } // namespace mojo | 36 } // namespace mojo |
| 41 | 37 |
| 42 #endif // SERVICES_TEST_SERVICE_TEST_REQUEST_TRACKER_CLIENT_IMPL_H_ | 38 #endif // SERVICES_TEST_SERVICE_TRACKED_SERVICE_H_ |
| OLD | NEW |