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

Side by Side Diff: ipc/ipc_message_utils.h

Issue 1188923003: Stub in more IPC attachment brokering functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase properly. Created 5 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
« no previous file with comments | « ipc/ipc_message_start.h ('k') | ipc/ipc_message_utils.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 #ifndef IPC_IPC_MESSAGE_UTILS_H_ 5 #ifndef IPC_IPC_MESSAGE_UTILS_H_
6 #define IPC_IPC_MESSAGE_UTILS_H_ 6 #define IPC_IPC_MESSAGE_UTILS_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/containers/small_map.h" 14 #include "base/containers/small_map.h"
15 #include "base/files/file.h" 15 #include "base/files/file.h"
16 #include "base/format_macros.h" 16 #include "base/format_macros.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/scoped_vector.h" 18 #include "base/memory/scoped_vector.h"
19 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
20 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
21 #include "base/strings/stringprintf.h" 21 #include "base/strings/stringprintf.h"
22 #include "base/tuple.h" 22 #include "base/tuple.h"
23 #include "ipc/brokerable_attachment.h"
23 #include "ipc/ipc_message_start.h" 24 #include "ipc/ipc_message_start.h"
24 #include "ipc/ipc_param_traits.h" 25 #include "ipc/ipc_param_traits.h"
25 #include "ipc/ipc_sync_message.h" 26 #include "ipc/ipc_sync_message.h"
26 27
27 #if defined(COMPILER_GCC) 28 #if defined(COMPILER_GCC)
28 // GCC "helpfully" tries to inline template methods in release mode. Except we 29 // GCC "helpfully" tries to inline template methods in release mode. Except we
29 // want the majority of the template junk being expanded once in the 30 // want the majority of the template junk being expanded once in the
30 // implementation file (and only provide the definitions in 31 // implementation file (and only provide the definitions in
31 // ipc_message_utils_impl.h in those files) and exported, instead of expanded 32 // ipc_message_utils_impl.h in those files) and exported, instead of expanded
32 // at every call site. Special note: GCC happily accepts the attribute before 33 // at every call site. Special note: GCC happily accepts the attribute before
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 } 426 }
426 static void Log(const param_type& p, std::string* l) { 427 static void Log(const param_type& p, std::string* l) {
427 l->append("("); 428 l->append("(");
428 LogParam(p.first, l); 429 LogParam(p.first, l);
429 l->append(", "); 430 l->append(", ");
430 LogParam(p.second, l); 431 LogParam(p.second, l);
431 l->append(")"); 432 l->append(")");
432 } 433 }
433 }; 434 };
434 435
436 // IPC ParamTraits -------------------------------------------------------------
437 template <>
438 struct IPC_EXPORT ParamTraits<BrokerableAttachment::AttachmentId> {
439 typedef BrokerableAttachment::AttachmentId param_type;
440 static void Write(Message* m, const param_type& p);
441 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
442 static void Log(const param_type& p, std::string* l);
443 };
444
435 // Base ParamTraits ------------------------------------------------------------ 445 // Base ParamTraits ------------------------------------------------------------
436 446
437 template <> 447 template <>
438 struct IPC_EXPORT ParamTraits<base::DictionaryValue> { 448 struct IPC_EXPORT ParamTraits<base::DictionaryValue> {
439 typedef base::DictionaryValue param_type; 449 typedef base::DictionaryValue param_type;
440 static void Write(Message* m, const param_type& p); 450 static void Write(Message* m, const param_type& p);
441 static bool Read(const Message* m, 451 static bool Read(const Message* m,
442 base::PickleIterator* iter, 452 base::PickleIterator* iter,
443 param_type* r); 453 param_type* r);
444 static void Log(const param_type& p, std::string* l); 454 static void Log(const param_type& p, std::string* l);
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 template <typename... Ts> 1020 template <typename... Ts>
1011 static void WriteReplyParams(Message* reply, Ts... args) { 1021 static void WriteReplyParams(Message* reply, Ts... args) {
1012 ReplyParam p(args...); 1022 ReplyParam p(args...);
1013 WriteParam(reply, p); 1023 WriteParam(reply, p);
1014 } 1024 }
1015 }; 1025 };
1016 1026
1017 } // namespace IPC 1027 } // namespace IPC
1018 1028
1019 #endif // IPC_IPC_MESSAGE_UTILS_H_ 1029 #endif // IPC_IPC_MESSAGE_UTILS_H_
OLDNEW
« no previous file with comments | « ipc/ipc_message_start.h ('k') | ipc/ipc_message_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698