OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/sth_distributor_provider.h" | 5 #include "chrome/browser/net/sth_distributor_provider.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "net/cert/sth_distributor.h" | 8 #include "net/cert/sth_distributor.h" |
9 | 9 |
10 namespace chrome_browser_net { | 10 namespace chrome_browser_net { |
11 | 11 |
12 namespace { | 12 namespace { |
13 base::LazyInstance<std::unique_ptr<net::ct::STHDistributor>> | 13 base::LazyInstance<std::unique_ptr<net::ct::STHDistributor>>::DestructorAtExit |
14 global_sth_distributor = LAZY_INSTANCE_INITIALIZER; | 14 global_sth_distributor = LAZY_INSTANCE_INITIALIZER; |
15 } // namespace | 15 } // namespace |
16 | 16 |
17 void SetGlobalSTHDistributor( | 17 void SetGlobalSTHDistributor( |
18 std::unique_ptr<net::ct::STHDistributor> distributor) { | 18 std::unique_ptr<net::ct::STHDistributor> distributor) { |
19 global_sth_distributor.Get().swap(distributor); | 19 global_sth_distributor.Get().swap(distributor); |
20 } | 20 } |
21 | 21 |
22 net::ct::STHDistributor* GetGlobalSTHDistributor() { | 22 net::ct::STHDistributor* GetGlobalSTHDistributor() { |
23 CHECK(global_sth_distributor.Get()); | 23 CHECK(global_sth_distributor.Get()); |
24 return global_sth_distributor.Get().get(); | 24 return global_sth_distributor.Get().get(); |
25 } | 25 } |
26 | 26 |
27 } // namespace chrome_browser_net | 27 } // namespace chrome_browser_net |
OLD | NEW |