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: Source/platform/network/HTTPHeaderMap.cpp

Issue 99733002: Update HTTPHeaderMap wrappers to use AtomicString type for header values (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 7 years 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 | « Source/platform/network/HTTPHeaderMap.h ('k') | Source/platform/network/HTTPParsers.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 (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 return data.release(); 56 return data.release();
57 } 57 }
58 58
59 void HTTPHeaderMap::adopt(PassOwnPtr<CrossThreadHTTPHeaderMapData> data) 59 void HTTPHeaderMap::adopt(PassOwnPtr<CrossThreadHTTPHeaderMapData> data)
60 { 60 {
61 clear(); 61 clear();
62 size_t dataSize = data->size(); 62 size_t dataSize = data->size();
63 for (size_t index = 0; index < dataSize; ++index) { 63 for (size_t index = 0; index < dataSize; ++index) {
64 pair<String, String>& header = (*data)[index]; 64 pair<String, String>& header = (*data)[index];
65 set(header.first, header.second); 65 set(AtomicString(header.first), AtomicString(header.second));
66 } 66 }
67 } 67 }
68 68
69 AtomicString HTTPHeaderMap::get(const AtomicString& name) const 69 AtomicString HTTPHeaderMap::get(const AtomicString& name) const
70 { 70 {
71 return HashMap<AtomicString, AtomicString, CaseFoldingHash>::get(name); 71 return HashMap<AtomicString, AtomicString, CaseFoldingHash>::get(name);
72 } 72 }
73 73
74 HTTPHeaderMap::AddResult HTTPHeaderMap::add(const AtomicString& name, const Atom icString& value) 74 HTTPHeaderMap::AddResult HTTPHeaderMap::add(const AtomicString& name, const Atom icString& value)
75 { 75 {
(...skipping 11 matching lines...) Expand all
87 { 87 {
88 return equalIgnoringCase(key, cString); 88 return equalIgnoringCase(key, cString);
89 } 89 }
90 90
91 static void translate(AtomicString& location, const char* cString, unsigned /*hash*/) 91 static void translate(AtomicString& location, const char* cString, unsigned /*hash*/)
92 { 92 {
93 location = AtomicString(cString); 93 location = AtomicString(cString);
94 } 94 }
95 }; 95 };
96 96
97 AtomicString HTTPHeaderMap::get(const char* name) const 97 const AtomicString& HTTPHeaderMap::get(const char* name) const
98 { 98 {
99 const_iterator i = find<CaseFoldingCStringTranslator>(name); 99 const_iterator i = find<CaseFoldingCStringTranslator>(name);
100 if (i == end()) 100 if (i == end())
101 return nullAtom; 101 return nullAtom;
102 return i->value; 102 return i->value;
103 } 103 }
104 104
105 bool HTTPHeaderMap::contains(const char* name) const 105 bool HTTPHeaderMap::contains(const char* name) const
106 { 106 {
107 return find<CaseFoldingCStringTranslator>(name) != end(); 107 return find<CaseFoldingCStringTranslator>(name) != end();
108 } 108 }
109 109
110 HTTPHeaderMap::AddResult HTTPHeaderMap::add(const char* name, const AtomicString & value) 110 HTTPHeaderMap::AddResult HTTPHeaderMap::add(const char* name, const AtomicString & value)
111 { 111 {
112 return HashMap<AtomicString, AtomicString, CaseFoldingHash>::add<CaseFolding CStringTranslator>(name, value); 112 return HashMap<AtomicString, AtomicString, CaseFoldingHash>::add<CaseFolding CStringTranslator>(name, value);
113 } 113 }
114 114
115 } // namespace WebCore 115 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/network/HTTPHeaderMap.h ('k') | Source/platform/network/HTTPParsers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698