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

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

Issue 732633002: Adding instrumentation to locate the source of jankiness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke@ comments Created 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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>
11 #include <nss.h> 11 #include <nss.h>
12 #include <pthread.h> 12 #include <pthread.h>
13 #include <secerr.h> 13 #include <secerr.h>
14 14
15 #include <algorithm> 15 #include <algorithm>
16 #include <string> 16 #include <string>
17 17
18 #include "base/basictypes.h" 18 #include "base/basictypes.h"
19 #include "base/callback.h" 19 #include "base/callback.h"
20 #include "base/compiler_specific.h" 20 #include "base/compiler_specific.h"
21 #include "base/lazy_instance.h" 21 #include "base/lazy_instance.h"
22 #include "base/logging.h" 22 #include "base/logging.h"
23 #include "base/memory/scoped_ptr.h" 23 #include "base/memory/scoped_ptr.h"
24 #include "base/message_loop/message_loop.h" 24 #include "base/message_loop/message_loop.h"
25 #include "base/metrics/histogram.h" 25 #include "base/metrics/histogram.h"
26 #include "base/profiler/scoped_tracker.h"
26 #include "base/stl_util.h" 27 #include "base/stl_util.h"
27 #include "base/strings/string_util.h" 28 #include "base/strings/string_util.h"
28 #include "base/strings/stringprintf.h" 29 #include "base/strings/stringprintf.h"
29 #include "base/synchronization/condition_variable.h" 30 #include "base/synchronization/condition_variable.h"
30 #include "base/synchronization/lock.h" 31 #include "base/synchronization/lock.h"
31 #include "base/threading/thread_checker.h" 32 #include "base/threading/thread_checker.h"
32 #include "base/time/time.h" 33 #include "base/time/time.h"
33 #include "net/base/elements_upload_data_stream.h" 34 #include "net/base/elements_upload_data_stream.h"
34 #include "net/base/host_port_pair.h" 35 #include "net/base/host_port_pair.h"
35 #include "net/base/io_buffer.h" 36 #include "net/base/io_buffer.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); 291 DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_);
291 292
292 if (!redirect_info.new_url.SchemeIs("http")) { 293 if (!redirect_info.new_url.SchemeIs("http")) {
293 // Prevent redirects to non-HTTP schemes, including HTTPS. This matches 294 // Prevent redirects to non-HTTP schemes, including HTTPS. This matches
294 // the initial check in OCSPServerSession::CreateRequest(). 295 // the initial check in OCSPServerSession::CreateRequest().
295 CancelURLRequest(); 296 CancelURLRequest();
296 } 297 }
297 } 298 }
298 299
299 void OnResponseStarted(URLRequest* request) override { 300 void OnResponseStarted(URLRequest* request) override {
301 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed.
302 tracked_objects::ScopedTracker tracking_profile(
303 FROM_HERE_WITH_EXPLICIT_FUNCTION(
304 "423948 OCSPRequestSession::OnResponseStarted"));
305
300 DCHECK_EQ(request_.get(), request); 306 DCHECK_EQ(request_.get(), request);
301 DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); 307 DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_);
302 308
303 int bytes_read = 0; 309 int bytes_read = 0;
304 if (request->status().is_success()) { 310 if (request->status().is_success()) {
305 response_code_ = request_->GetResponseCode(); 311 response_code_ = request_->GetResponseCode();
306 response_headers_ = request_->response_headers(); 312 response_headers_ = request_->response_headers();
307 response_headers_->GetMimeType(&response_content_type_); 313 response_headers_->GetMimeType(&response_content_type_);
308 request_->Read(buffer_.get(), kRecvBufferSize, &bytes_read); 314 request_->Read(buffer_.get(), kRecvBufferSize, &bytes_read);
309 } 315 }
310 OnReadCompleted(request_.get(), bytes_read); 316 OnReadCompleted(request_.get(), bytes_read);
311 } 317 }
312 318
313 void OnReadCompleted(URLRequest* request, int bytes_read) override { 319 void OnReadCompleted(URLRequest* request, int bytes_read) override {
320 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed.
321 tracked_objects::ScopedTracker tracking_profile(
322 FROM_HERE_WITH_EXPLICIT_FUNCTION(
323 "423948 OCSPRequestSession::OnReadCompleted"));
324
314 DCHECK_EQ(request_.get(), request); 325 DCHECK_EQ(request_.get(), request);
315 DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); 326 DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_);
316 327
317 do { 328 do {
318 if (!request_->status().is_success() || bytes_read <= 0) 329 if (!request_->status().is_success() || bytes_read <= 0)
319 break; 330 break;
320 data_.append(buffer_->data(), bytes_read); 331 data_.append(buffer_->data(), bytes_read);
321 } while (request_->Read(buffer_.get(), kRecvBufferSize, &bytes_read)); 332 } while (request_->Read(buffer_.get(), kRecvBufferSize, &bytes_read));
322 333
323 if (!request_->status().is_io_pending()) { 334 if (!request_->status().is_io_pending()) {
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 void SetURLRequestContextForNSSHttpIO(URLRequestContext* request_context) { 978 void SetURLRequestContextForNSSHttpIO(URLRequestContext* request_context) {
968 pthread_mutex_lock(&g_request_context_lock); 979 pthread_mutex_lock(&g_request_context_lock);
969 if (request_context) { 980 if (request_context) {
970 DCHECK(!g_request_context); 981 DCHECK(!g_request_context);
971 } 982 }
972 g_request_context = request_context; 983 g_request_context = request_context;
973 pthread_mutex_unlock(&g_request_context_lock); 984 pthread_mutex_unlock(&g_request_context_lock);
974 } 985 }
975 986
976 } // namespace net 987 } // namespace net
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_write_to_cache_job.cc ('k') | net/proxy/proxy_script_fetcher_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698