| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "net/reporting/reporting_cache.h" | 5 #include "net/reporting/reporting_cache.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "net/reporting/reporting_client.h" | 16 #include "net/reporting/reporting_client.h" |
| 17 #include "net/reporting/reporting_report.h" | 17 #include "net/reporting/reporting_report.h" |
| 18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 | 21 |
| 22 ReportingCache::ReportingCache() {} | 22 ReportingCache::ReportingCache(ReportingContext* context) : context_(context) { |
| 23 DCHECK(context_); |
| 24 } |
| 23 | 25 |
| 24 ReportingCache::~ReportingCache() {} | 26 ReportingCache::~ReportingCache() {} |
| 25 | 27 |
| 26 void ReportingCache::AddReport(const GURL& url, | 28 void ReportingCache::AddReport(const GURL& url, |
| 27 const std::string& group, | 29 const std::string& group, |
| 28 const std::string& type, | 30 const std::string& type, |
| 29 std::unique_ptr<const base::Value> body, | 31 std::unique_ptr<const base::Value> body, |
| 30 base::TimeTicks queued, | 32 base::TimeTicks queued, |
| 31 int attempts) { | 33 int attempts) { |
| 32 auto report = base::MakeUnique<ReportingReport>( | 34 auto report = base::MakeUnique<ReportingReport>( |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 void ReportingCache::RemoveClientsForEndpoint(const GURL& endpoint) { | 163 void ReportingCache::RemoveClientsForEndpoint(const GURL& endpoint) { |
| 162 for (auto& it : clients_) | 164 for (auto& it : clients_) |
| 163 it.second.erase(endpoint); | 165 it.second.erase(endpoint); |
| 164 } | 166 } |
| 165 | 167 |
| 166 void ReportingCache::RemoveAllClients() { | 168 void ReportingCache::RemoveAllClients() { |
| 167 clients_.clear(); | 169 clients_.clear(); |
| 168 } | 170 } |
| 169 | 171 |
| 170 } // namespace net | 172 } // namespace net |
| OLD | NEW |