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

Side by Side Diff: net/base/net_util.cc

Issue 9614004: Avoid loading ws2_32.dll just to get htons() and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make patch 4.7% uglier with helpful TODOs. Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « crypto/p224.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/base/net_util.h" 5 #include "net/base/net_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 10
(...skipping 30 matching lines...) Expand all
41 #include "base/path_service.h" 41 #include "base/path_service.h"
42 #include "base/stl_util.h" 42 #include "base/stl_util.h"
43 #include "base/string_number_conversions.h" 43 #include "base/string_number_conversions.h"
44 #include "base/string_piece.h" 44 #include "base/string_piece.h"
45 #include "base/string_split.h" 45 #include "base/string_split.h"
46 #include "base/string_tokenizer.h" 46 #include "base/string_tokenizer.h"
47 #include "base/string_util.h" 47 #include "base/string_util.h"
48 #include "base/stringprintf.h" 48 #include "base/stringprintf.h"
49 #include "base/synchronization/lock.h" 49 #include "base/synchronization/lock.h"
50 #include "base/sys_string_conversions.h" 50 #include "base/sys_string_conversions.h"
51 #include "base/sys_byteorder.h"
51 #include "base/time.h" 52 #include "base/time.h"
52 #include "base/utf_offset_string_conversions.h" 53 #include "base/utf_offset_string_conversions.h"
53 #include "base/utf_string_conversions.h" 54 #include "base/utf_string_conversions.h"
54 #include "googleurl/src/gurl.h" 55 #include "googleurl/src/gurl.h"
55 #include "googleurl/src/url_canon.h" 56 #include "googleurl/src/url_canon.h"
56 #include "googleurl/src/url_canon_ip.h" 57 #include "googleurl/src/url_canon_ip.h"
57 #include "googleurl/src/url_parse.h" 58 #include "googleurl/src/url_parse.h"
58 #include "grit/net_resources.h" 59 #include "grit/net_resources.h"
59 #include "net/base/dns_util.h" 60 #include "net/base/dns_util.h"
60 #include "net/base/escape.h" 61 #include "net/base/escape.h"
61 #include "net/base/mime_util.h" 62 #include "net/base/mime_util.h"
62 #include "net/base/net_module.h" 63 #include "net/base/net_module.h"
63 #if defined(OS_WIN) 64 #if defined(OS_WIN)
64 #include "net/base/winsock_init.h" 65 #include "net/base/winsock_init.h"
65 #endif 66 #endif
66 #include "net/http/http_content_disposition.h" 67 #include "net/http/http_content_disposition.h"
67 #include "unicode/datefmt.h" 68 #include "unicode/datefmt.h"
68 #include "unicode/regex.h" 69 #include "unicode/regex.h"
69 #include "unicode/ucnv.h" 70 #include "unicode/ucnv.h"
70 #include "unicode/uidna.h" 71 #include "unicode/uidna.h"
71 #include "unicode/ulocdata.h" 72 #include "unicode/ulocdata.h"
72 #include "unicode/uniset.h" 73 #include "unicode/uniset.h"
73 #include "unicode/uscript.h" 74 #include "unicode/uscript.h"
74 #include "unicode/uset.h" 75 #include "unicode/uset.h"
75 76
76 using base::Time; 77 using base::Time;
77 78
79 #if defined(OS_WIN)
80 // Allow htons/ntohs to be called without requiring ws2_32.dll to be loaded,
81 // which isn't available in Chrome's sandbox. See crbug.com/116591.
82 // TODO(wez): Replace these calls with base::htons() etc when available.
83 #define ntohs(x) _byteswap_ushort(x)
84 #define htons(x) _byteswap_ushort(x)
85 #endif // OS_WIN
86
78 namespace net { 87 namespace net {
79 88
80 namespace { 89 namespace {
81 90
82 // what we prepend to get a file URL 91 // what we prepend to get a file URL
83 static const FilePath::CharType kFileURLPrefix[] = 92 static const FilePath::CharType kFileURLPrefix[] =
84 FILE_PATH_LITERAL("file:///"); 93 FILE_PATH_LITERAL("file:///");
85 94
86 // The general list of blocked ports. Will be blocked unless a specific 95 // The general list of blocked ports. Will be blocked unless a specific
87 // protocol overrides it. (Ex: ftp can use ports 20 and 21) 96 // protocol overrides it. (Ex: ftp can use ports 20 and 21)
(...skipping 2315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2403 2412
2404 NetworkInterface::NetworkInterface(const std::string& name, 2413 NetworkInterface::NetworkInterface(const std::string& name,
2405 const IPAddressNumber& address) 2414 const IPAddressNumber& address)
2406 : name(name), address(address) { 2415 : name(name), address(address) {
2407 } 2416 }
2408 2417
2409 NetworkInterface::~NetworkInterface() { 2418 NetworkInterface::~NetworkInterface() {
2410 } 2419 }
2411 2420
2412 } // namespace net 2421 } // namespace net
OLDNEW
« no previous file with comments | « crypto/p224.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698