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

Side by Side Diff: content/common/content_param_traits.cc

Issue 825353003: Revert of Remove deprecated methods from Pickle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « content/common/common_param_traits_unittest.cc ('k') | content/common/font_config_ipc_linux.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/common/content_param_traits.h" 5 #include "content/common/content_param_traits.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "content/common/input/web_input_event_traits.h" 8 #include "content/common/input/web_input_event_traits.h"
9 #include "net/base/ip_endpoint.h" 9 #include "net/base/ip_endpoint.h"
10 #include "ui/gfx/range/range.h" 10 #include "ui/gfx/range/range.h"
11 11
12 namespace IPC { 12 namespace IPC {
13 13
14 void ParamTraits<gfx::Range>::Write(Message* m, const gfx::Range& r) { 14 void ParamTraits<gfx::Range>::Write(Message* m, const gfx::Range& r) {
15 m->WriteSizeT(r.start()); 15 m->WriteSizeT(r.start());
16 m->WriteSizeT(r.end()); 16 m->WriteSizeT(r.end());
17 } 17 }
18 18
19 bool ParamTraits<gfx::Range>::Read(const Message* m, 19 bool ParamTraits<gfx::Range>::Read(const Message* m,
20 PickleIterator* iter, 20 PickleIterator* iter,
21 gfx::Range* r) { 21 gfx::Range* r) {
22 size_t start, end; 22 size_t start, end;
23 if (!iter->ReadSizeT(&start) || !iter->ReadSizeT(&end)) 23 if (!m->ReadSizeT(iter, &start) || !m->ReadSizeT(iter, &end))
24 return false; 24 return false;
25 r->set_start(start); 25 r->set_start(start);
26 r->set_end(end); 26 r->set_end(end);
27 return true; 27 return true;
28 } 28 }
29 29
30 void ParamTraits<gfx::Range>::Log(const gfx::Range& r, std::string* l) { 30 void ParamTraits<gfx::Range>::Log(const gfx::Range& r, std::string* l) {
31 l->append(base::StringPrintf("(%" PRIuS ", %" PRIuS ")", r.start(), r.end())); 31 l->append(base::StringPrintf("(%" PRIuS ", %" PRIuS ")", r.start(), r.end()));
32 } 32 }
33 33
34 void ParamTraits<WebInputEventPointer>::Write(Message* m, const param_type& p) { 34 void ParamTraits<WebInputEventPointer>::Write(Message* m, const param_type& p) {
35 m->WriteData(reinterpret_cast<const char*>(p), p->size); 35 m->WriteData(reinterpret_cast<const char*>(p), p->size);
36 } 36 }
37 37
38 bool ParamTraits<WebInputEventPointer>::Read(const Message* m, 38 bool ParamTraits<WebInputEventPointer>::Read(const Message* m,
39 PickleIterator* iter, 39 PickleIterator* iter,
40 param_type* r) { 40 param_type* r) {
41 const char* data; 41 const char* data;
42 int data_length; 42 int data_length;
43 if (!iter->ReadData(&data, &data_length)) { 43 if (!m->ReadData(iter, &data, &data_length)) {
44 NOTREACHED(); 44 NOTREACHED();
45 return false; 45 return false;
46 } 46 }
47 if (data_length < static_cast<int>(sizeof(blink::WebInputEvent))) { 47 if (data_length < static_cast<int>(sizeof(blink::WebInputEvent))) {
48 NOTREACHED(); 48 NOTREACHED();
49 return false; 49 return false;
50 } 50 }
51 param_type event = reinterpret_cast<param_type>(data); 51 param_type event = reinterpret_cast<param_type>(data);
52 // Check that the data size matches that of the event. 52 // Check that the data size matches that of the event.
53 if (data_length != static_cast<int>(event->size)) { 53 if (data_length != static_cast<int>(event->size)) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_ 90 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_
91 #include "content/common/content_param_traits_macros.h" 91 #include "content/common/content_param_traits_macros.h"
92 } // namespace IPC 92 } // namespace IPC
93 93
94 // Generate param traits log methods. 94 // Generate param traits log methods.
95 #include "ipc/param_traits_log_macros.h" 95 #include "ipc/param_traits_log_macros.h"
96 namespace IPC { 96 namespace IPC {
97 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_ 97 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_
98 #include "content/common/content_param_traits_macros.h" 98 #include "content/common/content_param_traits_macros.h"
99 } // namespace IPC 99 } // namespace IPC
OLDNEW
« no previous file with comments | « content/common/common_param_traits_unittest.cc ('k') | content/common/font_config_ipc_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698