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

Unified Diff: net/ssl/server_bound_cert_service.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: net/ssl/server_bound_cert_service.cc
diff --git a/net/ssl/server_bound_cert_service.cc b/net/ssl/server_bound_cert_service.cc
index 61d610b5bb625378973371b49fca4e261f60720c..42b64ae051bb34d32fa609106cb5dd557c388c7d 100644
--- a/net/ssl/server_bound_cert_service.cc
+++ b/net/ssl/server_bound_cert_service.cc
@@ -70,8 +70,8 @@ enum GetCertResult {
};
void RecordGetDomainBoundCertResult(GetCertResult result) {
- UMA_HISTOGRAM_ENUMERATION("DomainBoundCerts.GetDomainBoundCertResult", result,
- GET_CERT_RESULT_MAX);
+ UMA_HISTOGRAM_ENUMERATION(
+ "DomainBoundCerts.GetDomainBoundCertResult", result, GET_CERT_RESULT_MAX);
}
void RecordGetCertTime(base::TimeDelta request_time) {
@@ -110,8 +110,8 @@ scoped_ptr<ServerBoundCertStore::ServerBoundCert> GenerateCert(
return result.Pass();
}
- if (!key->ExportEncryptedPrivateKey(ServerBoundCertService::kEPKIPassword,
- 1, &private_key_info)) {
+ if (!key->ExportEncryptedPrivateKey(
+ ServerBoundCertService::kEPKIPassword, 1, &private_key_info)) {
DLOG(ERROR) << "Unable to export private key";
*error = ERR_PRIVATE_KEY_EXPORT_FAILED;
return result.Pass();
@@ -122,11 +122,7 @@ scoped_ptr<ServerBoundCertStore::ServerBoundCert> GenerateCert(
std::string key_out(private_key_info.begin(), private_key_info.end());
result.reset(new ServerBoundCertStore::ServerBoundCert(
- server_identifier,
- not_valid_before,
- not_valid_after,
- key_out,
- der_cert));
+ server_identifier, not_valid_before, not_valid_after, key_out, der_cert));
UMA_HISTOGRAM_CUSTOM_TIMES("DomainBoundCerts.GenerateCertTime",
base::TimeTicks::Now() - start,
base::TimeDelta::FromMilliseconds(1),
@@ -148,8 +144,7 @@ class ServerBoundCertServiceRequest {
: request_start_(request_start),
callback_(callback),
private_key_(private_key),
- cert_(cert) {
- }
+ cert_(cert) {}
// Ensures that the result callback will never be made.
void Cancel() {
@@ -219,14 +214,12 @@ class ServerBoundCertServiceWorker {
int,
scoped_ptr<ServerBoundCertStore::ServerBoundCert>)> WorkerDoneCallback;
- ServerBoundCertServiceWorker(
- const std::string& server_identifier,
- const WorkerDoneCallback& callback)
+ ServerBoundCertServiceWorker(const std::string& server_identifier,
+ const WorkerDoneCallback& callback)
: server_identifier_(server_identifier),
serial_number_(base::RandInt(0, std::numeric_limits<int>::max())),
origin_loop_(base::MessageLoopProxy::current()),
- callback_(callback) {
- }
+ callback_(callback) {}
// Starts the worker on |task_runner|. If the worker fails to start, such as
// if the task runner is shutting down, then it will take care of deleting
@@ -256,9 +249,9 @@ class ServerBoundCertServiceWorker {
// destructors run.
PR_DetachThread();
#endif
- origin_loop_->PostTask(FROM_HERE,
- base::Bind(callback_, server_identifier_, error,
- base::Passed(&cert)));
+ origin_loop_->PostTask(
+ FROM_HERE,
+ base::Bind(callback_, server_identifier_, error, base::Passed(&cert)));
}
const std::string server_identifier_;
@@ -277,8 +270,7 @@ class ServerBoundCertServiceWorker {
class ServerBoundCertServiceJob {
public:
ServerBoundCertServiceJob(bool create_if_missing)
- : create_if_missing_(create_if_missing) {
- }
+ : create_if_missing_(create_if_missing) {}
~ServerBoundCertServiceJob() {
if (!requests_.empty())
@@ -306,16 +298,20 @@ class ServerBoundCertServiceJob {
std::vector<ServerBoundCertServiceRequest*> requests;
requests_.swap(requests);
- for (std::vector<ServerBoundCertServiceRequest*>::iterator
- i = requests.begin(); i != requests.end(); i++) {
+ for (std::vector<ServerBoundCertServiceRequest*>::iterator i =
+ requests.begin();
+ i != requests.end();
+ i++) {
(*i)->Post(error, private_key, cert);
// Post() causes the ServerBoundCertServiceRequest to delete itself.
}
}
void DeleteAllCanceled() {
- for (std::vector<ServerBoundCertServiceRequest*>::iterator
- i = requests_.begin(); i != requests_.end(); i++) {
+ for (std::vector<ServerBoundCertServiceRequest*>::iterator i =
+ requests_.begin();
+ i != requests_.end();
+ i++) {
if ((*i)->canceled()) {
delete *i;
} else {
@@ -332,8 +328,8 @@ class ServerBoundCertServiceJob {
const char ServerBoundCertService::kEPKIPassword[] = "";
ServerBoundCertService::RequestHandle::RequestHandle()
- : service_(NULL),
- request_(NULL) {}
+ : service_(NULL), request_(NULL) {
+}
ServerBoundCertService::RequestHandle::~RequestHandle() {
Cancel();
@@ -375,8 +371,9 @@ ServerBoundCertService::ServerBoundCertService(
workers_created_(0),
weak_ptr_factory_(this) {
base::Time start = base::Time::Now();
- base::Time end = start + base::TimeDelta::FromDays(
- kValidityPeriodInDays + kSystemTimeValidityBufferInDays);
+ base::Time end =
+ start + base::TimeDelta::FromDays(kValidityPeriodInDays +
+ kSystemTimeValidityBufferInDays);
is_system_time_valid_ = x509_util::IsSupportedValidityRange(start, end);
}
@@ -384,11 +381,10 @@ ServerBoundCertService::~ServerBoundCertService() {
STLDeleteValues(&inflight_);
}
-//static
+// static
std::string ServerBoundCertService::GetDomainForHost(const std::string& host) {
- std::string domain =
- registry_controlled_domains::GetDomainAndRegistry(
- host, registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
+ std::string domain = registry_controlled_domains::GetDomainAndRegistry(
+ host, registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
if (domain.empty())
return host;
return domain;
@@ -419,13 +415,23 @@ int ServerBoundCertService::GetOrCreateDomainBoundCert(
// See if a request for the same domain is currently in flight.
bool create_if_missing = true;
- if (JoinToInFlightRequest(request_start, domain, private_key, cert,
- create_if_missing, callback, out_req)) {
+ if (JoinToInFlightRequest(request_start,
+ domain,
+ private_key,
+ cert,
+ create_if_missing,
+ callback,
+ out_req)) {
return ERR_IO_PENDING;
}
- int err = LookupDomainBoundCert(request_start, domain, private_key, cert,
- create_if_missing, callback, out_req);
+ int err = LookupDomainBoundCert(request_start,
+ domain,
+ private_key,
+ cert,
+ create_if_missing,
+ callback,
+ out_req);
if (err == ERR_FILE_NOT_FOUND) {
// Sync lookup did not find a valid cert. Start generating a new one.
workers_created_++;
@@ -483,13 +489,23 @@ int ServerBoundCertService::GetDomainBoundCert(
// See if a request for the same domain currently in flight.
bool create_if_missing = false;
- if (JoinToInFlightRequest(request_start, domain, private_key, cert,
- create_if_missing, callback, out_req)) {
+ if (JoinToInFlightRequest(request_start,
+ domain,
+ private_key,
+ cert,
+ create_if_missing,
+ callback,
+ out_req)) {
return ERR_IO_PENDING;
}
- int err = LookupDomainBoundCert(request_start, domain, private_key, cert,
- create_if_missing, callback, out_req);
+ int err = LookupDomainBoundCert(request_start,
+ domain,
+ private_key,
+ cert,
+ create_if_missing,
+ callback,
+ out_req);
return err;
}
@@ -556,12 +572,11 @@ void ServerBoundCertService::GeneratedServerBoundCert(
if (error == OK) {
// TODO(mattm): we should just Pass() the cert object to
// SetServerBoundCert().
- server_bound_cert_store_->SetServerBoundCert(
- cert->server_identifier(),
- cert->creation_time(),
- cert->expiration_time(),
- cert->private_key(),
- cert->cert());
+ server_bound_cert_store_->SetServerBoundCert(cert->server_identifier(),
+ cert->creation_time(),
+ cert->expiration_time(),
+ cert->private_key(),
+ cert->cert());
HandleResult(error, server_identifier, cert->private_key(), cert->cert());
} else {
@@ -569,11 +584,10 @@ void ServerBoundCertService::GeneratedServerBoundCert(
}
}
-void ServerBoundCertService::HandleResult(
- int error,
- const std::string& server_identifier,
- const std::string& private_key,
- const std::string& cert) {
+void ServerBoundCertService::HandleResult(int error,
+ const std::string& server_identifier,
+ const std::string& private_key,
+ const std::string& cert) {
DCHECK(CalledOnValidThread());
std::map<std::string, ServerBoundCertServiceJob*>::iterator j;
@@ -632,7 +646,7 @@ int ServerBoundCertService::LookupDomainBoundCert(
base::Time expiration_time;
int err = server_bound_cert_store_->GetServerBoundCert(
domain,
- &expiration_time /* ignored */,
+ &expiration_time /* ignored */,
private_key,
cert,
base::Bind(&ServerBoundCertService::GotServerBoundCert,

Powered by Google App Engine
This is Rietveld 408576698