| Index: content/common/resource_messages.cc
|
| diff --git a/content/common/resource_messages.cc b/content/common/resource_messages.cc
|
| index 31330a7e2080c3b3be15f73fb19970becba02885..a62985f376fff7557d6d30a539f7d33b35ea07b2 100644
|
| --- a/content/common/resource_messages.cc
|
| +++ b/content/common/resource_messages.cc
|
| @@ -480,4 +480,69 @@ void ParamTraits<scoped_refptr<net::ct::SignedCertificateTimestamp>>::Log(
|
| l->append("<SignedCertificateTimestamp>");
|
| }
|
|
|
| +void ParamTraits<scoped_refptr<url::NullableOrigin>>::GetSize(
|
| + base::PickleSizer* s,
|
| + const param_type& p) {
|
| + GetParamSize(s, p.get() != NULL);
|
| + if (p.get()) {
|
| + GetParamSize(s, p->unique());
|
| + GetParamSize(s, p->scheme());
|
| + GetParamSize(s, p->host());
|
| + GetParamSize(s, p->port());
|
| + }
|
| +}
|
| +
|
| +void ParamTraits<scoped_refptr<url::NullableOrigin>>::Write(
|
| + base::Pickle* m,
|
| + const param_type& p) {
|
| + WriteParam(m, p.get() != NULL);
|
| + if (p.get()) {
|
| + WriteParam(m, p->unique());
|
| + WriteParam(m, p->scheme());
|
| + WriteParam(m, p->host());
|
| + WriteParam(m, p->port());
|
| + }
|
| +}
|
| +
|
| +bool ParamTraits<scoped_refptr<url::NullableOrigin>>::Read(
|
| + const base::Pickle* m,
|
| + base::PickleIterator* iter,
|
| + param_type* r) {
|
| + bool has_object;
|
| + if (!ReadParam(m, iter, &has_object))
|
| + return false;
|
| +
|
| + if (!has_object)
|
| + return true;
|
| +
|
| + bool unique;
|
| + std::string scheme;
|
| + std::string host;
|
| + uint16_t port;
|
| + if (!ReadParam(m, iter, &unique) || !ReadParam(m, iter, &scheme) ||
|
| + !ReadParam(m, iter, &host) || !ReadParam(m, iter, &port)) {
|
| + return false;
|
| + }
|
| +
|
| + *r = unique ? new url::NullableOrigin(url::Origin())
|
| + : new url::NullableOrigin(
|
| + url::Origin::UnsafelyCreateOriginWithoutNormalization(
|
| + scheme, host, port));
|
| +
|
| + // If a unique origin was created, but the unique flag wasn't set, then
|
| + // the values provided to 'UnsafelyCreateOriginWithoutNormalization' were
|
| + // invalid; kill the renderer.
|
| + if (!unique && (*r)->unique())
|
| + return false;
|
| +
|
| + return true;
|
| +}
|
| +
|
| +void ParamTraits<scoped_refptr<url::NullableOrigin>>::Log(const param_type& p,
|
| + std::string* l) {
|
| + l->append("<NullableOrigin>");
|
| + if (p.get())
|
| + l->append(p->Serialize());
|
| +}
|
| +
|
| } // namespace IPC
|
|
|