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

Unified Diff: chrome/common/safe_browsing/protobuf_message_param_traits.h

Issue 2968003005: Support Serializing and Deserializing RepeatedField / RepeatedPtrField in IPC::Message (Closed)
Patch Set: Resolve review comments 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/safe_browsing/protobuf_message_param_traits.h
diff --git a/chrome/common/safe_browsing/protobuf_message_param_traits.h b/chrome/common/safe_browsing/protobuf_message_param_traits.h
deleted file mode 100644
index 76613ce30d22f2660ec729b89ec9a4cc57e76814..0000000000000000000000000000000000000000
--- a/chrome/common/safe_browsing/protobuf_message_param_traits.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_COMMON_SAFE_BROWSING_PROTOBUF_MESSAGE_PARAM_TRAITS_H_
-#define CHROME_COMMON_SAFE_BROWSING_PROTOBUF_MESSAGE_PARAM_TRAITS_H_
-
-#include <limits.h>
-
-#include <string>
-
-#include "base/pickle.h"
-#include "ipc/ipc_message.h"
-#include "ipc/ipc_param_traits.h"
-#include "third_party/protobuf/src/google/protobuf/repeated_field.h"
-
-namespace IPC {
-
-template <class Element>
-struct ParamTraits<google::protobuf::RepeatedPtrField<Element>> {
- typedef google::protobuf::RepeatedPtrField<Element> param_type;
-
- static void GetSize(base::PickleSizer* s, const param_type& p) {
- GetParamSize(s, p.size());
- for (const auto& element : p)
- GetParamSize(s, element);
- }
-
- static void Write(base::Pickle* m, const param_type& p) {
- WriteParam(m, p.size());
- for (const auto& element : p)
- WriteParam(m, element);
- }
-
- static bool Read(const base::Pickle* m,
- base::PickleIterator* iter,
- param_type* p) {
- int size;
- if (!iter->ReadLength(&size) || size < 0)
- return false;
- if (INT_MAX / static_cast<int>(sizeof(void*)) <= size)
- return false;
- p->Clear();
- p->Reserve(size);
- while (size--) {
- if (!ReadParam(m, iter, p->Add()))
- return false;
- }
- return true;
- }
-
- static void Log(const param_type& p, std::string* l) {
- bool logged_first = false;
- for (const auto& element : p) {
- if (logged_first)
- l->push_back(' ');
- else
- logged_first = true;
- LogParam(element, l);
- }
- }
-};
-
-} // namespace IPC
-
-#endif // CHROME_COMMON_SAFE_BROWSING_PROTOBUF_MESSAGE_PARAM_TRAITS_H_

Powered by Google App Engine
This is Rietveld 408576698