[QUIC] Remove using from headers and make git cl lint happy.
Using directives:
* Remove using std::string, std::list, and base::StringPiece directives from
header files.
* Add namespace qualifiers to string, list, and StringPiece in .cc files
(or add using directives where it makes sense).
* Move using directives consistently after #includes and before namespace.
git cl lint:
* #include std headers that are used.
* Fix #include orders.
* Remove two unnecessary semicolons and add one space.
* Add explicit qualifier to a constructor with one argument.
* Remove explicit qualifier from a constructor with zero arguments.
* Add argument name to one method declaration.
* Use static_cast<> instead of C-style cast.
* Fix one header guard closing #endif comment.
This CL lands server change 118254530 by bnc.
Review URL: https://codereview.chromium.org/1839523002
Cr-Commit-Position: refs/heads/master@{#384899}
diff --git a/components/suggestions/suggestions_service_unittest.cc b/components/suggestions/suggestions_service_unittest.cc
index 01a90938..df4b9ed 100644
--- a/components/suggestions/suggestions_service_unittest.cc
+++ b/components/suggestions/suggestions_service_unittest.cc
@@ -692,10 +692,10 @@
EXPECT_FALSE(SuggestionsService::GetBlacklistedUrl(*fetcher, &retrieved_url));
// An actual blacklist request.
- string blacklisted_url = "http://blacklisted.com/a?b=c&d=e";
- string encoded_blacklisted_url =
+ std::string blacklisted_url = "http://blacklisted.com/a?b=c&d=e";
+ std::string encoded_blacklisted_url =
"https%3A%2F%2Fptop.only.wip.la%3A443%2Fhttp%2Fblacklisted.com%2Fa%3Fb%3Dc%26d%3De";
- string blacklist_request_prefix(
+ std::string blacklist_request_prefix(
SuggestionsService::BuildSuggestionsBlacklistURLPrefix());
request_url.reset(
new GURL(blacklist_request_prefix + encoded_blacklisted_url));
diff --git a/net/quic/crypto/quic_compressed_certs_cache.cc b/net/quic/crypto/quic_compressed_certs_cache.cc
index e4dffaf..92d66d2 100644
--- a/net/quic/crypto/quic_compressed_certs_cache.cc
+++ b/net/quic/crypto/quic_compressed_certs_cache.cc
@@ -4,6 +4,8 @@
#include "net/quic/crypto/quic_compressed_certs_cache.h"
+using std::string;
+
namespace net {
namespace {
diff --git a/net/quic/crypto/quic_compressed_certs_cache.h b/net/quic/crypto/quic_compressed_certs_cache.h
index 1a731c8..fe120f6b 100644
--- a/net/quic/crypto/quic_compressed_certs_cache.h
+++ b/net/quic/crypto/quic_compressed_certs_cache.h
@@ -12,8 +12,6 @@
#include "base/memory/ref_counted.h"
#include "net/quic/crypto/proof_source.h"
-using std::string;
-
namespace net {
// QuicCompressedCertsCache is a cache to track most recently compressed certs.
@@ -26,10 +24,10 @@
// |chain, client_common_set_hashes, client_cached_cert_hashes| hits cache.
// Otherwise, return nullptr.
// Returned pointer might become invalid on the next call to Insert().
- const string* GetCompressedCert(
+ const std::string* GetCompressedCert(
const scoped_refptr<ProofSource::Chain>& chain,
- const string& client_common_set_hashes,
- const string& client_cached_cert_hashes);
+ const std::string& client_common_set_hashes,
+ const std::string& client_cached_cert_hashes);
// Inserts the specified
// |chain, client_common_set_hashes,
@@ -37,9 +35,9 @@
// If the insertion causes the cache to become overfull, entries will
// be deleted in an LRU order to make room.
void Insert(const scoped_refptr<ProofSource::Chain>& chain,
- const string& client_common_set_hashes,
- const string& client_cached_cert_hashes,
- const string& compressed_cert);
+ const std::string& client_common_set_hashes,
+ const std::string& client_cached_cert_hashes,
+ const std::string& compressed_cert);
// Returns max number of cache entries the cache can carry.
size_t MaxSize();
@@ -57,13 +55,13 @@
struct UncompressedCerts {
UncompressedCerts();
UncompressedCerts(const scoped_refptr<ProofSource::Chain>& chain,
- const string* client_common_set_hashes,
- const string* client_cached_cert_hashes);
+ const std::string* client_common_set_hashes,
+ const std::string* client_cached_cert_hashes);
~UncompressedCerts();
const scoped_refptr<ProofSource::Chain> chain;
- const string* client_common_set_hashes;
- const string* client_cached_cert_hashes;
+ const std::string* client_common_set_hashes;
+ const std::string* client_cached_cert_hashes;
};
// Certs stored by QuicCompressedCertsCache where uncompressed certs data is
@@ -73,7 +71,7 @@
public:
CachedCerts();
CachedCerts(const UncompressedCerts& uncompressed_certs,
- const string& compressed_cert);
+ const std::string& compressed_cert);
CachedCerts(const CachedCerts& other);
~CachedCerts();
@@ -83,16 +81,16 @@
bool MatchesUncompressedCerts(
const UncompressedCerts& uncompressed_certs) const;
- const string* compressed_cert() const;
+ const std::string* compressed_cert() const;
private:
// Uncompressed certs data.
scoped_refptr<ProofSource::Chain> chain_;
- const string client_common_set_hashes_;
- const string client_cached_cert_hashes_;
+ const std::string client_common_set_hashes_;
+ const std::string client_cached_cert_hashes_;
// Cached compressed representation derived from uncompressed certs.
- const string compressed_cert_;
+ const std::string compressed_cert_;
};
// Computes a uint64_t hash for |uncompressed_certs|.
diff --git a/net/quic/crypto/quic_compressed_certs_cache_test.cc b/net/quic/crypto/quic_compressed_certs_cache_test.cc
index 50247f50..d444c49d 100644
--- a/net/quic/crypto/quic_compressed_certs_cache_test.cc
+++ b/net/quic/crypto/quic_compressed_certs_cache_test.cc
@@ -11,6 +11,7 @@
#include "net/quic/test_tools/crypto_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
+using std::string;
using std::vector;
namespace net {
diff --git a/net/quic/p2p/quic_p2p_session.cc b/net/quic/p2p/quic_p2p_session.cc
index 0be062b..7b411e02 100644
--- a/net/quic/p2p/quic_p2p_session.cc
+++ b/net/quic/p2p/quic_p2p_session.cc
@@ -69,7 +69,7 @@
}
void QuicP2PSession::OnConnectionClosed(QuicErrorCode error,
- const string& error_details,
+ const std::string& error_details,
ConnectionCloseSource source) {
QuicSession::OnConnectionClosed(error, error_details, source);
diff --git a/net/quic/p2p/quic_p2p_session.h b/net/quic/p2p/quic_p2p_session.h
index 6be1190..ce02958 100644
--- a/net/quic/p2p/quic_p2p_session.h
+++ b/net/quic/p2p/quic_p2p_session.h
@@ -54,7 +54,7 @@
// QuicConnectionVisitorInterface overrides.
void OnConnectionClosed(QuicErrorCode error,
- const string& error_details,
+ const std::string& error_details,
ConnectionCloseSource source) override;
void SetDelegate(Delegate* delegate);
diff --git a/net/quic/quic_chromium_client_session.cc b/net/quic/quic_chromium_client_session.cc
index 82c5bc9ca..8be38c18 100644
--- a/net/quic/quic_chromium_client_session.cc
+++ b/net/quic/quic_chromium_client_session.cc
@@ -812,7 +812,7 @@
void QuicChromiumClientSession::OnConnectionClosed(
QuicErrorCode error,
- const string& error_details,
+ const std::string& error_details,
ConnectionCloseSource source) {
DCHECK(!connection()->connected());
logger_->OnConnectionClosed(error, error_details, source);
diff --git a/net/quic/quic_chromium_client_session.h b/net/quic/quic_chromium_client_session.h
index 2a3012cd..7c7ecd7f 100644
--- a/net/quic/quic_chromium_client_session.h
+++ b/net/quic/quic_chromium_client_session.h
@@ -180,7 +180,7 @@
// QuicConnectionVisitorInterface methods:
void OnConnectionClosed(QuicErrorCode error,
- const string& error_details,
+ const std::string& error_details,
ConnectionCloseSource source) override;
void OnSuccessfulVersionNegotiation(const QuicVersion& version) override;
void OnPathDegrading() override;
diff --git a/net/quic/quic_chromium_client_stream_test.cc b/net/quic/quic_chromium_client_stream_test.cc
index 2b2532c..94d20a9a 100644
--- a/net/quic/quic_chromium_client_stream_test.cc
+++ b/net/quic/quic_chromium_client_stream_test.cc
@@ -60,7 +60,7 @@
// From QuicSession.
MOCK_METHOD3(OnConnectionClosed,
void(QuicErrorCode error,
- const string& error_details,
+ const std::string& error_details,
ConnectionCloseSource source));
MOCK_METHOD1(CreateIncomingDynamicStream, QuicSpdyStream*(QuicStreamId id));
MOCK_METHOD1(CreateOutgoingDynamicStream,
diff --git a/net/quic/quic_client_promised_info.cc b/net/quic/quic_client_promised_info.cc
index d3816bf..f4bef0bc 100644
--- a/net/quic/quic_client_promised_info.cc
+++ b/net/quic/quic_client_promised_info.cc
@@ -9,6 +9,7 @@
using net::SpdyHeaderBlock;
using net::kPushPromiseTimeoutSecs;
+using std::string;
namespace net {
diff --git a/net/quic/quic_client_push_promise_index.cc b/net/quic/quic_client_push_promise_index.cc
index d7bbf76..e62f1f0 100644
--- a/net/quic/quic_client_push_promise_index.cc
+++ b/net/quic/quic_client_push_promise_index.cc
@@ -10,6 +10,7 @@
#include "net/quic/spdy_utils.h"
using net::SpdyHeaderBlock;
+using std::string;
namespace net {
diff --git a/net/quic/quic_client_push_promise_index.h b/net/quic/quic_client_push_promise_index.h
index d060182..f8167ae0 100644
--- a/net/quic/quic_client_push_promise_index.h
+++ b/net/quic/quic_client_push_promise_index.h
@@ -5,8 +5,9 @@
#ifndef NET_QUIC_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_
#define NET_QUIC_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_
-#include "net/quic/quic_client_session_base.h"
+#include <string>
+#include "net/quic/quic_client_session_base.h"
#include "net/quic/quic_types.h"
namespace net {
@@ -23,7 +24,7 @@
// |Try()|.
class NET_EXPORT_PRIVATE Delegate {
public:
- virtual ~Delegate(){};
+ virtual ~Delegate() {}
// The primary lookup matched request with push promise by URL. A
// secondary match is necessary to ensure Vary (RFC 2616, 14.14)
@@ -63,7 +64,7 @@
// Called by client code, used to enforce affinity between requests
// for promised streams and the session the promise came from.
- QuicClientPromisedInfo* GetPromised(const string& url);
+ QuicClientPromisedInfo* GetPromised(const std::string& url);
// Called by client code, to initiate rendezvous between a request
// and a server push stream. If |request|'s url is in the index,
diff --git a/net/quic/quic_client_push_promise_index_test.cc b/net/quic/quic_client_push_promise_index_test.cc
index 5f4eaa4..85c7f0c 100644
--- a/net/quic/quic_client_push_promise_index_test.cc
+++ b/net/quic/quic_client_push_promise_index_test.cc
@@ -15,6 +15,7 @@
using testing::_;
using testing::Return;
using testing::StrictMock;
+using std::string;
namespace net {
namespace test {
diff --git a/net/quic/quic_client_session_base.cc b/net/quic/quic_client_session_base.cc
index 6c7ca5c..dd9974a 100644
--- a/net/quic/quic_client_session_base.cc
+++ b/net/quic/quic_client_session_base.cc
@@ -8,6 +8,8 @@
#include "net/quic/quic_flags.h"
#include "net/quic/spdy_utils.h"
+using std::string;
+
namespace net {
QuicClientSessionBase::QuicClientSessionBase(
diff --git a/net/quic/quic_connection_logger.h b/net/quic/quic_connection_logger.h
index b5591b4a..ff2c917 100644
--- a/net/quic/quic_connection_logger.h
+++ b/net/quic/quic_connection_logger.h
@@ -70,7 +70,7 @@
void OnVersionNegotiationPacket(
const QuicVersionNegotiationPacket& packet) override;
void OnConnectionClosed(QuicErrorCode error,
- const string& error_details,
+ const std::string& error_details,
ConnectionCloseSource source) override;
void OnSuccessfulVersionNegotiation(const QuicVersion& version) override;
void OnRttChanged(QuicTime::Delta rtt) const override;
diff --git a/net/quic/quic_frame_list.cc b/net/quic/quic_frame_list.cc
index 50dcdc0..9267074 100644
--- a/net/quic/quic_frame_list.cc
+++ b/net/quic/quic_frame_list.cc
@@ -4,8 +4,13 @@
#include "net/quic/quic_frame_list.h"
+#include <algorithm>
+
#include "base/logging.h"
+using std::list;
+using std::string;
+
namespace net {
QuicFrameList::FrameData::FrameData(QuicStreamOffset offset,
@@ -29,7 +34,7 @@
}
QuicErrorCode QuicFrameList::OnStreamData(QuicStreamOffset offset,
- StringPiece data,
+ base::StringPiece data,
QuicTime timestamp,
size_t* const bytes_buffered) {
*bytes_buffered = 0;
diff --git a/net/quic/quic_frame_list.h b/net/quic/quic_frame_list.h
index a623597..f529016 100644
--- a/net/quic/quic_frame_list.h
+++ b/net/quic/quic_frame_list.h
@@ -6,14 +6,13 @@
#define NET_QUIC_QUIC_FRAME_LIST_H_
#include <stddef.h>
+#include <list>
+#include <string>
+#include "base/strings/string_piece.h"
#include "net/quic/quic_protocol.h"
#include "net/quic/quic_stream_sequencer_buffer_interface.h"
-using base::StringPiece;
-using std::string;
-using std::list;
-
namespace net {
namespace test {
@@ -26,15 +25,15 @@
// A contiguous segment received by a QUIC stream.
struct FrameData {
FrameData(QuicStreamOffset offset,
- string segment,
+ std::string segment,
const QuicTime timestamp);
const QuicStreamOffset offset;
- string segment;
+ std::string segment;
const QuicTime timestamp;
};
- explicit QuicFrameList();
+ QuicFrameList();
~QuicFrameList() override;
@@ -42,7 +41,7 @@
void Clear() override;
bool Empty() const override;
QuicErrorCode OnStreamData(QuicStreamOffset offset,
- StringPiece data,
+ base::StringPiece data,
QuicTime timestamp,
size_t* bytes_buffered) override;
size_t Readv(const struct iovec* iov, size_t iov_len) override;
@@ -57,19 +56,19 @@
private:
friend class test::QuicStreamSequencerPeer;
- list<FrameData>::iterator FindInsertionPoint(QuicStreamOffset offset,
- size_t len);
+ std::list<FrameData>::iterator FindInsertionPoint(QuicStreamOffset offset,
+ size_t len);
bool FrameOverlapsBufferedData(
QuicStreamOffset offset,
size_t data_len,
- list<FrameData>::const_iterator insertion_point) const;
+ std::list<FrameData>::const_iterator insertion_point) const;
bool IsDuplicate(QuicStreamOffset offset,
size_t data_len,
- list<FrameData>::const_iterator insertion_point) const;
+ std::list<FrameData>::const_iterator insertion_point) const;
- list<FrameData> frame_list_;
+ std::list<FrameData> frame_list_;
// Number of bytes in buffer.
size_t num_bytes_buffered_ = 0;
diff --git a/net/quic/quic_http_stream.cc b/net/quic/quic_http_stream.cc
index ca5cb89..591f3ce 100644
--- a/net/quic/quic_http_stream.cc
+++ b/net/quic/quic_http_stream.cc
@@ -153,7 +153,7 @@
DCHECK(success);
DCHECK(ssl_info_.cert.get());
- string url(request_info->url.spec());
+ std::string url(request_info->url.spec());
QuicClientPromisedInfo* promised =
session_->push_promise_index()->GetPromised(url);
if (promised) {
diff --git a/net/quic/quic_http_stream.h b/net/quic/quic_http_stream.h
index a88a6e1f..01c07606 100644
--- a/net/quic/quic_http_stream.h
+++ b/net/quic/quic_http_stream.h
@@ -9,6 +9,8 @@
#include <stdint.h>
#include <list>
+#include <string>
+#include <vector>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
@@ -107,7 +109,7 @@
void OnIOComplete(int rv);
void DoCallback(int rv);
- int DoLoop(int);
+ int DoLoop(int rv);
int DoStreamRequest();
int DoSetRequestPriority();
int DoSendHeaders();
diff --git a/net/quic/quic_http_stream_test.cc b/net/quic/quic_http_stream_test.cc
index 4458030..afd0f95 100644
--- a/net/quic/quic_http_stream_test.cc
+++ b/net/quic/quic_http_stream_test.cc
@@ -54,6 +54,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+using std::string;
using testing::_;
using testing::AnyNumber;
using testing::Return;
@@ -191,7 +192,7 @@
mock_writes_[i] = MockWrite(writes_[i].mode, writes_[i].packet->data(),
writes_[i].packet->length());
}
- };
+ }
socket_data_.reset(new StaticSocketDataProvider(
nullptr, 0, mock_writes_.get(), writes_.size()));
@@ -236,7 +237,8 @@
session_.reset(new QuicChromiumClientSession(
connection_, std::move(socket),
/*stream_factory=*/nullptr, &crypto_client_stream_factory_, &clock_,
- &transport_security_state_, make_scoped_ptr((QuicServerInfo*)nullptr),
+ &transport_security_state_,
+ make_scoped_ptr(static_cast<QuicServerInfo*>(nullptr)),
QuicServerId(kDefaultServerHostName, kDefaultServerPort,
PRIVACY_MODE_DISABLED),
kQuicYieldAfterPacketsRead,
@@ -272,13 +274,13 @@
SpdyUtils::SerializeUncompressedHeaders(push_promise_);
}
- void SetRequest(const std::string& method,
- const std::string& path,
+ void SetRequest(const string& method,
+ const string& path,
RequestPriority priority) {
request_headers_ = maker_.GetRequestHeaders(method, "http", path);
}
- void SetResponse(const std::string& status, const std::string& body) {
+ void SetResponse(const string& status, const string& body) {
response_headers_ = maker_.GetResponseHeaders(status);
response_data_ = body;
}
@@ -438,8 +440,8 @@
scoped_refptr<IOBufferWithSize> read_buffer_;
SpdyHeaderBlock request_headers_;
SpdyHeaderBlock response_headers_;
- std::string request_data_;
- std::string response_data_;
+ string request_data_;
+ string response_data_;
QuicClientPushPromiseIndex push_promise_index_;
// For server push testing
@@ -510,7 +512,7 @@
EXPECT_EQ(ERR_IO_PENDING, stream_->ReadResponseHeaders(callback_.callback()));
- SetResponse("404 Not Found", std::string());
+ SetResponse("404 Not Found", string());
size_t spdy_response_header_frame_length;
ProcessPacket(ConstructResponseHeadersPacket(
2, kFin, &spdy_response_header_frame_length));
@@ -564,7 +566,7 @@
EXPECT_EQ(ERR_IO_PENDING, stream_->ReadResponseHeaders(callback_.callback()));
- SetResponse("200 OK", std::string());
+ SetResponse("200 OK", string());
// Send the response headers.
size_t spdy_response_header_frame_length;
@@ -656,7 +658,7 @@
headers[":status"] = "200 OK";
headers[":version"] = "HTTP/1.1";
headers["content-type"] = "text/plain";
- headers["big6"] = std::string(1000, 'x'); // Lots of x's.
+ headers["big6"] = string(1000, 'x'); // Lots of x's.
response_headers_ = headers;
size_t spdy_response_headers_frame_length;
@@ -857,7 +859,7 @@
ProcessPacket(ConstructAckPacket(1, 0, 0));
// Send the response headers (but not the body).
- SetResponse("200 OK", std::string());
+ SetResponse("200 OK", string());
size_t spdy_response_headers_frame_length;
ProcessPacket(ConstructResponseHeadersPacket(
2, !kFin, &spdy_response_headers_frame_length));
@@ -924,7 +926,7 @@
ProcessPacket(ConstructAckPacket(1, 0, 0));
// Send the response headers (but not the body).
- SetResponse("200 OK", std::string());
+ SetResponse("200 OK", string());
size_t spdy_response_headers_frame_length;
ProcessPacket(ConstructResponseHeadersPacket(
2, !kFin, &spdy_response_headers_frame_length));
@@ -991,7 +993,7 @@
ProcessPacket(ConstructAckPacket(1, 0, 0));
// Send the response headers (but not the body).
- SetResponse("200 OK", std::string());
+ SetResponse("200 OK", string());
size_t spdy_response_headers_frame_length;
ProcessPacket(ConstructResponseHeadersPacket(
2, !kFin, &spdy_response_headers_frame_length));
@@ -1054,7 +1056,7 @@
ProcessPacket(ConstructAckPacket(1, 0, 0));
// Send the response headers (but not the body).
- SetResponse("200 OK", std::string());
+ SetResponse("200 OK", string());
size_t spdy_response_headers_frame_length;
ProcessPacket(ConstructResponseHeadersPacket(
2, !kFin, &spdy_response_headers_frame_length));
@@ -1648,7 +1650,7 @@
// Ack the request.
ProcessPacket(ConstructAckPacket(2, 0, 0));
- SetResponse("404 Not Found", std::string());
+ SetResponse("404 Not Found", string());
size_t spdy_response_header_frame_length;
ProcessPacket(InnerConstructResponseHeadersPacket(
3, stream_id_ + 2, kFin, &spdy_response_header_frame_length));
diff --git a/net/quic/quic_spdy_session.cc b/net/quic/quic_spdy_session.cc
index 4cf0798..af92387 100644
--- a/net/quic/quic_spdy_session.cc
+++ b/net/quic/quic_spdy_session.cc
@@ -7,6 +7,8 @@
#include "net/quic/quic_bug_tracker.h"
#include "net/quic/quic_headers_stream.h"
+using std::string;
+
namespace net {
QuicSpdySession::QuicSpdySession(QuicConnection* connection,
diff --git a/net/quic/quic_spdy_stream.cc b/net/quic/quic_spdy_stream.cc
index c52f501..2e099ca 100644
--- a/net/quic/quic_spdy_stream.cc
+++ b/net/quic/quic_spdy_stream.cc
@@ -13,8 +13,9 @@
#include "net/quic/spdy_utils.h"
using base::StringPiece;
-using std::min;
using net::SpdyPriority;
+using std::min;
+using std::string;
namespace net {
diff --git a/net/quic/quic_stream_factory.h b/net/quic/quic_stream_factory.h
index 9bbf9957..c2dbfbcf8 100644
--- a/net/quic/quic_stream_factory.h
+++ b/net/quic/quic_stream_factory.h
@@ -8,8 +8,10 @@
#include <stddef.h>
#include <stdint.h>
+#include <deque>
#include <list>
#include <map>
+#include <set>
#include <string>
#include <vector>
@@ -106,7 +108,7 @@
QuicStreamFactory* factory_;
HostPortPair host_port_pair_;
std::string origin_host_;
- string url_;
+ std::string url_;
PrivacyMode privacy_mode_;
BoundNetLog net_log_;
CompletionCallback callback_;
diff --git a/net/quic/quic_stream_sequencer.h b/net/quic/quic_stream_sequencer.h
index 5e01f18..3f37a7ec 100644
--- a/net/quic/quic_stream_sequencer.h
+++ b/net/quic/quic_stream_sequencer.h
@@ -13,8 +13,6 @@
#include "net/quic/quic_protocol.h"
#include "net/quic/quic_stream_sequencer_buffer.h"
-using std::string;
-
namespace net {
namespace test {
diff --git a/net/quic/quic_stream_sequencer_buffer_test.cc b/net/quic/quic_stream_sequencer_buffer_test.cc
index dd845a3..ce0cb72d 100644
--- a/net/quic/quic_stream_sequencer_buffer_test.cc
+++ b/net/quic/quic_stream_sequencer_buffer_test.cc
@@ -4,6 +4,7 @@
#include "net/quic/quic_stream_sequencer_buffer.h"
#include <algorithm>
+#include <limits>
#include <map>
#include <string>
#include <utility>
@@ -19,6 +20,7 @@
#include "testing/gtest/include/gtest/gtest.h"
using std::min;
+using std::string;
namespace net {
@@ -204,7 +206,7 @@
}
TEST_F(QuicStreamSequencerBufferTest, OnStreamDataWithinBlock) {
- std::string source(1024, 'a');
+ string source(1024, 'a');
size_t written;
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
QuicTime t = clock_.ApproximateNow();
@@ -226,7 +228,7 @@
}
TEST_F(QuicStreamSequencerBufferTest, OnStreamDataWithOverlap) {
- std::string source(1024, 'a');
+ string source(1024, 'a');
// Write something into [800, 1824)
size_t written;
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
@@ -248,12 +250,12 @@
TEST_F(QuicStreamSequencerBufferTest,
OnStreamDataOverlapAndDuplicateCornerCases) {
- std::string source(1024, 'a');
+ string source(1024, 'a');
// Write something into [800, 1824)
size_t written;
buffer_->OnStreamData(800, source, clock_.ApproximateNow(), &written,
&error_details_);
- source = std::string(800, 'b');
+ source = string(800, 'b');
// Try to write to [1, 801), but should fail due to overlapping
EXPECT_EQ(QUIC_OVERLAPPING_STREAM_DATA,
buffer_->OnStreamData(1, source, clock_.ApproximateNow(), &written,
@@ -263,7 +265,7 @@
buffer_->OnStreamData(0, source, clock_.ApproximateNow(), &written,
&error_details_));
// Try to write one byte to [1823, 1824), but should count as duplicate
- std::string one_byte = "c";
+ string one_byte = "c";
EXPECT_EQ(QUIC_NO_ERROR,
buffer_->OnStreamData(1823, one_byte, clock_.ApproximateNow(),
&written, &error_details_));
@@ -278,13 +280,13 @@
}
TEST_F(QuicStreamSequencerBufferTest, OnStreamDataWithoutOverlap) {
- std::string source(1024, 'a');
+ string source(1024, 'a');
// Write something into [800, 1824).
size_t written;
EXPECT_EQ(QUIC_NO_ERROR,
buffer_->OnStreamData(800, source, clock_.ApproximateNow(),
&written, &error_details_));
- source = std::string(100, 'b');
+ source = string(100, 'b');
// Write something into [kBlockSizeBytes * 2 - 20, kBlockSizeBytes * 2 + 80).
EXPECT_EQ(QUIC_NO_ERROR,
buffer_->OnStreamData(kBlockSizeBytes * 2 - 20, source,
@@ -331,7 +333,7 @@
TEST_F(QuicStreamSequencerBufferTest, OnStreamDataTillEnd) {
// Write 50 bytes to the end.
const size_t kBytesToWrite = 50;
- std::string source(kBytesToWrite, 'a');
+ string source(kBytesToWrite, 'a');
size_t written;
EXPECT_EQ(QUIC_NO_ERROR,
buffer_->OnStreamData(max_capacity_bytes_ - kBytesToWrite, source,
@@ -344,7 +346,7 @@
TEST_F(QuicStreamSequencerBufferTest, OnStreamDataTillEndCorner) {
// Write 1 byte to the end.
const size_t kBytesToWrite = 1;
- std::string source(kBytesToWrite, 'a');
+ string source(kBytesToWrite, 'a');
size_t written;
EXPECT_EQ(QUIC_NO_ERROR,
buffer_->OnStreamData(max_capacity_bytes_ - kBytesToWrite, source,
@@ -355,7 +357,7 @@
}
TEST_F(QuicStreamSequencerBufferTest, OnStreamDataBeyondCapacity) {
- std::string source(60, 'a');
+ string source(60, 'a');
size_t written;
EXPECT_EQ(QUIC_INTERNAL_ERROR,
buffer_->OnStreamData(max_capacity_bytes_ - 50, source,
@@ -379,14 +381,14 @@
}
TEST_F(QuicStreamSequencerBufferTest, Readv100Bytes) {
- std::string source(1024, 'a');
+ string source(1024, 'a');
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
QuicTime t1 = clock_.ApproximateNow();
// Write something into [kBlockSizeBytes, kBlockSizeBytes + 1024).
size_t written;
buffer_->OnStreamData(kBlockSizeBytes, source, t1, &written, &error_details_);
EXPECT_FALSE(buffer_->HasBytesToRead());
- source = std::string(100, 'b');
+ source = string(100, 'b');
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
QuicTime t2 = clock_.ApproximateNow();
// Write something into [0, 100).
@@ -399,13 +401,13 @@
size_t read = buffer_->Readv(iovecs, 3);
EXPECT_EQ(100u, read);
EXPECT_EQ(100u, buffer_->BytesConsumed());
- EXPECT_EQ(source, std::string(dest, read));
+ EXPECT_EQ(source, string(dest, read));
EXPECT_EQ(1u, helper_->frame_arrival_time_map()->size());
EXPECT_TRUE(helper_->CheckBufferInvariants());
}
TEST_F(QuicStreamSequencerBufferTest, ReadvAcrossBlocks) {
- std::string source(kBlockSizeBytes + 50, 'a');
+ string source(kBlockSizeBytes + 50, 'a');
// Write 1st block to full and extand 50 bytes to next block.
size_t written;
buffer_->OnStreamData(0, source, clock_.ApproximateNow(), &written,
@@ -419,7 +421,7 @@
buffer_->Readv(iovecs, 2);
}
// The last read only reads the rest 50 bytes in 2nd block.
- EXPECT_EQ(std::string(50, 'a'), std::string(dest, 50));
+ EXPECT_EQ(string(50, 'a'), string(dest, 50));
EXPECT_EQ(0, dest[50]) << "Dest[50] shouln't be filled.";
EXPECT_EQ(source.size(), buffer_->BytesConsumed());
EXPECT_TRUE(buffer_->Empty());
@@ -427,7 +429,7 @@
}
TEST_F(QuicStreamSequencerBufferTest, ClearAfterRead) {
- std::string source(kBlockSizeBytes + 50, 'a');
+ string source(kBlockSizeBytes + 50, 'a');
// Write 1st block to full with 'a'.
size_t written;
buffer_->OnStreamData(0, source, clock_.ApproximateNow(), &written,
@@ -444,7 +446,7 @@
TEST_F(QuicStreamSequencerBufferTest,
OnStreamDataAcrossLastBlockAndFillCapacity) {
- std::string source(kBlockSizeBytes + 50, 'a');
+ string source(kBlockSizeBytes + 50, 'a');
// Write 1st block to full with 'a'.
size_t written;
buffer_->OnStreamData(0, source, clock_.ApproximateNow(), &written,
@@ -457,7 +459,7 @@
// Write more than half block size of bytes in the last block with 'b', which
// will wrap to the beginning and reaches the full capacity.
- source = std::string(0.5 * kBlockSizeBytes + 512, 'b');
+ source = string(0.5 * kBlockSizeBytes + 512, 'b');
EXPECT_EQ(QUIC_NO_ERROR, buffer_->OnStreamData(2 * kBlockSizeBytes, source,
clock_.ApproximateNow(),
&written, &error_details_));
@@ -467,7 +469,7 @@
TEST_F(QuicStreamSequencerBufferTest,
OnStreamDataAcrossLastBlockAndExceedCapacity) {
- std::string source(kBlockSizeBytes + 50, 'a');
+ string source(kBlockSizeBytes + 50, 'a');
// Write 1st block to full.
size_t written;
buffer_->OnStreamData(0, source, clock_.ApproximateNow(), &written,
@@ -479,7 +481,7 @@
// Try to write from [max_capacity_bytes_ - 0.5 * kBlockSizeBytes,
// max_capacity_bytes_ + 512 + 1). But last bytes exceeds current capacity.
- source = std::string(0.5 * kBlockSizeBytes + 512 + 1, 'b');
+ source = string(0.5 * kBlockSizeBytes + 512 + 1, 'b');
EXPECT_EQ(QUIC_INTERNAL_ERROR,
buffer_->OnStreamData(2 * kBlockSizeBytes, source,
clock_.ApproximateNow(), &written,
@@ -490,7 +492,7 @@
TEST_F(QuicStreamSequencerBufferTest, ReadvAcrossLastBlock) {
// Write to full capacity and read out 512 bytes at beginning and continue
// appending 256 bytes.
- std::string source(max_capacity_bytes_, 'a');
+ string source(max_capacity_bytes_, 'a');
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
QuicTime t = clock_.ApproximateNow();
size_t written;
@@ -498,7 +500,7 @@
char dest[512]{0};
const iovec iov{dest, 512};
buffer_->Readv(&iov, 1);
- source = std::string(256, 'b');
+ source = string(256, 'b');
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
QuicTime t2 = clock_.ApproximateNow();
buffer_->OnStreamData(max_capacity_bytes_, source, t2, &written,
@@ -535,7 +537,7 @@
TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionsBlockedByGap) {
// Write into [1, 1024).
- std::string source(1023, 'a');
+ string source(1023, 'a');
size_t written;
buffer_->OnStreamData(1, source, clock_.ApproximateNow(), &written,
&error_details_);
@@ -548,7 +550,7 @@
TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionsTillEndOfBlock) {
// Write first block to full with [0, 256) 'a' and the rest 'b' then read out
// [0, 256)
- std::string source(kBlockSizeBytes, 'a');
+ string source(kBlockSizeBytes, 'a');
size_t written;
buffer_->OnStreamData(0, source, clock_.ApproximateNow(), &written,
&error_details_);
@@ -558,14 +560,14 @@
iovec iovs[2];
int iov_count = buffer_->GetReadableRegions(iovs, 2);
EXPECT_EQ(1, iov_count);
- EXPECT_EQ(std::string(kBlockSizeBytes - 256, 'a'),
- std::string(reinterpret_cast<const char*>(iovs[0].iov_base),
- iovs[0].iov_len));
+ EXPECT_EQ(
+ string(kBlockSizeBytes - 256, 'a'),
+ string(reinterpret_cast<const char*>(iovs[0].iov_base), iovs[0].iov_len));
}
TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionsWithinOneBlock) {
// Write into [0, 1024) and then read out [0, 256)
- std::string source(1024, 'a');
+ string source(1024, 'a');
size_t written;
buffer_->OnStreamData(0, source, clock_.ApproximateNow(), &written,
&error_details_);
@@ -575,15 +577,15 @@
iovec iovs[2];
int iov_count = buffer_->GetReadableRegions(iovs, 2);
EXPECT_EQ(1, iov_count);
- EXPECT_EQ(std::string(1024 - 256, 'a'),
- std::string(reinterpret_cast<const char*>(iovs[0].iov_base),
- iovs[0].iov_len));
+ EXPECT_EQ(
+ string(1024 - 256, 'a'),
+ string(reinterpret_cast<const char*>(iovs[0].iov_base), iovs[0].iov_len));
}
TEST_F(QuicStreamSequencerBufferTest,
GetReadableRegionsAcrossBlockWithLongIOV) {
// Write into [0, 2 * kBlockSizeBytes + 1024) and then read out [0, 1024)
- std::string source(2 * kBlockSizeBytes + 1024, 'a');
+ string source(2 * kBlockSizeBytes + 1024, 'a');
size_t written;
buffer_->OnStreamData(0, source, clock_.ApproximateNow(), &written,
&error_details_);
@@ -602,14 +604,14 @@
GetReadableRegionsWithMultipleIOVsAcrossEnd) {
// Write into [0, 2 * kBlockSizeBytes + 1024) and then read out [0, 1024)
// and then append 1024 + 512 bytes.
- std::string source(2.5 * kBlockSizeBytes - 1024, 'a');
+ string source(2.5 * kBlockSizeBytes - 1024, 'a');
size_t written;
buffer_->OnStreamData(0, source, clock_.ApproximateNow(), &written,
&error_details_);
char dest[1024];
helper_->Read(dest, 1024);
// Write across the end.
- source = std::string(1024 + 512, 'b');
+ source = string(1024 + 512, 'b');
buffer_->OnStreamData(2.5 * kBlockSizeBytes - 1024, source,
clock_.ApproximateNow(), &written, &error_details_);
// Use short iovec's.
@@ -623,9 +625,9 @@
EXPECT_EQ(4, buffer_->GetReadableRegions(iovs1, 5));
EXPECT_EQ(0.5 * kBlockSizeBytes, iovs1[2].iov_len);
EXPECT_EQ(512u, iovs1[3].iov_len);
- EXPECT_EQ(std::string(512, 'b'),
- std::string(reinterpret_cast<const char*>(iovs1[3].iov_base),
- iovs1[3].iov_len));
+ EXPECT_EQ(string(512, 'b'),
+ string(reinterpret_cast<const char*>(iovs1[3].iov_base),
+ iovs1[3].iov_len));
}
TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionEmpty) {
@@ -638,7 +640,7 @@
TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionBeforeGap) {
// Write into [1, 1024).
- std::string source(1023, 'a');
+ string source(1023, 'a');
size_t written;
buffer_->OnStreamData(1, source, clock_.ApproximateNow(), &written,
&error_details_);
@@ -651,7 +653,7 @@
TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionTillEndOfBlock) {
// Write into [0, kBlockSizeBytes + 1) and then read out [0, 256)
- std::string source(kBlockSizeBytes + 1, 'a');
+ string source(kBlockSizeBytes + 1, 'a');
size_t written;
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
QuicTime t = clock_.ApproximateNow();
@@ -663,14 +665,13 @@
QuicTime t2 = QuicTime::Zero();
EXPECT_TRUE(buffer_->GetReadableRegion(&iov, &t2));
EXPECT_EQ(t, t2);
- EXPECT_EQ(
- std::string(kBlockSizeBytes - 256, 'a'),
- std::string(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len));
+ EXPECT_EQ(string(kBlockSizeBytes - 256, 'a'),
+ string(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len));
}
TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionTillGap) {
// Write into [0, kBlockSizeBytes - 1) and then read out [0, 256)
- std::string source(kBlockSizeBytes - 1, 'a');
+ string source(kBlockSizeBytes - 1, 'a');
size_t written;
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
QuicTime t = clock_.ApproximateNow();
@@ -682,14 +683,13 @@
QuicTime t2 = QuicTime::Zero();
EXPECT_TRUE(buffer_->GetReadableRegion(&iov, &t2));
EXPECT_EQ(t, t2);
- EXPECT_EQ(
- std::string(kBlockSizeBytes - 1 - 256, 'a'),
- std::string(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len));
+ EXPECT_EQ(string(kBlockSizeBytes - 1 - 256, 'a'),
+ string(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len));
}
TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionByArrivalTime) {
// Write into [0, kBlockSizeBytes - 100) and then read out [0, 256)
- std::string source(kBlockSizeBytes - 100, 'a');
+ string source(kBlockSizeBytes - 100, 'a');
size_t written;
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
QuicTime t = clock_.ApproximateNow();
@@ -697,13 +697,13 @@
char dest[256];
helper_->Read(dest, 256);
// Write into [kBlockSizeBytes - 100, kBlockSizeBytes - 50)] in same time
- std::string source2(50, 'b');
+ string source2(50, 'b');
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
buffer_->OnStreamData(kBlockSizeBytes - 100, source2, t, &written,
&error_details_);
// Write into [kBlockSizeBytes - 50, kBlockSizeBytes)] in another time
- std::string source3(50, 'c');
+ string source3(50, 'c');
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
QuicTime t3 = clock_.ApproximateNow();
buffer_->OnStreamData(kBlockSizeBytes - 50, source3, t3, &written,
@@ -714,14 +714,13 @@
QuicTime t4 = QuicTime::Zero();
EXPECT_TRUE(buffer_->GetReadableRegion(&iov, &t4));
EXPECT_EQ(t, t4);
- EXPECT_EQ(
- std::string(kBlockSizeBytes - 100 - 256, 'a') + source2,
- std::string(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len));
+ EXPECT_EQ(string(kBlockSizeBytes - 100 - 256, 'a') + source2,
+ string(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len));
}
TEST_F(QuicStreamSequencerBufferTest, MarkConsumedInOneBlock) {
// Write into [0, 1024) and then read out [0, 256)
- std::string source(1024, 'a');
+ string source(1024, 'a');
size_t written;
buffer_->OnStreamData(0, source, clock_.ApproximateNow(), &written,
&error_details_);
@@ -740,7 +739,7 @@
TEST_F(QuicStreamSequencerBufferTest, MarkConsumedNotEnoughBytes) {
// Write into [0, 1024) and then read out [0, 256)
- std::string source(1024, 'a');
+ string source(1024, 'a');
size_t written;
QuicTime t = clock_.ApproximateNow();
buffer_->OnStreamData(0, source, t, &written, &error_details_);
@@ -763,7 +762,7 @@
TEST_F(QuicStreamSequencerBufferTest, MarkConsumedAcrossBlock) {
// Write into [0, 2 * kBlockSizeBytes + 1024) and then read out [0, 1024)
- std::string source(2 * kBlockSizeBytes + 1024, 'a');
+ string source(2 * kBlockSizeBytes + 1024, 'a');
size_t written;
buffer_->OnStreamData(0, source, clock_.ApproximateNow(), &written,
&error_details_);
@@ -779,13 +778,13 @@
TEST_F(QuicStreamSequencerBufferTest, MarkConsumedAcrossEnd) {
// Write into [0, 2.5 * kBlockSizeBytes - 1024) and then read out [0, 1024)
// and then append 1024 + 512 bytes.
- std::string source(2.5 * kBlockSizeBytes - 1024, 'a');
+ string source(2.5 * kBlockSizeBytes - 1024, 'a');
size_t written;
buffer_->OnStreamData(0, source, clock_.ApproximateNow(), &written,
&error_details_);
char dest[1024];
helper_->Read(dest, 1024);
- source = std::string(1024 + 512, 'b');
+ source = string(1024 + 512, 'b');
buffer_->OnStreamData(2.5 * kBlockSizeBytes - 1024, source,
clock_.ApproximateNow(), &written, &error_details_);
EXPECT_EQ(1024u, buffer_->BytesConsumed());
@@ -806,7 +805,7 @@
TEST_F(QuicStreamSequencerBufferTest, FlushBufferedFrames) {
// Write into [0, 2.5 * kBlockSizeBytes - 1024) and then read out [0, 1024).
- std::string source(max_capacity_bytes_ - 1024, 'a');
+ string source(max_capacity_bytes_ - 1024, 'a');
size_t written;
buffer_->OnStreamData(0, source, clock_.ApproximateNow(), &written,
&error_details_);
@@ -814,7 +813,7 @@
helper_->Read(dest, 1024);
EXPECT_EQ(1024u, buffer_->BytesConsumed());
// Write [1024, 512) to the physical beginning.
- source = std::string(512, 'b');
+ source = string(512, 'b');
buffer_->OnStreamData(max_capacity_bytes_, source, clock_.ApproximateNow(),
&written, &error_details_);
EXPECT_EQ(512u, written);
diff --git a/net/quic/test_tools/mock_quic_client_promised_info.cc b/net/quic/test_tools/mock_quic_client_promised_info.cc
index 3ec0eab..793ed3f 100644
--- a/net/quic/test_tools/mock_quic_client_promised_info.cc
+++ b/net/quic/test_tools/mock_quic_client_promised_info.cc
@@ -4,6 +4,8 @@
#include "net/quic/test_tools/mock_quic_client_promised_info.h"
+using std::string;
+
namespace net {
namespace test {
diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc
index 66bc675..75b5dd5 100644
--- a/net/tools/quic/end_to_end_test.cc
+++ b/net/tools/quic/end_to_end_test.cc
@@ -1674,7 +1674,7 @@
void OnCompleteResponse(QuicStreamId id,
const BalsaHeaders& response_headers,
const string& response_body) override {
- std::string debug_string;
+ string debug_string;
response_headers.DumpHeadersToString(&debug_string);
DVLOG(1) << "response for stream " << id << " " << debug_string << "\n"
<< response_body;
@@ -2196,7 +2196,7 @@
// push response.
test::GenerateBody(&large_resource, resource_size);
}
- list<QuicInMemoryCache::ServerPushInfo> push_resources;
+ std::list<QuicInMemoryCache::ServerPushInfo> push_resources;
for (size_t i = 0; i < num_resources; ++i) {
string url = push_urls[i];
GURL resource_url(url);
diff --git a/net/tools/quic/quic_client_session_test.cc b/net/tools/quic/quic_client_session_test.cc
index 4a3fd13..1619eed 100644
--- a/net/tools/quic/quic_client_session_test.cc
+++ b/net/tools/quic/quic_client_session_test.cc
@@ -38,6 +38,7 @@
using net::test::kClientDataStreamId1;
using net::test::kServerDataStreamId1;
using net::test::kTestPort;
+using std::string;
using testing::AnyNumber;
using testing::Invoke;
using testing::Truly;
diff --git a/net/tools/quic/quic_dispatcher.cc b/net/tools/quic/quic_dispatcher.cc
index 88189e0..6d08fbe2 100644
--- a/net/tools/quic/quic_dispatcher.cc
+++ b/net/tools/quic/quic_dispatcher.cc
@@ -17,10 +17,10 @@
#include "net/tools/quic/quic_simple_server_session.h"
#include "net/tools/quic/quic_time_wait_list_manager.h"
-namespace net {
-
-using std::make_pair;
using base::StringPiece;
+using std::string;
+
+namespace net {
namespace {
diff --git a/net/tools/quic/quic_in_memory_cache.cc b/net/tools/quic/quic_in_memory_cache.cc
index aa45d2f..4efd73d 100644
--- a/net/tools/quic/quic_in_memory_cache.cc
+++ b/net/tools/quic/quic_in_memory_cache.cc
@@ -18,6 +18,7 @@
using base::FilePath;
using base::IntToString;
using base::StringPiece;
+using std::list;
using std::string;
namespace net {
@@ -26,7 +27,8 @@
class ResourceFileImpl : public net::QuicInMemoryCache::ResourceFile {
public:
- ResourceFileImpl(const base::FilePath& file_name) : ResourceFile(file_name) {}
+ explicit ResourceFileImpl(const base::FilePath& file_name)
+ : ResourceFile(file_name) {}
void Read() override {
base::ReadFileToString(FilePath(file_name_), &file_contents_);
@@ -53,7 +55,7 @@
StringPiece x_push_url("X-Push-Url");
if (http_headers_->HasHeader(x_push_url)) {
size_t iter = 0;
- std::unique_ptr<std::string> push_url(new string());
+ std::unique_ptr<string> push_url(new string());
while (
http_headers_->EnumerateHeader(&iter, x_push_url, push_url.get())) {
push_urls_.push_back(StringPiece(*push_url));
@@ -70,8 +72,8 @@
private:
scoped_refptr<HttpResponseHeaders> http_headers_;
- std::string url_;
- std::list<std::unique_ptr<string>> push_url_values_;
+ string url_;
+ list<std::unique_ptr<string>> push_url_values_;
DISALLOW_COPY_AND_ASSIGN(ResourceFileImpl);
};
diff --git a/net/tools/quic/quic_in_memory_cache.h b/net/tools/quic/quic_in_memory_cache.h
index e3a1324..72b210a 100644
--- a/net/tools/quic/quic_in_memory_cache.h
+++ b/net/tools/quic/quic_in_memory_cache.h
@@ -21,10 +21,6 @@
#include "net/spdy/spdy_framer.h"
#include "url/gurl.h"
-using base::StringPiece;
-using std::string;
-using std::list;
-
namespace base {
template <typename Type>
@@ -51,12 +47,12 @@
ServerPushInfo(GURL request_url,
const SpdyHeaderBlock& headers,
SpdyPriority priority,
- string body);
+ std::string body);
ServerPushInfo(const ServerPushInfo& other);
GURL request_url;
SpdyHeaderBlock headers;
SpdyPriority priority;
- string body;
+ std::string body;
};
enum SpecialResponseType {
@@ -106,15 +102,15 @@
virtual void Read() = 0;
void SetHostPathFromBase(base::StringPiece base);
- StringPiece host() { return host_; }
+ base::StringPiece host() { return host_; }
void set_host(base::StringPiece host) { host_ = host; }
- StringPiece path() { return path_; }
+ base::StringPiece path() { return path_; }
void set_path(base::StringPiece path) { path_ = path; }
SpdyHeaderBlock spdy_headers() { return spdy_headers_; }
- StringPiece body() { return body_; }
+ base::StringPiece body() { return body_; }
const std::vector<base::StringPiece>& push_urls() { return push_urls_; }
@@ -123,12 +119,12 @@
protected:
void HandleXOriginalUrl();
void HandlePushUrls(const std::vector<base::StringPiece>& push_urls);
- StringPiece RemoveScheme(base::StringPiece url);
+ base::StringPiece RemoveScheme(base::StringPiece url);
- const string cache_directory_;
+ const std::string cache_directory_;
const base::FilePath file_name_;
const std::string file_name_string_;
- string file_contents_;
+ std::string file_contents_;
base::StringPiece body_;
SpdyHeaderBlock spdy_headers_;
base::StringPiece x_original_url_;
@@ -191,10 +187,10 @@
void AddDefaultResponse(Response* response);
// |cache_cirectory| can be generated using `wget -p --save-headers <url>`.
- void InitializeFromDirectory(const string& cache_directory);
+ void InitializeFromDirectory(const std::string& cache_directory);
// Find all the server push resources associated with |request_url|.
- list<ServerPushInfo> GetServerPushResources(string request_url);
+ std::list<ServerPushInfo> GetServerPushResources(std::string request_url);
private:
typedef std::unordered_map<std::string, Response*> ResponseMap;
@@ -214,7 +210,7 @@
base::StringPiece response_body,
const SpdyHeaderBlock& response_trailers);
- string GetKey(base::StringPiece host, base::StringPiece path) const;
+ std::string GetKey(base::StringPiece host, base::StringPiece path) const;
// Add some server push urls with given responses for specified
// request if these push resources are not associated with this request yet.
@@ -224,7 +220,7 @@
// Check if push resource(push_host/push_path) associated with given request
// url already exists in server push map.
- bool PushResourceExistsInCache(string original_request_url,
+ bool PushResourceExistsInCache(std::string original_request_url,
ServerPushInfo resource);
// Cached responses.
@@ -234,7 +230,7 @@
scoped_ptr<Response> default_response_;
// A map from request URL to associated server push responses (if any).
- std::multimap<string, ServerPushInfo> server_push_resources_;
+ std::multimap<std::string, ServerPushInfo> server_push_resources_;
DISALLOW_COPY_AND_ASSIGN(QuicInMemoryCache);
};
diff --git a/net/tools/quic/quic_server_session_base.cc b/net/tools/quic/quic_server_session_base.cc
index 2027ae49..78ddf0f8 100644
--- a/net/tools/quic/quic_server_session_base.cc
+++ b/net/tools/quic/quic_server_session_base.cc
@@ -12,6 +12,8 @@
#include "net/quic/quic_spdy_session.h"
#include "net/quic/reliable_quic_stream.h"
+using std::string;
+
namespace net {
QuicServerSessionBase::QuicServerSessionBase(
diff --git a/net/tools/quic/quic_simple_server_session.cc b/net/tools/quic/quic_simple_server_session.cc
index 38dac8e..8a31699e 100644
--- a/net/tools/quic/quic_simple_server_session.cc
+++ b/net/tools/quic/quic_simple_server_session.cc
@@ -14,6 +14,8 @@
#include "net/tools/quic/quic_simple_server_stream.h"
#include "url/gurl.h"
+using std::string;
+
namespace net {
QuicSimpleServerSession::QuicSimpleServerSession(
diff --git a/net/tools/quic/quic_simple_server_session.h b/net/tools/quic/quic_simple_server_session.h
index 92c65d60..2754f36 100644
--- a/net/tools/quic/quic_simple_server_session.h
+++ b/net/tools/quic/quic_simple_server_session.h
@@ -113,7 +113,7 @@
// Copying the rest headers ensures they are the same as the original
// request, especially cookies.
SpdyHeaderBlock SynthesizePushRequestHeaders(
- string request_url,
+ std::string request_url,
QuicInMemoryCache::ServerPushInfo resource,
const SpdyHeaderBlock& original_request_headers);
@@ -153,4 +153,4 @@
} // namespace net
-#endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_
+#endif // NET_TOOLS_QUIC_QUIC_SIMPLE_SERVER_SESSION_H_