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

Side by Side Diff: webrtc/api/statscollector.cc

Issue 1799233002: SSLCertificate::GetChain: Return scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: No auto Created 4 years, 9 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 | « no previous file | webrtc/base/fakesslidentity.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 const rtc::SSLCertificate* cert) { 568 const rtc::SSLCertificate* cert) {
569 RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent()); 569 RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent());
570 // Produces a chain of StatsReports representing this certificate and the rest 570 // Produces a chain of StatsReports representing this certificate and the rest
571 // of its chain, and adds those reports to |reports_|. The return value is 571 // of its chain, and adds those reports to |reports_|. The return value is
572 // the id of the leaf report. The provided cert must be non-null, so at least 572 // the id of the leaf report. The provided cert must be non-null, so at least
573 // one report will always be provided and the returned string will never be 573 // one report will always be provided and the returned string will never be
574 // empty. 574 // empty.
575 RTC_DCHECK(cert != NULL); 575 RTC_DCHECK(cert != NULL);
576 576
577 StatsReport* issuer = nullptr; 577 StatsReport* issuer = nullptr;
578 rtc::scoped_ptr<rtc::SSLCertChain> chain; 578 rtc::scoped_ptr<rtc::SSLCertChain> chain = cert->GetChain();
579 if (cert->GetChain(chain.accept())) { 579 if (chain) {
580 // This loop runs in reverse, i.e. from root to leaf, so that each 580 // This loop runs in reverse, i.e. from root to leaf, so that each
581 // certificate's issuer's report ID is known before the child certificate's 581 // certificate's issuer's report ID is known before the child certificate's
582 // report is generated. The root certificate does not have an issuer ID 582 // report is generated. The root certificate does not have an issuer ID
583 // value. 583 // value.
584 for (ptrdiff_t i = chain->GetSize() - 1; i >= 0; --i) { 584 for (ptrdiff_t i = chain->GetSize() - 1; i >= 0; --i) {
585 const rtc::SSLCertificate& cert_i = chain->Get(i); 585 const rtc::SSLCertificate& cert_i = chain->Get(i);
586 issuer = AddOneCertificateReport(&cert_i, issuer); 586 issuer = AddOneCertificateReport(&cert_i, issuer);
587 } 587 }
588 } 588 }
589 // Add the leaf certificate. 589 // Add the leaf certificate.
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 StatsReport* report = entry.second; 938 StatsReport* report = entry.second;
939 report->set_timestamp(stats_gathering_started_); 939 report->set_timestamp(stats_gathering_started_);
940 } 940 }
941 } 941 }
942 942
943 void StatsCollector::ClearUpdateStatsCacheForTest() { 943 void StatsCollector::ClearUpdateStatsCacheForTest() {
944 stats_gathering_started_ = 0; 944 stats_gathering_started_ = 0;
945 } 945 }
946 946
947 } // namespace webrtc 947 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/fakesslidentity.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698