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

Side by Side Diff: net/ocsp/nss_ocsp.cc

Issue 391062: Move NULLing of OCSP context from UI thread to IO thread, to avoid possible r... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 11 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « net/ocsp/nss_ocsp.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/ocsp/nss_ocsp.h" 5 #include "net/ocsp/nss_ocsp.h"
6 6
7 // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=455424 7 // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=455424
8 // until NSS 3.12.2 comes out and we update to it. 8 // until NSS 3.12.2 comes out and we update to it.
9 #define Lock FOO_NSS_Lock 9 #define Lock FOO_NSS_Lock
10 #include <certt.h> 10 #include <certt.h>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 MessageLoop* io_thread() const { 43 MessageLoop* io_thread() const {
44 DCHECK(io_loop_); 44 DCHECK(io_loop_);
45 return io_loop_; 45 return io_loop_;
46 } 46 }
47 47
48 // This is static method because it is called before NSS initialization, 48 // This is static method because it is called before NSS initialization,
49 // that is, before OCSPInitSingleton is initialized. 49 // that is, before OCSPInitSingleton is initialized.
50 static void set_url_request_context(URLRequestContext* request_context) { 50 static void set_url_request_context(URLRequestContext* request_context) {
51 request_context_ = request_context; 51 request_context_ = request_context;
52 } 52 }
53 URLRequestContext* url_request_context() const { 53 static URLRequestContext* url_request_context() {
54 return request_context_.get(); 54 return request_context_;
55 } 55 }
56 56
57 private: 57 private:
58 friend struct DefaultSingletonTraits<OCSPInitSingleton>; 58 friend struct DefaultSingletonTraits<OCSPInitSingleton>;
59 OCSPInitSingleton(); 59 OCSPInitSingleton();
60 ~OCSPInitSingleton() { 60 ~OCSPInitSingleton() {
61 request_context_ = NULL; 61 request_context_ = NULL;
62 } 62 }
63 63
64 SEC_HttpClientFcn client_fcn_; 64 SEC_HttpClientFcn client_fcn_;
65 65
66 // I/O thread. 66 // I/O thread.
67 MessageLoop* io_loop_; // I/O thread 67 MessageLoop* io_loop_; // I/O thread
68 68
69 // URLRequestContext for OCSP handlers. 69 // URLRequestContext for OCSP handlers.
70 static scoped_refptr<URLRequestContext> request_context_; 70 static URLRequestContext* request_context_;
71 71
72 DISALLOW_COPY_AND_ASSIGN(OCSPInitSingleton); 72 DISALLOW_COPY_AND_ASSIGN(OCSPInitSingleton);
73 }; 73 };
74 74
75 scoped_refptr<URLRequestContext> OCSPInitSingleton::request_context_; 75 URLRequestContext* OCSPInitSingleton::request_context_ = NULL;
76 76
77 // Concrete class for SEC_HTTP_REQUEST_SESSION. 77 // Concrete class for SEC_HTTP_REQUEST_SESSION.
78 // Public methods except virtual methods of URLRequest::Delegate (On* methods) 78 // Public methods except virtual methods of URLRequest::Delegate (On* methods)
79 // run on certificate verifier thread (worker thread). 79 // run on certificate verifier thread (worker thread).
80 // Virtual methods of URLRequest::Delegate and private methods run 80 // Virtual methods of URLRequest::Delegate and private methods run
81 // on IO thread. 81 // on IO thread.
82 class OCSPRequestSession 82 class OCSPRequestSession
83 : public base::RefCountedThreadSafe<OCSPRequestSession>, 83 : public base::RefCountedThreadSafe<OCSPRequestSession>,
84 public URLRequest::Delegate { 84 public URLRequest::Delegate {
85 public: 85 public:
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 523
524 void EnsureOCSPInit() { 524 void EnsureOCSPInit() {
525 Singleton<OCSPInitSingleton>::get(); 525 Singleton<OCSPInitSingleton>::get();
526 } 526 }
527 527
528 // This function would be called before NSS initialization. 528 // This function would be called before NSS initialization.
529 void SetURLRequestContextForOCSP(URLRequestContext* request_context) { 529 void SetURLRequestContextForOCSP(URLRequestContext* request_context) {
530 OCSPInitSingleton::set_url_request_context(request_context); 530 OCSPInitSingleton::set_url_request_context(request_context);
531 } 531 }
532 532
533 URLRequestContext* GetURLRequestContextForOCSP() {
534 return OCSPInitSingleton::url_request_context();
535 }
536
533 } // namespace net 537 } // namespace net
OLDNEW
« no previous file with comments | « net/ocsp/nss_ocsp.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698