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

Side by Side Diff: url/ipc/url_param_traits.cc

Issue 1966983003: Generate param traits size methods for IPC files in content/ (and traits it depends on). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« ui/gfx/ipc/gfx_param_traits.cc ('K') | « url/ipc/url_param_traits.h ('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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 "url/ipc/url_param_traits.h" 5 #include "url/ipc/url_param_traits.h"
6 6
7 #include "url/gurl.h" 7 #include "url/gurl.h"
8 8
9 namespace IPC { 9 namespace IPC {
10 10
11 void ParamTraits<GURL>::GetSize(base::PickleSizer* s, const GURL& p) {
12 if (p.possibly_invalid_spec().length() > url::kMaxURLChars || !p.is_valid()) {
13 s->AddString(std::string());
14 return;
15 }
16
17 s->AddString(p.possibly_invalid_spec());
dcheng 2016/05/11 17:39:12 Ditto: maybe this should just be GetParamSize(s, p
jam 2016/05/11 17:57:02 Done.
18 }
19
11 void ParamTraits<GURL>::Write(base::Pickle* m, const GURL& p) { 20 void ParamTraits<GURL>::Write(base::Pickle* m, const GURL& p) {
12 if (p.possibly_invalid_spec().length() > url::kMaxURLChars) { 21 if (p.possibly_invalid_spec().length() > url::kMaxURLChars) {
13 m->WriteString(std::string()); 22 m->WriteString(std::string());
14 return; 23 return;
15 } 24 }
16 25
17 // Beware of print-parse inconsistency which would change an invalid 26 // Beware of print-parse inconsistency which would change an invalid
18 // URL into a valid one. Ideally, the message would contain this flag 27 // URL into a valid one. Ideally, the message would contain this flag
19 // so that the read side could make the check, but performing it here 28 // so that the read side could make the check, but performing it here
20 // avoids changing the on-the-wire representation of such a fundamental 29 // avoids changing the on-the-wire representation of such a fundamental
(...skipping 22 matching lines...) Expand all
43 return false; 52 return false;
44 } 53 }
45 return true; 54 return true;
46 } 55 }
47 56
48 void ParamTraits<GURL>::Log(const GURL& p, std::string* l) { 57 void ParamTraits<GURL>::Log(const GURL& p, std::string* l) {
49 l->append(p.spec()); 58 l->append(p.spec());
50 } 59 }
51 60
52 } // namespace IPC 61 } // namespace IPC
OLDNEW
« ui/gfx/ipc/gfx_param_traits.cc ('K') | « url/ipc/url_param_traits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698