Skip to content

Commit

Permalink
Revert 203025 "Make the copy of GURL in src/url buildable as a c..."
Browse files Browse the repository at this point in the history
> Make the copy of GURL in src/url buildable as a component build. (try 2)
> 
> BUG=229660
> TBR=brettw
> 
> Review URL: https://chromiumcodereview.appspot.com/15805003

TBR=thestig@chromium.org

Review URL: https://codereview.chromium.org/15848009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203027 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
thestig@chromium.org committed May 30, 2013
1 parent 15b05a7 commit 7394c6d
Show file tree
Hide file tree
Showing 9 changed files with 391 additions and 440 deletions.
11 changes: 6 additions & 5 deletions url/gurl.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
#include "base/string16.h"
#include "url/url_canon.h"
#include "url/url_canon_stdstring.h"
#include "url/url_export.h"
#include "url/url_parse.h"

class URL_EXPORT GURL {
class GURL {
public:
typedef url_canon::StdStringReplacements<std::string> Replacements;
typedef url_canon::StdStringReplacements<string16> ReplacementsW;
Expand All @@ -33,8 +32,10 @@ class URL_EXPORT GURL {
// encode the query parameters. It is probably sufficient for the narrow
// version to assume the query parameter encoding should be the same as the
// input encoding.
explicit GURL(const std::string& url_string /*, output_param_encoding*/);
explicit GURL(const string16& url_string /*, output_param_encoding*/);
explicit GURL(const std::string& url_string
/*, output_param_encoding*/);
explicit GURL(const string16& url_string
/*, output_param_encoding*/);

// Constructor for URLs that have already been parsed and canonicalized. This
// is used for conversions from KURL, for example. The caller must supply all
Expand Down Expand Up @@ -360,6 +361,6 @@ class URL_EXPORT GURL {
};

// Stream operator so GURL can be used in assertion statements.
URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url);
std::ostream& operator<<(std::ostream& out, const GURL& url);

#endif // URL_GURL_H_
14 changes: 7 additions & 7 deletions url/url.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
},
'targets': [
{
# Note, this target_name cannot be 'url', because that will generate
# 'url.dll' for a Windows component build, and that will confuse Windows,
# which has a system DLL with the same name.
'target_name': 'url_lib',
'type': '<(component)',
'target_name': 'url',
'type': 'static_library',
'dependencies': [
'../base/base.gyp:base',
'../third_party/icu/icu.gyp:icudata',
Expand Down Expand Up @@ -55,7 +52,7 @@
],
},
'defines': [
'URL_IMPLEMENTATION',
'FULL_FILESYSTEM_URL_SUPPORT=1',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
Expand All @@ -68,7 +65,7 @@
'../base/base.gyp:run_all_unittests',
'../testing/gtest.gyp:gtest',
'../third_party/icu/icu.gyp:icuuc',
'url_lib',
'url',
],
'sources': [
'gurl_unittest.cc',
Expand All @@ -77,6 +74,9 @@
'url_test_utils.h',
'url_util_unittest.cc',
],
'defines': [
'FULL_FILESYSTEM_URL_SUPPORT=1',
],
'conditions': [
['os_posix==1 and OS!="mac" and OS!="ios"',
{
Expand Down
487 changes: 241 additions & 246 deletions url/url_canon.h

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions url/url_canon_icu.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
// ICU integration functions.

#include "url/url_canon.h"
#include "url/url_export.h"

typedef struct UConverter UConverter;

namespace url_canon {

// An implementation of CharsetConverter that implementations can use to
// interface the canonicalizer with ICU's conversion routines.
class URL_EXPORT ICUCharsetConverter : public CharsetConverter {
class ICUCharsetConverter : public CharsetConverter {
public:
// Constructs a converter using an already-existing ICU character set
// converter. This converter is NOT owned by this object; the lifetime must
Expand Down
25 changes: 12 additions & 13 deletions url/url_canon_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void AppendStringOfType(const char16* source, int length,

// Maps the hex numerical values 0x0 to 0xf to the corresponding ASCII digit
// that will be used to represent it.
URL_EXPORT extern const char kHexCharLookup[0x10];
extern const char kHexCharLookup[0x10];

// This lookup table allows fast conversion between ASCII hex letters and their
// corresponding numerical value. The 8-bit range is divided up into 8
Expand Down Expand Up @@ -150,8 +150,8 @@ extern const char16 kUnicodeReplacementCharacter;
// (for a single-byte ASCII character, it will not be changed).
//
// Implementation is in url_canon_icu.cc.
URL_EXPORT bool ReadUTFChar(const char* str, int* begin, int length,
unsigned* code_point_out);
bool ReadUTFChar(const char* str, int* begin, int length,
unsigned* code_point_out);

// Generic To-UTF-8 converter. This will call the given append method for each
// character that should be appended, with the given output method. Wrappers
Expand Down Expand Up @@ -227,8 +227,8 @@ inline void AppendUTF8EscapedValue(unsigned char_value, CanonOutput* output) {
// (for a single-16-bit-word character, it will not be changed).
//
// Implementation is in url_canon_icu.cc.
URL_EXPORT bool ReadUTFChar(const char16* str, int* begin, int length,
unsigned* code_point);
bool ReadUTFChar(const char16* str, int* begin, int length,
unsigned* code_point);

// Equivalent to U16_APPEND_UNSAFE in ICU but uses our output method.
inline void AppendUTF16Value(unsigned code_point,
Expand Down Expand Up @@ -346,10 +346,10 @@ void AppendInvalidNarrowString(const char16* spec, int begin, int end,
// replacing the invalid characters with the "invalid character". It will
// return false in the failure case, and the caller should not continue as
// normal.
URL_EXPORT bool ConvertUTF16ToUTF8(const char16* input, int input_len,
CanonOutput* output);
URL_EXPORT bool ConvertUTF8ToUTF16(const char* input, int input_len,
CanonOutputT<char16>* output);
bool ConvertUTF16ToUTF8(const char16* input, int input_len,
CanonOutput* output);
bool ConvertUTF8ToUTF16(const char* input, int input_len,
CanonOutputT<char16>* output);

// Converts from UTF-16 to 8-bit using the character set converter. If the
// converter is NULL, this will use UTF-8.
Expand Down Expand Up @@ -408,10 +408,9 @@ bool CanonicalizePartialPath(const char16* spec,
#ifndef WIN32

// Implementations of Windows' int-to-string conversions
URL_EXPORT int _itoa_s(int value, char* buffer, size_t size_in_chars,
int radix);
URL_EXPORT int _itow_s(int value, char16* buffer, size_t size_in_chars,
int radix);
int _itoa_s(int value, char* buffer, size_t size_in_chars, int radix);
int _itow_s(int value, char16* buffer, size_t size_in_chars,
int radix);

// Secure template overloads for these functions
template<size_t N>
Expand Down
37 changes: 18 additions & 19 deletions url/url_canon_ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@

#include "base/string16.h"
#include "url/url_canon.h"
#include "url/url_export.h"
#include "url/url_parse.h"

namespace url_canon {

// Writes the given IPv4 address to |output|.
URL_EXPORT void AppendIPv4Address(const unsigned char address[4],
CanonOutput* output);
void AppendIPv4Address(const unsigned char address[4],
CanonOutput* output);

// Writes the given IPv6 address to |output|.
URL_EXPORT void AppendIPv6Address(const unsigned char address[16],
CanonOutput* output);
void AppendIPv6Address(const unsigned char address[16],
CanonOutput* output);

// Searches the host name for the portions of the IPv4 address. On success,
// each component will be placed into |components| and it will return true.
Expand All @@ -38,12 +37,12 @@ URL_EXPORT void AppendIPv6Address(const unsigned char address[16],
// Mozilla), so this code path never gets hit. Our host canonicalization will
// notice these spaces and escape them, which will make IP address finding
// fail. This seems like better behavior than stripping after a space.
URL_EXPORT bool FindIPv4Components(const char* spec,
const url_parse::Component& host,
url_parse::Component components[4]);
URL_EXPORT bool FindIPv4Components(const char16* spec,
const url_parse::Component& host,
url_parse::Component components[4]);
bool FindIPv4Components(const char* spec,
const url_parse::Component& host,
url_parse::Component components[4]);
bool FindIPv4Components(const char16* spec,
const url_parse::Component& host,
url_parse::Component components[4]);

// Converts an IPv4 address to a 32-bit number (network byte order).
//
Expand All @@ -56,12 +55,12 @@ URL_EXPORT bool FindIPv4Components(const char16* spec,
//
// On success, |num_ipv4_components| will be populated with the number of
// components in the IPv4 address.
URL_EXPORT CanonHostInfo::Family IPv4AddressToNumber(
CanonHostInfo::Family IPv4AddressToNumber(
const char* spec,
const url_parse::Component& host,
unsigned char address[4],
int* num_ipv4_components);
URL_EXPORT CanonHostInfo::Family IPv4AddressToNumber(
CanonHostInfo::Family IPv4AddressToNumber(
const char16* spec,
const url_parse::Component& host,
unsigned char address[4],
Expand All @@ -72,12 +71,12 @@ URL_EXPORT CanonHostInfo::Family IPv4AddressToNumber(
//
// NOTE that |host| is expected to be surrounded by square brackets.
// i.e. "[::1]" rather than "::1".
URL_EXPORT bool IPv6AddressToNumber(const char* spec,
const url_parse::Component& host,
unsigned char address[16]);
URL_EXPORT bool IPv6AddressToNumber(const char16* spec,
const url_parse::Component& host,
unsigned char address[16]);
bool IPv6AddressToNumber(const char* spec,
const url_parse::Component& host,
unsigned char address[16]);
bool IPv6AddressToNumber(const char16* spec,
const url_parse::Component& host,
unsigned char address[16]);

} // namespace url_canon

Expand Down
33 changes: 0 additions & 33 deletions url/url_export.h

This file was deleted.

Loading

0 comments on commit 7394c6d

Please sign in to comment.