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

Side by Side Diff: content/common/gamepad_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, 12 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/font_config_ipc_linux.cc ('k') | content/common/media/media_param_traits.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/gamepad_param_traits.h" 5 #include "content/common/gamepad_param_traits.h"
6 6
7 #include "base/pickle.h" 7 #include "base/pickle.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "ipc/ipc_message_utils.h" 10 #include "ipc/ipc_message_utils.h"
(...skipping 24 matching lines...) Expand all
35 const WebGamepad& p) { 35 const WebGamepad& p) {
36 m->WriteData(reinterpret_cast<const char*>(&p), sizeof(WebGamepad)); 36 m->WriteData(reinterpret_cast<const char*>(&p), sizeof(WebGamepad));
37 } 37 }
38 38
39 bool ParamTraits<WebGamepad>::Read( 39 bool ParamTraits<WebGamepad>::Read(
40 const Message* m, 40 const Message* m,
41 PickleIterator* iter, 41 PickleIterator* iter,
42 WebGamepad* p) { 42 WebGamepad* p) {
43 int length; 43 int length;
44 const char* data; 44 const char* data;
45 if (!iter->ReadData(&data, &length) || length != sizeof(WebGamepad)) 45 if (!m->ReadData(iter, &data, &length) || length != sizeof(WebGamepad))
46 return false; 46 return false;
47 memcpy(p, data, sizeof(WebGamepad)); 47 memcpy(p, data, sizeof(WebGamepad));
48 48
49 return true; 49 return true;
50 } 50 }
51 51
52 void ParamTraits<WebGamepad>::Log( 52 void ParamTraits<WebGamepad>::Log(
53 const WebGamepad& p, 53 const WebGamepad& p,
54 std::string* l) { 54 std::string* l) {
55 l->append("WebGamepad("); 55 l->append("WebGamepad(");
(...skipping 14 matching lines...) Expand all
70 l->append(", ["); 70 l->append(", [");
71 for (size_t i = 0; i < arraysize(p.buttons); ++i) { 71 for (size_t i = 0; i < arraysize(p.buttons); ++i) {
72 l->append(base::StringPrintf("(%u, %f)%s", 72 l->append(base::StringPrintf("(%u, %f)%s",
73 p.buttons[i].pressed, p.buttons[i].value, 73 p.buttons[i].pressed, p.buttons[i].value,
74 i < (arraysize(p.buttons) - 1) ? ", " : "], ")); 74 i < (arraysize(p.buttons) - 1) ? ", " : "], "));
75 } 75 }
76 l->append(")"); 76 l->append(")");
77 } 77 }
78 78
79 } // namespace IPC 79 } // namespace IPC
OLDNEW
« no previous file with comments | « content/common/font_config_ipc_linux.cc ('k') | content/common/media/media_param_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698