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

Side by Side Diff: components/domain_reliability/context.h

Issue 357103002: Domain Reliability: Add rudimentary WebUI page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
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 COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_ 5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_
6 #define COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_ 6 #define COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "components/domain_reliability/config.h" 14 #include "components/domain_reliability/config.h"
15 #include "components/domain_reliability/domain_reliability_export.h" 15 #include "components/domain_reliability/domain_reliability_export.h"
16 #include "components/domain_reliability/scheduler.h" 16 #include "components/domain_reliability/scheduler.h"
17 17
18 class GURL; 18 class GURL;
19 19
20 namespace base {
21 class Value;
22 }
23
20 namespace domain_reliability { 24 namespace domain_reliability {
21 25
22 struct DomainReliabilityBeacon; 26 struct DomainReliabilityBeacon;
23 class DomainReliabilityDispatcher; 27 class DomainReliabilityDispatcher;
24 class DomainReliabilityUploader; 28 class DomainReliabilityUploader;
25 class MockableTime; 29 class MockableTime;
26 30
27 // The per-domain context for the Domain Reliability client; includes the 31 // The per-domain context for the Domain Reliability client; includes the
28 // domain's config and per-resource beacon queues. 32 // domain's config and per-resource beacon queues.
29 class DOMAIN_RELIABILITY_EXPORT DomainReliabilityContext { 33 class DOMAIN_RELIABILITY_EXPORT DomainReliabilityContext {
30 public: 34 public:
31 DomainReliabilityContext( 35 DomainReliabilityContext(
32 MockableTime* time, 36 MockableTime* time,
33 const DomainReliabilityScheduler::Params& scheduler_params, 37 const DomainReliabilityScheduler::Params& scheduler_params,
34 const std::string& upload_reporter_string, 38 const std::string& upload_reporter_string,
35 DomainReliabilityDispatcher* dispatcher, 39 DomainReliabilityDispatcher* dispatcher,
36 DomainReliabilityUploader* uploader, 40 DomainReliabilityUploader* uploader,
37 scoped_ptr<const DomainReliabilityConfig> config); 41 scoped_ptr<const DomainReliabilityConfig> config);
38 ~DomainReliabilityContext(); 42 ~DomainReliabilityContext();
39 43
40 // Notifies the context of a beacon on its domain(s); may or may not save the 44 // Notifies the context of a beacon on its domain(s); may or may not save the
41 // actual beacon to be uploaded, depending on the sample rates in the config, 45 // actual beacon to be uploaded, depending on the sample rates in the config,
42 // but will increment one of the request counters in any case. 46 // but will increment one of the request counters in any case.
43 void OnBeacon(const GURL& url, const DomainReliabilityBeacon& beacon); 47 void OnBeacon(const GURL& url, const DomainReliabilityBeacon& beacon);
44 48
45 // Called to clear browsing data, since beacons are like browsing history. 49 // Called to clear browsing data, since beacons are like browsing history.
46 void ClearBeacons(); 50 void ClearBeacons();
47 51
52 // Gets a Value containing data that can be formatted into a web page for
53 // debugging purposes.
54 scoped_ptr<base::Value> GetWebUIData() const;
55
48 void GetQueuedDataForTesting( 56 void GetQueuedDataForTesting(
49 size_t resource_index, 57 size_t resource_index,
50 std::vector<DomainReliabilityBeacon>* beacons_out, 58 std::vector<DomainReliabilityBeacon>* beacons_out,
51 uint32* successful_requests_out, 59 uint32* successful_requests_out,
52 uint32* failed_requests_out) const; 60 uint32* failed_requests_out) const;
53 61
54 const DomainReliabilityConfig& config() const { return *config_.get(); } 62 const DomainReliabilityConfig& config() const { return *config_.get(); }
55 63
56 // Maximum number of beacons queued per context; if more than this many are 64 // Maximum number of beacons queued per context; if more than this many are
57 // queued; the oldest beacons will be removed. 65 // queued; the oldest beacons will be removed.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 base::TimeTicks last_upload_time_; 109 base::TimeTicks last_upload_time_;
102 110
103 base::WeakPtrFactory<DomainReliabilityContext> weak_factory_; 111 base::WeakPtrFactory<DomainReliabilityContext> weak_factory_;
104 112
105 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityContext); 113 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityContext);
106 }; 114 };
107 115
108 } // namespace domain_reliability 116 } // namespace domain_reliability
109 117
110 #endif // COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_ 118 #endif // COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698