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

Side by Side Diff: components/reporting/core/browser/reporting_cache.cc

Issue 2249213002: [OBSOLETE] Reporting: Initial implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ProfileImplIOData Created 4 years, 2 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 2016 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 #include "components/reporting/core/browser/reporting_cache.h"
6
7 namespace reporting {
8
9 ReportingCache::ReportingCache() {}
10 ReportingCache::~ReportingCache() {}
11
12 void ReportingCache::InsertEndpoint(
13 std::unique_ptr<ReportingEndpoint> endpoint) {
14 DCHECK(endpoint);
15 endpoints_[endpoint->url] = std::move(endpoint);
16 }
17
18 const std::unique_ptr<ReportingEndpoint>* ReportingCache::GetEndpoint(
19 const GURL& url) const {
20 EndpointMap::const_iterator it = endpoints_.find(url);
21 if (it == endpoints_.cend())
22 return nullptr;
23 return &it->second;
24 }
25
26 const ReportingCache::EndpointMap& ReportingCache::GetEndpoints() const {
27 return endpoints_;
28 }
29
30 void ReportingCache::RemoveEndpoint(
31 const std::unique_ptr<ReportingEndpoint>& endpoint) {
32 endpoints_.erase(endpoint->url);
33 }
34
35 void ReportingCache::EnqueueReport(std::unique_ptr<ReportingReport> report) {
36 DCHECK(report);
37 reports_.insert(std::move(report));
38 }
39
40 const ReportingCache::ReportSet& ReportingCache::GetReports() const {
41 return reports_;
42 }
43
44 void ReportingCache::DequeueReport(
45 const std::unique_ptr<ReportingReport>& report) {
46 DCHECK(report);
47 reports_.erase(report);
48 }
49
50 void ReportingCache::Clear() {
51 endpoints_.clear();
52 reports_.clear();
53 }
54
55 } // namespace reporting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698