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

Side by Side Diff: net/socket/ssl_host_info.cc

Issue 9447084: Refactor Pickle Read methods to use higher performance PickleIterator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile (racing with incoming CLs) Created 8 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_vary_data.cc ('k') | ppapi/proxy/ppapi_param_traits.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 // 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/socket/ssl_host_info.h" 5 #include "net/socket/ssl_host_info.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 bool r = ParseInner(data); 57 bool r = ParseInner(data);
58 if (!r) 58 if (!r)
59 state->Clear(); 59 state->Clear();
60 return r; 60 return r;
61 } 61 }
62 62
63 bool SSLHostInfo::ParseInner(const std::string& data) { 63 bool SSLHostInfo::ParseInner(const std::string& data) {
64 State* state = mutable_state(); 64 State* state = mutable_state();
65 65
66 Pickle p(data.data(), data.size()); 66 Pickle p(data.data(), data.size());
67 void* iter = NULL; 67 PickleIterator iter(p);
68 68
69 int num_der_certs; 69 int num_der_certs;
70 if (!p.ReadInt(&iter, &num_der_certs) || 70 if (!p.ReadInt(&iter, &num_der_certs) ||
71 num_der_certs < 0) { 71 num_der_certs < 0) {
72 return false; 72 return false;
73 } 73 }
74 74
75 for (int i = 0; i < num_der_certs; i++) { 75 for (int i = 0; i < num_der_certs; i++) {
76 std::string der_cert; 76 std::string der_cert;
77 if (!p.ReadString(&iter, &der_cert)) 77 if (!p.ReadString(&iter, &der_cert))
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (!cert_verification_callback_.is_null()) { 197 if (!cert_verification_callback_.is_null()) {
198 CompletionCallback callback = cert_verification_callback_; 198 CompletionCallback callback = cert_verification_callback_;
199 cert_verification_callback_.Reset(); 199 cert_verification_callback_.Reset();
200 callback.Run(rv); 200 callback.Run(rv);
201 } 201 }
202 } 202 }
203 203
204 SSLHostInfoFactory::~SSLHostInfoFactory() {} 204 SSLHostInfoFactory::~SSLHostInfoFactory() {}
205 205
206 } // namespace net 206 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_vary_data.cc ('k') | ppapi/proxy/ppapi_param_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698