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/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 Loading... | |
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"); |
ssid
2016/04/02 01:59:24
All this calls actually get into net/cert/crl_set.
mmenke
2016/04/04 16:45:49
I'm fine with it here, but I'm not all that famili
| |
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 bool CRLSetFetcher::GetInstalledFile( | 237 bool CRLSetFetcher::GetInstalledFile( |
237 const std::string& file, base::FilePath* installed_file) { | 238 const std::string& file, base::FilePath* installed_file) { |
238 return false; | 239 return false; |
239 } | 240 } |
240 | 241 |
241 bool CRLSetFetcher::Uninstall() { | 242 bool CRLSetFetcher::Uninstall() { |
242 return false; | 243 return false; |
243 } | 244 } |
244 | 245 |
245 CRLSetFetcher::~CRLSetFetcher() {} | 246 CRLSetFetcher::~CRLSetFetcher() {} |
OLD | NEW |