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

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

Issue 1180223006: Domain Reliability: Simplify configs and reports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix memory leak in unittests Created 5 years, 1 month 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_MANAGER_H_ 5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_MANAGER_H_
6 #define COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_MANAGER_H_ 6 #define COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "components/domain_reliability/beacon.h" 14 #include "components/domain_reliability/beacon.h"
15 #include "components/domain_reliability/config.h" 15 #include "components/domain_reliability/config.h"
16 #include "components/domain_reliability/context.h" 16 #include "components/domain_reliability/context.h"
17 #include "components/domain_reliability/domain_reliability_export.h" 17 #include "components/domain_reliability/domain_reliability_export.h"
18 #include "url/gurl.h" 18 #include "url/gurl.h"
19 19
20 namespace domain_reliability { 20 namespace domain_reliability {
21 21
22 class DOMAIN_RELIABILITY_EXPORT DomainReliabilityContextManager { 22 class DOMAIN_RELIABILITY_EXPORT DomainReliabilityContextManager {
23 public: 23 public:
24 DomainReliabilityContextManager( 24 DomainReliabilityContextManager(
25 DomainReliabilityContext::Factory* context_factory); 25 DomainReliabilityContext::Factory* context_factory);
26 ~DomainReliabilityContextManager(); 26 ~DomainReliabilityContextManager();
27 27
28 // If |url| maps to a context added to this manager, calls |OnBeacon| on 28 // If |url| maps to a context added to this manager, calls |OnBeacon| on
29 // that context with |beacon|. Otherwise, does nothing. 29 // that context with |beacon|. Otherwise, does nothing.
30 void RouteBeacon(const GURL& url, const DomainReliabilityBeacon& beacon); 30 void RouteBeacon(scoped_ptr<DomainReliabilityBeacon> beacon);
31 31
32 // Calls |ClearBeacons| on all contexts added to this manager, but leaves 32 // Calls |ClearBeacons| on all contexts added to this manager, but leaves
33 // the contexts themselves intact. 33 // the contexts themselves intact.
34 void ClearBeaconsInAllContexts(); 34 void ClearBeaconsInAllContexts();
35 35
36 // TODO(ttuttle): Once unit tests test ContextManager directly, they can use 36 // TODO(ttuttle): Once unit tests test ContextManager directly, they can use
37 // a custom Context::Factory to get the created Context, and this can be void. 37 // a custom Context::Factory to get the created Context, and this can be void.
38 DomainReliabilityContext* AddContextForConfig( 38 DomainReliabilityContext* AddContextForConfig(
39 scoped_ptr<const DomainReliabilityConfig> config); 39 scoped_ptr<const DomainReliabilityConfig> config);
40 40
(...skipping 13 matching lines...) Expand all
54 DomainReliabilityContext::Factory* context_factory_; 54 DomainReliabilityContext::Factory* context_factory_;
55 // Owns DomainReliabilityContexts. 55 // Owns DomainReliabilityContexts.
56 ContextMap contexts_; 56 ContextMap contexts_;
57 57
58 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityContextManager); 58 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityContextManager);
59 }; 59 };
60 60
61 } // namespace domain_reliability 61 } // namespace domain_reliability
62 62
63 #endif // COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_MANAGER_H_ 63 #endif // COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_MANAGER_H_
OLDNEW
« no previous file with comments | « components/domain_reliability/context.cc ('k') | components/domain_reliability/context_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698