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

Side by Side Diff: net/tools/balsa/balsa_headers.cc

Issue 1897033002: Reland 'Convert //net and //chromecast to std::unordered_*' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix TestDownloadRequestHandler Created 4 years, 8 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 | « net/spdy/write_blocked_list.h ('k') | net/tools/balsa/string_piece_utils.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/tools/balsa/balsa_headers.h" 5 #include "net/tools/balsa/balsa_headers.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8
8 #include <algorithm> 9 #include <algorithm>
9 #include <string> 10 #include <string>
11 #include <unordered_set>
10 #include <utility> 12 #include <utility>
11 #include <vector> 13 #include <vector>
12 14
13 #include "base/containers/hash_tables.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
16 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
17 #include "net/tools/balsa/balsa_enums.h" 18 #include "net/tools/balsa/balsa_enums.h"
18 #include "net/tools/balsa/buffer_interface.h" 19 #include "net/tools/balsa/buffer_interface.h"
19 #include "net/tools/balsa/simple_buffer.h" 20 #include "net/tools/balsa/simple_buffer.h"
20 #include "third_party/tcmalloc/chromium/src/base/googleinit.h" 21 #include "third_party/tcmalloc/chromium/src/base/googleinit.h"
21 22
22 #if defined(COMPILER_MSVC) 23 #if defined(COMPILER_MSVC)
23 #include <string.h> 24 #include <string.h>
24 #define snprintf _snprintf 25 #define snprintf _snprintf
25 #define strncasecmp _strnicmp 26 #define strncasecmp _strnicmp
26 #else 27 #else
27 #include <strings.h> 28 #include <strings.h>
28 #endif 29 #endif
29 30
30 namespace { 31 namespace {
31 32
32 const char kContentLength[] = "Content-Length"; 33 const char kContentLength[] = "Content-Length";
33 const char kTransferEncoding[] = "Transfer-Encoding"; 34 const char kTransferEncoding[] = "Transfer-Encoding";
34 const char kSpaceChar = ' '; 35 const char kSpaceChar = ' ';
35 36
36 #if defined(COMPILER_MSVC) 37 std::unordered_set<base::StringPiece,
37 base::hash_set<base::StringPiece, 38 net::StringPieceCaseHash,
38 net::StringPieceCaseCompare> g_multivalued_headers; 39 net::StringPieceCaseEqual>
39 #else 40 g_multivalued_headers;
40 base::hash_set<base::StringPiece,
41 net::StringPieceCaseHash,
42 net::StringPieceCaseEqual> g_multivalued_headers;
43 #endif
44 41
45 void InitMultivaluedHeaders() { 42 void InitMultivaluedHeaders() {
46 g_multivalued_headers.insert("accept"); 43 g_multivalued_headers.insert("accept");
47 g_multivalued_headers.insert("accept-charset"); 44 g_multivalued_headers.insert("accept-charset");
48 g_multivalued_headers.insert("accept-encoding"); 45 g_multivalued_headers.insert("accept-encoding");
49 g_multivalued_headers.insert("accept-language"); 46 g_multivalued_headers.insert("accept-language");
50 g_multivalued_headers.insert("accept-ranges"); 47 g_multivalued_headers.insert("accept-ranges");
51 g_multivalued_headers.insert("allow"); 48 g_multivalued_headers.insert("allow");
52 g_multivalued_headers.insert("cache-control"); 49 g_multivalued_headers.insert("cache-control");
53 g_multivalued_headers.insert("connection"); 50 g_multivalued_headers.insert("connection");
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 966
970 void BalsaHeaders::SetResponseReasonPhrase(const base::StringPiece& reason) { 967 void BalsaHeaders::SetResponseReasonPhrase(const base::StringPiece& reason) {
971 // Note: There is no difference between request_version() and 968 // Note: There is no difference between request_version() and
972 // response_reason_phrase(). Thus, a function to set one is equivalent to a 969 // response_reason_phrase(). Thus, a function to set one is equivalent to a
973 // function to set the other. We maintain two functions for this as it is 970 // function to set the other. We maintain two functions for this as it is
974 // much more descriptive, and makes code more understandable. 971 // much more descriptive, and makes code more understandable.
975 SetRequestVersion(reason); 972 SetRequestVersion(reason);
976 } 973 }
977 974
978 } // namespace net 975 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/write_blocked_list.h ('k') | net/tools/balsa/string_piece_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698