OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 GOOGLE_APIS_GCM_ENGINE_CONNECTION_EVENT_TRACKER_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_CONNECTION_EVENT_TRACKER_H_ |
6 #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_EVENT_TRACKER_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_EVENT_TRACKER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "google_apis/gcm/base/gcm_export.h" | 13 #include "google_apis/gcm/base/gcm_export.h" |
14 #include "google_apis/gcm/protocol/mcs.pb.h" | 14 #include "google_apis/gcm/protocol/mcs.pb.h" |
15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
16 | 16 |
17 namespace gcm { | 17 namespace gcm { |
18 | 18 |
19 class GCM_EXPORT ConnectionEventTracker { | 19 class GCM_EXPORT ConnectionEventTracker { |
20 public: | 20 public: |
21 // TODO(harkness): Pass in the storage information. | 21 // TODO(harkness): Pass in the storage information. |
22 ConnectionEventTracker(); | 22 ConnectionEventTracker(); |
23 ~ConnectionEventTracker(); | 23 ~ConnectionEventTracker(); |
24 | 24 |
| 25 // Returns a boolean indicating whether an attempt is currently in progress. |
| 26 bool IsEventInProgress() const; |
| 27 |
25 // Start recording a new connection attempt. This should never be called if | 28 // Start recording a new connection attempt. This should never be called if |
26 // a connection attempt is already ongoing. | 29 // a connection attempt is already ongoing. |
27 void StartConnectionAttempt(); | 30 void StartConnectionAttempt(); |
28 | 31 |
29 // Ends the record for a connection attempt and moves it to the completed | 32 // Ends the record for a connection attempt and moves it to the completed |
30 // connections list. | 33 // connections list. |
31 void EndConnectionAttempt(); | 34 void EndConnectionAttempt(); |
32 | 35 |
33 // Record that the existing connection attempt has succeeded. Note that this | 36 // Record that the existing connection attempt has succeeded. Note that this |
34 // doesn't mean the connection is necessarily valid. It could still fail with | 37 // doesn't mean the connection is necessarily valid. It could still fail with |
(...skipping 19 matching lines...) Expand all Loading... |
54 // Number of events which were discarded due to exceeding the total number of | 57 // Number of events which were discarded due to exceeding the total number of |
55 // events collected. This is sent to GCM to represent those events. | 58 // events collected. This is sent to GCM to represent those events. |
56 uint32_t number_discarded_events_ = 0; | 59 uint32_t number_discarded_events_ = 0; |
57 | 60 |
58 DISALLOW_COPY_AND_ASSIGN(ConnectionEventTracker); | 61 DISALLOW_COPY_AND_ASSIGN(ConnectionEventTracker); |
59 }; | 62 }; |
60 | 63 |
61 } // namespace gcm | 64 } // namespace gcm |
62 | 65 |
63 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_EVENT_TRACKER_H_ | 66 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_EVENT_TRACKER_H_ |
OLD | NEW |