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

Side by Side Diff: net/log/net_log_util.cc

Issue 2953483003: Add HostCachePersistenceManager for Cronet (Closed)
Patch Set: move constant Created 3 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
« no previous file with comments | « net/dns/host_cache_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "net/log/net_log_util.h" 5 #include "net/log/net_log_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 DCHECK(host_resolver); 376 DCHECK(host_resolver);
377 HostCache* cache = host_resolver->GetHostCache(); 377 HostCache* cache = host_resolver->GetHostCache();
378 if (cache) { 378 if (cache) {
379 auto dict = base::MakeUnique<base::DictionaryValue>(); 379 auto dict = base::MakeUnique<base::DictionaryValue>();
380 std::unique_ptr<base::Value> dns_config = 380 std::unique_ptr<base::Value> dns_config =
381 host_resolver->GetDnsConfigAsValue(); 381 host_resolver->GetDnsConfigAsValue();
382 if (dns_config) 382 if (dns_config)
383 dict->Set("dns_config", std::move(dns_config)); 383 dict->Set("dns_config", std::move(dns_config));
384 384
385 auto cache_info_dict = base::MakeUnique<base::DictionaryValue>(); 385 auto cache_info_dict = base::MakeUnique<base::DictionaryValue>();
386 auto cache_contents_list = base::MakeUnique<base::ListValue>();
386 387
387 cache_info_dict->SetInteger("capacity", 388 cache_info_dict->SetInteger("capacity",
388 static_cast<int>(cache->max_entries())); 389 static_cast<int>(cache->max_entries()));
389 cache_info_dict->SetInteger("network_changes", cache->network_changes()); 390 cache_info_dict->SetInteger("network_changes", cache->network_changes());
390 391
391 cache_info_dict->Set("entries", 392 cache->GetAsListValue(cache_contents_list.get(),
392 cache->GetAsListValue(/*include_staleness=*/true)); 393 /*include_staleness=*/true);
394 cache_info_dict->Set("entries", std::move(cache_contents_list));
395
393 dict->Set("cache", std::move(cache_info_dict)); 396 dict->Set("cache", std::move(cache_info_dict));
394 net_info_dict->Set(NetInfoSourceToString(NET_INFO_HOST_RESOLVER), 397 net_info_dict->Set(NetInfoSourceToString(NET_INFO_HOST_RESOLVER),
395 std::move(dict)); 398 std::move(dict));
396 } 399 }
397 } 400 }
398 401
399 HttpNetworkSession* http_network_session = 402 HttpNetworkSession* http_network_session =
400 context->http_transaction_factory()->GetSession(); 403 context->http_transaction_factory()->GetSession();
401 404
402 if (info_sources & NET_INFO_SOCKET_POOL) { 405 if (info_sources & NET_INFO_SOCKET_POOL) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 // fine, since GetRequestStateAsValue() ignores the capture mode. 510 // fine, since GetRequestStateAsValue() ignores the capture mode.
508 NetLogEntryData entry_data( 511 NetLogEntryData entry_data(
509 NetLogEventType::REQUEST_ALIVE, request->net_log().source(), 512 NetLogEventType::REQUEST_ALIVE, request->net_log().source(),
510 NetLogEventPhase::BEGIN, request->creation_time(), &callback); 513 NetLogEventPhase::BEGIN, request->creation_time(), &callback);
511 NetLogEntry entry(&entry_data, NetLogCaptureMode::Default()); 514 NetLogEntry entry(&entry_data, NetLogCaptureMode::Default());
512 observer->OnAddEntry(entry); 515 observer->OnAddEntry(entry);
513 } 516 }
514 } 517 }
515 518
516 } // namespace net 519 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/host_cache_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698