Skip to content

Commit

Permalink
Uninline GURL's comparison operators.
Browse files Browse the repository at this point in the history
This reduces binary size by ~70KB on a linux64 release build.

BUG=none

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

Cr-Commit-Position: refs/heads/master@{#307170}
  • Loading branch information
zetafunction authored and Commit bot committed Dec 6, 2014
1 parent 0027a48 commit 3a08877
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
16 changes: 16 additions & 0 deletions url/gurl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,22 @@ const std::string& GURL::spec() const {
return EmptyStringForGURL();
}

bool GURL::operator==(const GURL& other) const {
return spec_ == other.spec_;
}

bool GURL::operator!=(const GURL& other) const {
return spec_ != other.spec_;
}

bool GURL::operator<(const GURL& other) const {
return spec_ < other.spec_;
}

bool GURL::operator>(const GURL& other) const {
return spec_ > other.spec_;
}

GURL GURL::Resolve(const std::string& relative) const {
return ResolveWithCharsetConverter(relative, NULL);
}
Expand Down
16 changes: 4 additions & 12 deletions url/gurl.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,12 @@ class URL_EXPORT GURL {
}

// Defiant equality operator!
bool operator==(const GURL& other) const {
return spec_ == other.spec_;
}
bool operator!=(const GURL& other) const {
return spec_ != other.spec_;
}
bool operator==(const GURL& other) const;
bool operator!=(const GURL& other) const;

// Allows GURL to used as a key in STL (for example, a std::set or std::map).
bool operator<(const GURL& other) const {
return spec_ < other.spec_;
}
bool operator>(const GURL& other) const {
return spec_ > other.spec_;
}
bool operator<(const GURL& other) const;
bool operator>(const GURL& other) const;

// Resolves a URL that's possibly relative to this object's URL, and returns
// it. Absolute URLs are also handled according to the rules of URLs on web
Expand Down

0 comments on commit 3a08877

Please sign in to comment.