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

Side by Side Diff: chrome/browser/net/crl_set_fetcher.cc

Issue 1834273002: Add TRACE_EVENT macros to net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and address comments. Created 4 years, 8 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 | « no previous file | content/browser/loader/resource_loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/net/crl_set_fetcher.h" 5 #include "chrome/browser/net/crl_set_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return; 56 return;
57 SetCRLSetFilePath(path); 57 SetCRLSetFilePath(path);
58 if (!BrowserThread::PostTask( 58 if (!BrowserThread::PostTask(
59 BrowserThread::FILE, FROM_HERE, 59 BrowserThread::FILE, FROM_HERE,
60 base::Bind(&CRLSetFetcher::DoDeleteFromDisk, this))) { 60 base::Bind(&CRLSetFetcher::DoDeleteFromDisk, this))) {
61 NOTREACHED(); 61 NOTREACHED();
62 } 62 }
63 } 63 }
64 64
65 void CRLSetFetcher::DoInitialLoadFromDisk() { 65 void CRLSetFetcher::DoInitialLoadFromDisk() {
66 TRACE_EVENT0("net", "CRLSetFetcher::DoInitialLoadFromDisk");
66 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 67 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
67 68
68 LoadFromDisk(GetCRLSetFilePath(), &crl_set_); 69 LoadFromDisk(GetCRLSetFilePath(), &crl_set_);
69 70
70 uint32_t sequence_of_loaded_crl = 0; 71 uint32_t sequence_of_loaded_crl = 0;
71 if (crl_set_.get()) 72 if (crl_set_.get())
72 sequence_of_loaded_crl = crl_set_->sequence(); 73 sequence_of_loaded_crl = crl_set_->sequence();
73 74
74 // Get updates, advertising the sequence number of the CRL set that we just 75 // Get updates, advertising the sequence number of the CRL set that we just
75 // loaded, if any. 76 // loaded, if any.
76 if (!BrowserThread::PostTask( 77 if (!BrowserThread::PostTask(
77 BrowserThread::UI, FROM_HERE, 78 BrowserThread::UI, FROM_HERE,
78 base::Bind( 79 base::Bind(
79 &CRLSetFetcher::RegisterComponent, 80 &CRLSetFetcher::RegisterComponent,
80 this, 81 this,
81 sequence_of_loaded_crl))) { 82 sequence_of_loaded_crl))) {
82 NOTREACHED(); 83 NOTREACHED();
83 } 84 }
84 } 85 }
85 86
86 void CRLSetFetcher::LoadFromDisk(base::FilePath path, 87 void CRLSetFetcher::LoadFromDisk(base::FilePath path,
87 scoped_refptr<net::CRLSet>* out_crl_set) { 88 scoped_refptr<net::CRLSet>* out_crl_set) {
88 TRACE_EVENT0("CRLSetFetcher", "LoadFromDisk"); 89 TRACE_EVENT0("net", "CRLSetFetcher::LoadFromDisk");
89 90
90 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 91 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
91 92
92 std::string crl_set_bytes; 93 std::string crl_set_bytes;
93 { 94 {
94 TRACE_EVENT0("CRLSetFetcher", "ReadFileToString"); 95 TRACE_EVENT0("net", "CRLSetFetcher::ReadFileToString");
95 if (!base::ReadFileToString(path, &crl_set_bytes)) 96 if (!base::ReadFileToString(path, &crl_set_bytes))
96 return; 97 return;
97 } 98 }
98 99
99 if (!net::CRLSetStorage::Parse(crl_set_bytes, out_crl_set)) { 100 if (!net::CRLSetStorage::Parse(crl_set_bytes, out_crl_set)) {
100 LOG(WARNING) << "Failed to parse CRL set from " << path.MaybeAsASCII(); 101 LOG(WARNING) << "Failed to parse CRL set from " << path.MaybeAsASCII();
101 return; 102 return;
102 } 103 }
103 104
104 VLOG(1) << "Loaded " << crl_set_bytes.size() << " bytes of CRL set from disk"; 105 VLOG(1) << "Loaded " << crl_set_bytes.size() << " bytes of CRL set from disk";
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 bool CRLSetFetcher::GetInstalledFile( 238 bool CRLSetFetcher::GetInstalledFile(
238 const std::string& file, base::FilePath* installed_file) { 239 const std::string& file, base::FilePath* installed_file) {
239 return false; 240 return false;
240 } 241 }
241 242
242 bool CRLSetFetcher::Uninstall() { 243 bool CRLSetFetcher::Uninstall() {
243 return false; 244 return false;
244 } 245 }
245 246
246 CRLSetFetcher::~CRLSetFetcher() {} 247 CRLSetFetcher::~CRLSetFetcher() {}
OLDNEW
« no previous file with comments | « no previous file | content/browser/loader/resource_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698