Commit ae552245 authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

Make StdStringCanonOutput non copyable and don't copy it

In some build experiments, the compiler emitted an object assignment
of StdStringCanonOutput which did not link because the operator=
was not exported from the url.dll in component builds.

This makes the class  explicitly not copyable and removes
the copy to avoid that kind of (hard to debug) problems.

Change-Id: I92988b5799e4229d1fb0379f9897727c1bac20de
Reviewed-on: https://chromium-review.googlesource.com/c/1477602Reviewed-by: default avatarMike West <mkwst@chromium.org>
Reviewed-by: default avatarRyan Hamilton <rch@chromium.org>
Commit-Queue: Ryan Hamilton <rch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634383}
parent 1945cff5
...@@ -255,12 +255,12 @@ QuicString SpdyUtils::GetPushPromiseUrl(QuicStringPiece scheme, ...@@ -255,12 +255,12 @@ QuicString SpdyUtils::GetPushPromiseUrl(QuicStringPiece scheme,
// Validate the scheme; this is to ensure a scheme of "foo://bar" is not // Validate the scheme; this is to ensure a scheme of "foo://bar" is not
// parsed as a URL of "foo://bar://baz" when combined with a host of "baz". // parsed as a URL of "foo://bar://baz" when combined with a host of "baz".
std::string canonical_scheme; std::string canonical_scheme;
url::StdStringCanonOutput canon_output(&canonical_scheme); url::StdStringCanonOutput canon_scheme_output(&canonical_scheme);
url::Component canon_component; url::Component canon_component;
url::Component scheme_component(0, scheme.size()); url::Component scheme_component(0, scheme.size());
if (!url::CanonicalizeScheme(scheme.data(), scheme_component, &canon_output, if (!url::CanonicalizeScheme(scheme.data(), scheme_component,
&canon_component) || &canon_scheme_output, &canon_component) ||
!canon_component.is_nonempty() || canon_component.begin != 0) { !canon_component.is_nonempty() || canon_component.begin != 0) {
return QuicString(); return QuicString();
} }
...@@ -304,13 +304,13 @@ QuicString SpdyUtils::GetPushPromiseUrl(QuicStringPiece scheme, ...@@ -304,13 +304,13 @@ QuicString SpdyUtils::GetPushPromiseUrl(QuicStringPiece scheme,
} }
} }
// Validate the host by attempting to canoncalize it. Invalid characters // Validate the host by attempting to canonicalize it. Invalid characters
// will result in a canonicalization failure (e.g. '/') // will result in a canonicalization failure (e.g. '/')
std::string canon_host; std::string canon_host;
canon_output = url::StdStringCanonOutput(&canon_host); url::StdStringCanonOutput canon_host_output(&canon_host);
canon_component.reset(); canon_component.reset();
if (!url::CanonicalizeHost(authority.data(), host_component, &canon_output, if (!url::CanonicalizeHost(authority.data(), host_component,
&canon_component) || &canon_host_output, &canon_component) ||
!canon_component.is_nonempty() || canon_component.begin != 0) { !canon_component.is_nonempty() || canon_component.begin != 0) {
return QuicString(); return QuicString();
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/component_export.h" #include "base/component_export.h"
#include "base/macros.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "url/url_canon.h" #include "url/url_canon.h"
...@@ -45,6 +46,7 @@ class COMPONENT_EXPORT(URL) StdStringCanonOutput : public CanonOutput { ...@@ -45,6 +46,7 @@ class COMPONENT_EXPORT(URL) StdStringCanonOutput : public CanonOutput {
protected: protected:
std::string* str_; std::string* str_;
DISALLOW_COPY_AND_ASSIGN(StdStringCanonOutput);
}; };
// An extension of the Replacements class that allows the setters to use // An extension of the Replacements class that allows the setters to use
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment