OLD | NEW |
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/debug/trace_event.h" |
8 #include "base/file_util.h" | 9 #include "base/file_util.h" |
9 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
10 #include "base/path_service.h" | 11 #include "base/path_service.h" |
11 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
12 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
14 #include "chrome/browser/component_updater/component_updater_service.h" | 15 #include "chrome/browser/component_updater/component_updater_service.h" |
15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/common/chrome_constants.h" | 17 #include "chrome/common/chrome_constants.h" |
17 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 base::Bind( | 67 base::Bind( |
67 &CRLSetFetcher::RegisterComponent, | 68 &CRLSetFetcher::RegisterComponent, |
68 this, | 69 this, |
69 sequence_of_loaded_crl))) { | 70 sequence_of_loaded_crl))) { |
70 NOTREACHED(); | 71 NOTREACHED(); |
71 } | 72 } |
72 } | 73 } |
73 | 74 |
74 void CRLSetFetcher::LoadFromDisk(base::FilePath path, | 75 void CRLSetFetcher::LoadFromDisk(base::FilePath path, |
75 scoped_refptr<net::CRLSet>* out_crl_set) { | 76 scoped_refptr<net::CRLSet>* out_crl_set) { |
| 77 TRACE_EVENT0("CRLSetFetcher", "LoadFromDisk"); |
| 78 |
76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
77 | 80 |
78 std::string crl_set_bytes; | 81 std::string crl_set_bytes; |
79 if (!base::ReadFileToString(path, &crl_set_bytes)) | 82 { |
80 return; | 83 TRACE_EVENT0("CRLSetFetcher", "ReadFileToString"); |
| 84 if (!base::ReadFileToString(path, &crl_set_bytes)) |
| 85 return; |
| 86 } |
81 | 87 |
82 if (!net::CRLSet::Parse(crl_set_bytes, out_crl_set)) { | 88 if (!net::CRLSet::Parse(crl_set_bytes, out_crl_set)) { |
83 LOG(WARNING) << "Failed to parse CRL set from " << path.MaybeAsASCII(); | 89 LOG(WARNING) << "Failed to parse CRL set from " << path.MaybeAsASCII(); |
84 return; | 90 return; |
85 } | 91 } |
86 | 92 |
87 VLOG(1) << "Loaded " << crl_set_bytes.size() << " bytes of CRL set from disk"; | 93 VLOG(1) << "Loaded " << crl_set_bytes.size() << " bytes of CRL set from disk"; |
88 | 94 |
89 if (!BrowserThread::PostTask( | 95 if (!BrowserThread::PostTask( |
90 BrowserThread::IO, FROM_HERE, | 96 BrowserThread::IO, FROM_HERE, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 211 |
206 return true; | 212 return true; |
207 } | 213 } |
208 | 214 |
209 bool CRLSetFetcher::GetInstalledFile( | 215 bool CRLSetFetcher::GetInstalledFile( |
210 const std::string& file, base::FilePath* installed_file) { | 216 const std::string& file, base::FilePath* installed_file) { |
211 return false; | 217 return false; |
212 } | 218 } |
213 | 219 |
214 CRLSetFetcher::~CRLSetFetcher() {} | 220 CRLSetFetcher::~CRLSetFetcher() {} |
OLD | NEW |