| OLD | NEW |
| 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 #include <certt.h> | 7 #include <certt.h> |
| 8 #include <certdb.h> | 8 #include <certdb.h> |
| 9 #include <ocsp.h> | 9 #include <ocsp.h> |
| 10 #include <nspr.h> | 10 #include <nspr.h> |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 DCHECK_EQ(request, request_); | 209 DCHECK_EQ(request, request_); |
| 210 DCHECK_EQ(MessageLoopForIO::current(), io_loop_); | 210 DCHECK_EQ(MessageLoopForIO::current(), io_loop_); |
| 211 | 211 |
| 212 do { | 212 do { |
| 213 if (!request_->status().is_success() || bytes_read <= 0) | 213 if (!request_->status().is_success() || bytes_read <= 0) |
| 214 break; | 214 break; |
| 215 data_.append(buffer_->data(), bytes_read); | 215 data_.append(buffer_->data(), bytes_read); |
| 216 } while (request_->Read(buffer_, kRecvBufferSize, &bytes_read)); | 216 } while (request_->Read(buffer_, kRecvBufferSize, &bytes_read)); |
| 217 | 217 |
| 218 if (!request_->status().is_io_pending()) { | 218 if (!request_->status().is_io_pending()) { |
| 219 MessageLoop* io_loop = io_loop_; | 219 delete request_; |
| 220 request_ = NULL; |
| 221 io_loop_->RemoveDestructionObserver(this); |
| 220 { | 222 { |
| 221 AutoLock autolock(lock_); | 223 AutoLock autolock(lock_); |
| 222 finished_ = true; | 224 finished_ = true; |
| 223 io_loop_ = NULL; | 225 io_loop_ = NULL; |
| 224 } | 226 } |
| 225 cv_.Signal(); | 227 cv_.Signal(); |
| 226 delete request_; | |
| 227 request_ = NULL; | |
| 228 io_loop->RemoveDestructionObserver(this); | |
| 229 } | 228 } |
| 230 } | 229 } |
| 231 | 230 |
| 232 virtual void WillDestroyCurrentMessageLoop() { | 231 virtual void WillDestroyCurrentMessageLoop() { |
| 233 DCHECK_EQ(MessageLoopForIO::current(), io_loop_); | 232 DCHECK_EQ(MessageLoopForIO::current(), io_loop_); |
| 234 { | 233 { |
| 235 AutoLock autolock(lock_); | 234 AutoLock autolock(lock_); |
| 236 io_loop_ = NULL; | 235 io_loop_ = NULL; |
| 237 } | 236 } |
| 238 if (request_) { | 237 if (request_) { |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 // This function would be called before NSS initialization. | 558 // This function would be called before NSS initialization. |
| 560 void SetURLRequestContextForOCSP(URLRequestContext* request_context) { | 559 void SetURLRequestContextForOCSP(URLRequestContext* request_context) { |
| 561 OCSPInitSingleton::set_url_request_context(request_context); | 560 OCSPInitSingleton::set_url_request_context(request_context); |
| 562 } | 561 } |
| 563 | 562 |
| 564 URLRequestContext* GetURLRequestContextForOCSP() { | 563 URLRequestContext* GetURLRequestContextForOCSP() { |
| 565 return OCSPInitSingleton::url_request_context(); | 564 return OCSPInitSingleton::url_request_context(); |
| 566 } | 565 } |
| 567 | 566 |
| 568 } // namespace net | 567 } // namespace net |
| OLD | NEW |