Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: mojo/services/test_service/test_request_tracker_impl.h

Issue 1760383002: Remove some unneeded directories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: , Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_TEST_SERVICE_TEST_REQUEST_TRACKER_IMPL_H_
6 #define SERVICES_TEST_SERVICE_TEST_REQUEST_TRACKER_IMPL_H_
7
8 #include <stdint.h>
9
10 #include "base/memory/weak_ptr.h"
11 #include "mojo/public/cpp/bindings/strong_binding.h"
12 #include "mojo/public/cpp/system/macros.h"
13 #include "mojo/services/test_service/test_request_tracker.mojom.h"
14
15 namespace mojo {
16 namespace test {
17
18 typedef std::map<uint64_t, std::vector<ServiceStats> > AllRecordsMap;
19
20 // Shared state between all instances of TestRequestTrackerImpl
21 // and the master TrackedRequestService.
22 struct TrackingContext {
23 TrackingContext();
24 ~TrackingContext();
25 AllRecordsMap records;
26 std::map<uint64_t, std::string> ids_to_names;
27 uint64_t next_id;
28 };
29
30 class TestRequestTrackerImpl : public TestRequestTracker {
31 public:
32 TestRequestTrackerImpl(InterfaceRequest<TestRequestTracker> request,
33 TrackingContext* context);
34 ~TestRequestTrackerImpl() override;
35
36 // TestRequestTracker.
37 void SetNameAndReturnId(const String& service_name,
38 const Callback<void(uint64_t id)>& callback) override;
39 void RecordStats(uint64_t client_id, ServiceStatsPtr stats) override;
40
41 private:
42 void UploaderNameCallback(uint64_t id, const mojo::String& name);
43 TrackingContext* context_;
44 StrongBinding<TestRequestTracker> binding_;
45 base::WeakPtrFactory<TestRequestTrackerImpl> weak_factory_;
46 DISALLOW_COPY_AND_ASSIGN(TestRequestTrackerImpl);
47 };
48
49 class TestTrackedRequestServiceImpl : public TestTrackedRequestService {
50 public:
51 TestTrackedRequestServiceImpl(
52 InterfaceRequest<TestTrackedRequestService> request,
53 TrackingContext* context);
54 ~TestTrackedRequestServiceImpl() override;
55
56 // |TestTrackedRequestService| implementation.
57 void GetReport(const mojo::Callback<void(mojo::Array<ServiceReportPtr>)>&
58 callback) override;
59
60 private:
61 TrackingContext* context_;
62 StrongBinding<TestTrackedRequestService> binding_;
63
64 DISALLOW_COPY_AND_ASSIGN(TestTrackedRequestServiceImpl);
65 };
66
67 } // namespace test
68 } // namespace mojo
69
70 #endif // SERVICES_TEST_SERVICE_TEST_REQUEST_TRACKER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698