From 48fc13b16667c53399774daeccdb1ce5a625578f Mon Sep 17 00:00:00 2001 From: avi Date: Sun, 28 Dec 2014 15:31:48 -0800 Subject: Remove deprecated methods from Pickle. BUG=444578 TEST=none R=nasko@chromium.org TBR=ben@chromium.org Committed: https://chromium.googlesource.com/chromium/src/+/b740bfe23ae7ad244356a4a7538b95ae560251db Review URL: https://codereview.chromium.org/818833004 Cr-Commit-Position: refs/heads/master@{#309691} --- net/cert/x509_certificate.cc | 3 +-- net/cert/x509_certificate.h | 3 +-- net/cert/x509_certificate_unittest.cc | 2 +- net/http/http_response_headers.cc | 5 ++--- net/http/http_response_headers.h | 2 +- net/http/http_response_headers_unittest.cc | 2 +- net/http/http_response_info.cc | 30 +++++++++++++++--------------- net/http/http_vary_data.cc | 4 ++-- net/http/http_vary_data.h | 2 +- net/quic/crypto/quic_server_info.cc | 12 ++++++------ 10 files changed, 31 insertions(+), 34 deletions(-) (limited to 'net') diff --git a/net/cert/x509_certificate.cc b/net/cert/x509_certificate.cc index 02e0234..274ce93 100644 --- a/net/cert/x509_certificate.cc +++ b/net/cert/x509_certificate.cc @@ -306,8 +306,7 @@ X509Certificate* X509Certificate::CreateFromBytes(const char* data, } // static -X509Certificate* X509Certificate::CreateFromPickle(const Pickle& pickle, - PickleIterator* pickle_iter, +X509Certificate* X509Certificate::CreateFromPickle(PickleIterator* pickle_iter, PickleType type) { if (type == PICKLETYPE_CERTIFICATE_CHAIN_V3) { int chain_length = 0; diff --git a/net/cert/x509_certificate.h b/net/cert/x509_certificate.h index 5c64a44..c1a4f6d 100644 --- a/net/cert/x509_certificate.h +++ b/net/cert/x509_certificate.h @@ -179,8 +179,7 @@ class NET_EXPORT X509Certificate // Returns NULL on failure. // // The returned pointer must be stored in a scoped_refptr. - static X509Certificate* CreateFromPickle(const Pickle& pickle, - PickleIterator* pickle_iter, + static X509Certificate* CreateFromPickle(PickleIterator* pickle_iter, PickleType type); // Parses all of the certificates possible from |data|. |format| is a diff --git a/net/cert/x509_certificate_unittest.cc b/net/cert/x509_certificate_unittest.cc index f5e49f8..f77c46c 100644 --- a/net/cert/x509_certificate_unittest.cc +++ b/net/cert/x509_certificate_unittest.cc @@ -619,7 +619,7 @@ TEST(X509CertificateTest, Pickle) { PickleIterator iter(pickle); scoped_refptr cert_from_pickle = X509Certificate::CreateFromPickle( - pickle, &iter, X509Certificate::PICKLETYPE_CERTIFICATE_CHAIN_V3); + &iter, X509Certificate::PICKLETYPE_CERTIFICATE_CHAIN_V3); ASSERT_NE(static_cast(NULL), cert_from_pickle.get()); EXPECT_TRUE(X509Certificate::IsSameOSCert( cert->os_cert_handle(), cert_from_pickle->os_cert_handle())); diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc index 91673f4..c3fd958 100644 --- a/net/http/http_response_headers.cc +++ b/net/http/http_response_headers.cc @@ -156,11 +156,10 @@ HttpResponseHeaders::HttpResponseHeaders(const std::string& raw_input) HttpUtil::GetStatusCodesForHistogram()); } -HttpResponseHeaders::HttpResponseHeaders(const Pickle& pickle, - PickleIterator* iter) +HttpResponseHeaders::HttpResponseHeaders(PickleIterator* iter) : response_code_(-1) { std::string raw_input; - if (pickle.ReadString(iter, &raw_input)) + if (iter->ReadString(&raw_input)) Parse(raw_input); } diff --git a/net/http/http_response_headers.h b/net/http/http_response_headers.h index a093df5..5b98895 100644 --- a/net/http/http_response_headers.h +++ b/net/http/http_response_headers.h @@ -72,7 +72,7 @@ class NET_EXPORT HttpResponseHeaders // Initializes from the representation stored in the given pickle. The data // for this object is found relative to the given pickle_iter, which should // be passed to the pickle's various Read* methods. - HttpResponseHeaders(const Pickle& pickle, PickleIterator* pickle_iter); + explicit HttpResponseHeaders(PickleIterator* pickle_iter); // Appends a representation of this object to the given pickle. // The options argument can be a combination of PersistOptions. diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc index 7e4a6cf..3557423 100644 --- a/net/http/http_response_headers_unittest.cc +++ b/net/http/http_response_headers_unittest.cc @@ -346,7 +346,7 @@ TEST_P(PersistenceTest, Persist) { PickleIterator iter(pickle); scoped_refptr parsed2( - new net::HttpResponseHeaders(pickle, &iter)); + new net::HttpResponseHeaders(&iter)); std::string h2; parsed2->GetNormalizedHeaders(&h2); diff --git a/net/http/http_response_info.cc b/net/http/http_response_info.cc index c3a4827..630a59e 100644 --- a/net/http/http_response_info.cc +++ b/net/http/http_response_info.cc @@ -160,7 +160,7 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle, // Read flags and verify version int flags; - if (!pickle.ReadInt(&iter, &flags)) + if (!iter.ReadInt(&flags)) return false; int version = flags & RESPONSE_INFO_VERSION_MASK; if (version < RESPONSE_INFO_MINIMUM_VERSION || @@ -171,57 +171,57 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle, // Read request-time int64 time_val; - if (!pickle.ReadInt64(&iter, &time_val)) + if (!iter.ReadInt64(&time_val)) return false; request_time = Time::FromInternalValue(time_val); was_cached = true; // Set status to show cache resurrection. // Read response-time - if (!pickle.ReadInt64(&iter, &time_val)) + if (!iter.ReadInt64(&time_val)) return false; response_time = Time::FromInternalValue(time_val); // Read response-headers - headers = new HttpResponseHeaders(pickle, &iter); + headers = new HttpResponseHeaders(&iter); if (headers->response_code() == -1) return false; // Read ssl-info if (flags & RESPONSE_INFO_HAS_CERT) { X509Certificate::PickleType type = GetPickleTypeForVersion(version); - ssl_info.cert = X509Certificate::CreateFromPickle(pickle, &iter, type); + ssl_info.cert = X509Certificate::CreateFromPickle(&iter, type); if (!ssl_info.cert.get()) return false; } if (flags & RESPONSE_INFO_HAS_CERT_STATUS) { CertStatus cert_status; - if (!pickle.ReadUInt32(&iter, &cert_status)) + if (!iter.ReadUInt32(&cert_status)) return false; ssl_info.cert_status = cert_status; } if (flags & RESPONSE_INFO_HAS_SECURITY_BITS) { int security_bits; - if (!pickle.ReadInt(&iter, &security_bits)) + if (!iter.ReadInt(&security_bits)) return false; ssl_info.security_bits = security_bits; } if (flags & RESPONSE_INFO_HAS_SSL_CONNECTION_STATUS) { int connection_status; - if (!pickle.ReadInt(&iter, &connection_status)) + if (!iter.ReadInt(&connection_status)) return false; ssl_info.connection_status = connection_status; } if (flags & RESPONSE_INFO_HAS_SIGNED_CERTIFICATE_TIMESTAMPS) { int num_scts; - if (!pickle.ReadInt(&iter, &num_scts)) + if (!iter.ReadInt(&num_scts)) return false; for (int i = 0; i < num_scts; ++i) { scoped_refptr sct( ct::SignedCertificateTimestamp::CreateFromPickle(&iter)); uint16 status; - if (!sct.get() || !pickle.ReadUInt16(&iter, &status)) + if (!sct.get() || !iter.ReadUInt16(&status)) return false; ssl_info.signed_certificate_timestamps.push_back( SignedCertificateTimestampAndStatus( @@ -231,16 +231,16 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle, // Read vary-data if (flags & RESPONSE_INFO_HAS_VARY_DATA) { - if (!vary_data.InitFromPickle(pickle, &iter)) + if (!vary_data.InitFromPickle(&iter)) return false; } // Read socket_address. std::string socket_address_host; - if (pickle.ReadString(&iter, &socket_address_host)) { + if (iter.ReadString(&socket_address_host)) { // If the host was written, we always expect the port to follow. uint16 socket_address_port; - if (!pickle.ReadUInt16(&iter, &socket_address_port)) + if (!iter.ReadUInt16(&socket_address_port)) return false; socket_address = HostPortPair(socket_address_host, socket_address_port); } else if (version > 1) { @@ -251,14 +251,14 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle, // Read protocol-version. if (flags & RESPONSE_INFO_HAS_NPN_NEGOTIATED_PROTOCOL) { - if (!pickle.ReadString(&iter, &npn_negotiated_protocol)) + if (!iter.ReadString(&npn_negotiated_protocol)) return false; } // Read connection info. if (flags & RESPONSE_INFO_HAS_CONNECTION_INFO) { int value; - if (!pickle.ReadInt(&iter, &value)) + if (!iter.ReadInt(&value)) return false; if (value > static_cast(CONNECTION_INFO_UNKNOWN) && diff --git a/net/http/http_vary_data.cc b/net/http/http_vary_data.cc index f102058..f2f853c 100644 --- a/net/http/http_vary_data.cc +++ b/net/http/http_vary_data.cc @@ -64,10 +64,10 @@ bool HttpVaryData::Init(const HttpRequestInfo& request_info, return is_valid_ = true; } -bool HttpVaryData::InitFromPickle(const Pickle& pickle, PickleIterator* iter) { +bool HttpVaryData::InitFromPickle(PickleIterator* iter) { is_valid_ = false; const char* data; - if (pickle.ReadBytes(iter, &data, sizeof(request_digest_))) { + if (iter->ReadBytes(&data, sizeof(request_digest_))) { memcpy(&request_digest_, data, sizeof(request_digest_)); return is_valid_ = true; } diff --git a/net/http/http_vary_data.h b/net/http/http_vary_data.h index ec97956..bc60c1f 100644 --- a/net/http/http_vary_data.h +++ b/net/http/http_vary_data.h @@ -52,7 +52,7 @@ class NET_EXPORT_PRIVATE HttpVaryData { // is_valid() will return true. Otherwise, false is returned to indicate // that this object is marked as invalid. // - bool InitFromPickle(const Pickle& pickle, PickleIterator* pickle_iter); + bool InitFromPickle(PickleIterator* pickle_iter); // Call this method to persist the vary data. Illegal to call this on an // invalid object. diff --git a/net/quic/crypto/quic_server_info.cc b/net/quic/crypto/quic_server_info.cc index 519d7b5..c86d1f6 100644 --- a/net/quic/crypto/quic_server_info.cc +++ b/net/quic/crypto/quic_server_info.cc @@ -67,7 +67,7 @@ bool QuicServerInfo::ParseInner(const string& data) { PickleIterator iter(p); int version = -1; - if (!p.ReadInt(&iter, &version)) { + if (!iter.ReadInt(&version)) { DVLOG(1) << "Missing version"; return false; } @@ -77,29 +77,29 @@ bool QuicServerInfo::ParseInner(const string& data) { return false; } - if (!p.ReadString(&iter, &state->server_config)) { + if (!iter.ReadString(&state->server_config)) { DVLOG(1) << "Malformed server_config"; return false; } - if (!p.ReadString(&iter, &state->source_address_token)) { + if (!iter.ReadString(&state->source_address_token)) { DVLOG(1) << "Malformed source_address_token"; return false; } - if (!p.ReadString(&iter, &state->server_config_sig)) { + if (!iter.ReadString(&state->server_config_sig)) { DVLOG(1) << "Malformed server_config_sig"; return false; } // Read certs. uint32 num_certs; - if (!p.ReadUInt32(&iter, &num_certs)) { + if (!iter.ReadUInt32(&num_certs)) { DVLOG(1) << "Malformed num_certs"; return false; } for (uint32 i = 0; i < num_certs; i++) { string cert; - if (!p.ReadString(&iter, &cert)) { + if (!iter.ReadString(&cert)) { DVLOG(1) << "Malformed cert"; return false; } -- cgit v1.1