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

Unified Diff: sdk/lib/io/http_headers.dart

Issue 80883002: Avoid unneeded toLowerCase and add fast version of _isTokenChar, in HTTP parser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More cleanup. Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http_headers.dart
diff --git a/sdk/lib/io/http_headers.dart b/sdk/lib/io/http_headers.dart
index 62e940c2ffcb18ca9932baf885f6bcc291db21e8..cff9d37fb2f6afbfb57c27f3fe9373106ba8fca5 100644
--- a/sdk/lib/io/http_headers.dart
+++ b/sdk/lib/io/http_headers.dart
@@ -41,21 +41,24 @@ class _HttpHeaders implements HttpHeaders {
void add(String name, value) {
_checkMutable();
- var lowerCaseName = name.toLowerCase();
+ _addAll(name.toLowerCase(), value);
+ }
+
+ void _addAll(String name, value) {
if (value is List) {
for (int i = 0; i < value.length; i++) {
- _add(lowerCaseName, value[i]);
+ _add(name, value[i]);
}
} else {
- _add(lowerCaseName, value);
+ _add(name, value);
}
}
void set(String name, Object value) {
- name = name.toLowerCase();
_checkMutable();
- removeAll(name);
- add(name, value);
+ name = name.toLowerCase();
+ _headers.remove(name);
+ _addAll(name, value);
}
void remove(String name, Object value) {
@@ -342,7 +345,7 @@ class _HttpHeaders implements HttpHeaders {
}
void _set(String name, String value) {
- name = name.toLowerCase();
+ assert(name == name.toLowerCase());
List<String> values = new List<String>();
_headers[name] = values;
values.add(value);
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698