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

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: Fixing header ordering. 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
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 <utility> 9 #include <utility>
10 10
(...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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 FROM_HERE, 136 FROM_HERE,
141 base::Bind(&ChannelIDServiceWorker::Run, base::Owned(this))); 137 base::Bind(&ChannelIDServiceWorker::Run, base::Owned(this)));
142 } 138 }
143 139
144 private: 140 private:
145 void Run() { 141 void Run() {
146 // Runs on a worker thread. 142 // Runs on a worker thread.
147 int error = ERR_FAILED; 143 int error = ERR_FAILED;
148 scoped_ptr<ChannelIDStore::ChannelID> channel_id = 144 scoped_ptr<ChannelIDStore::ChannelID> channel_id =
149 GenerateChannelID(server_identifier_, &error); 145 GenerateChannelID(server_identifier_, &error);
150 #if !defined(USE_OPENSSL)
151 // Detach the thread from NSPR.
152 // Calling NSS functions attaches the thread to NSPR, which stores
153 // the NSPR thread ID in thread-specific data.
154 // The threads in our thread pool terminate after we have called
155 // PR_Cleanup. Unless we detach them from NSPR, net_unittests gets
156 // segfaults on shutdown when the threads' thread-specific data
157 // destructors run.
158 PR_DetachThread();
159 #endif
160 origin_task_runner_->PostTask( 146 origin_task_runner_->PostTask(
161 FROM_HERE, base::Bind(callback_, server_identifier_, error, 147 FROM_HERE, base::Bind(callback_, server_identifier_, error,
162 base::Passed(&channel_id))); 148 base::Passed(&channel_id)));
163 } 149 }
164 150
165 const std::string server_identifier_; 151 const std::string server_identifier_;
166 scoped_refptr<base::SequencedTaskRunner> origin_task_runner_; 152 scoped_refptr<base::SequencedTaskRunner> origin_task_runner_;
167 WorkerDoneCallback callback_; 153 WorkerDoneCallback callback_;
168 154
169 DISALLOW_COPY_AND_ASSIGN(ChannelIDServiceWorker); 155 DISALLOW_COPY_AND_ASSIGN(ChannelIDServiceWorker);
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 } 520 }
535 521
536 return err; 522 return err;
537 } 523 }
538 524
539 int ChannelIDService::channel_id_count() { 525 int ChannelIDService::channel_id_count() {
540 return channel_id_store_->GetChannelIDCount(); 526 return channel_id_store_->GetChannelIDCount();
541 } 527 }
542 528
543 } // namespace net 529 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698