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

Side by Side Diff: net/ssl/channel_id_service.cc

Issue 1882433002: Removing NSS files and USE_OPENSSL flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. 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 | « net/socket/ssl_server_socket_unittest.cc ('k') | net/ssl/ssl_cipher_suite_names.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "net/ssl/channel_id_service.h" 5 #include "net/ssl/channel_id_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 13 matching lines...) Expand all
24 #include "base/stl_util.h" 24 #include "base/stl_util.h"
25 #include "base/task_runner.h" 25 #include "base/task_runner.h"
26 #include "base/thread_task_runner_handle.h" 26 #include "base/thread_task_runner_handle.h"
27 #include "crypto/ec_private_key.h" 27 #include "crypto/ec_private_key.h"
28 #include "net/base/net_errors.h" 28 #include "net/base/net_errors.h"
29 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 29 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
30 #include "net/cert/x509_certificate.h" 30 #include "net/cert/x509_certificate.h"
31 #include "net/cert/x509_util.h" 31 #include "net/cert/x509_util.h"
32 #include "url/gurl.h" 32 #include "url/gurl.h"
33 33
34 #if !defined(USE_OPENSSL)
35 #include <private/pprthred.h> // PR_DetachThread
36 #endif
37
38 namespace net { 34 namespace net {
39 35
40 namespace { 36 namespace {
41 37
42 base::StaticAtomicSequenceNumber g_next_id; 38 base::StaticAtomicSequenceNumber g_next_id;
43 39
44 // Used by the GetDomainBoundCertResult histogram to record the final 40 // Used by the GetDomainBoundCertResult histogram to record the final
45 // outcome of each GetChannelID or GetOrCreateChannelID call. 41 // outcome of each GetChannelID or GetOrCreateChannelID call.
46 // Do not re-use values. 42 // Do not re-use values.
47 enum GetChannelIDResult { 43 enum GetChannelIDResult {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 FROM_HERE, 135 FROM_HERE,
140 base::Bind(&ChannelIDServiceWorker::Run, base::Owned(this))); 136 base::Bind(&ChannelIDServiceWorker::Run, base::Owned(this)));
141 } 137 }
142 138
143 private: 139 private:
144 void Run() { 140 void Run() {
145 // Runs on a worker thread. 141 // Runs on a worker thread.
146 int error = ERR_FAILED; 142 int error = ERR_FAILED;
147 std::unique_ptr<ChannelIDStore::ChannelID> channel_id = 143 std::unique_ptr<ChannelIDStore::ChannelID> channel_id =
148 GenerateChannelID(server_identifier_, &error); 144 GenerateChannelID(server_identifier_, &error);
149 #if !defined(USE_OPENSSL)
150 // Detach the thread from NSPR.
151 // Calling NSS functions attaches the thread to NSPR, which stores
152 // the NSPR thread ID in thread-specific data.
153 // The threads in our thread pool terminate after we have called
154 // PR_Cleanup. Unless we detach them from NSPR, net_unittests gets
155 // segfaults on shutdown when the threads' thread-specific data
156 // destructors run.
157 PR_DetachThread();
158 #endif
159 origin_task_runner_->PostTask( 145 origin_task_runner_->PostTask(
160 FROM_HERE, base::Bind(callback_, server_identifier_, error, 146 FROM_HERE, base::Bind(callback_, server_identifier_, error,
161 base::Passed(&channel_id))); 147 base::Passed(&channel_id)));
162 } 148 }
163 149
164 const std::string server_identifier_; 150 const std::string server_identifier_;
165 scoped_refptr<base::SequencedTaskRunner> origin_task_runner_; 151 scoped_refptr<base::SequencedTaskRunner> origin_task_runner_;
166 WorkerDoneCallback callback_; 152 WorkerDoneCallback callback_;
167 153
168 DISALLOW_COPY_AND_ASSIGN(ChannelIDServiceWorker); 154 DISALLOW_COPY_AND_ASSIGN(ChannelIDServiceWorker);
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 } 521 }
536 522
537 return err; 523 return err;
538 } 524 }
539 525
540 int ChannelIDService::channel_id_count() { 526 int ChannelIDService::channel_id_count() {
541 return channel_id_store_->GetChannelIDCount(); 527 return channel_id_store_->GetChannelIDCount();
542 } 528 }
543 529
544 } // namespace net 530 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_server_socket_unittest.cc ('k') | net/ssl/ssl_cipher_suite_names.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698