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

Side by Side Diff: ipc/ipc_message_utils.cc

Issue 2968003005: Support Serializing and Deserializing RepeatedField / RepeatedPtrField in IPC::Message (Closed)
Patch Set: Update IsPickleSizeSufficent to avoid GetSize Created 3 years, 5 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
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 "ipc/ipc_message_utils.h" 5 #include "ipc/ipc_message_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 WriteParam(m, static_cast<bool>(p[i])); 561 WriteParam(m, static_cast<bool>(p[i]));
562 } 562 }
563 563
564 bool ParamTraits<std::vector<bool>>::Read(const base::Pickle* m, 564 bool ParamTraits<std::vector<bool>>::Read(const base::Pickle* m,
565 base::PickleIterator* iter, 565 base::PickleIterator* iter,
566 param_type* r) { 566 param_type* r) {
567 int size; 567 int size;
568 // ReadLength() checks for < 0 itself. 568 // ReadLength() checks for < 0 itself.
569 if (!iter->ReadLength(&size)) 569 if (!iter->ReadLength(&size))
570 return false; 570 return false;
571 if (!IsPickleSizeSufficient<bool>(m, size))
572 return false;
571 r->resize(size); 573 r->resize(size);
572 for (int i = 0; i < size; i++) { 574 for (int i = 0; i < size; i++) {
573 bool value; 575 bool value;
574 if (!ReadParam(m, iter, &value)) 576 if (!ReadParam(m, iter, &value))
575 return false; 577 return false;
576 (*r)[i] = value; 578 (*r)[i] = value;
577 } 579 }
578 return true; 580 return true;
579 } 581 }
580 582
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 return result; 1310 return result;
1309 } 1311 }
1310 1312
1311 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { 1313 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) {
1312 l->append("<MSG>"); 1314 l->append("<MSG>");
1313 } 1315 }
1314 1316
1315 #endif // OS_WIN 1317 #endif // OS_WIN
1316 1318
1317 } // namespace IPC 1319 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698