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

Side by Side Diff: ppapi/proxy/ppapi_message_utils.h

Issue 1159553007: Move Tuple to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « ppapi/proxy/plugin_var_tracker_unittest.cc ('k') | ppapi/proxy/ppapi_proxy_test.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 PPAPI_PROXY_PPAPI_MESSAGE_UTILS_H_ 5 #ifndef PPAPI_PROXY_PPAPI_MESSAGE_UTILS_H_
6 #define PPAPI_PROXY_PPAPI_MESSAGE_UTILS_H_ 6 #define PPAPI_PROXY_PPAPI_MESSAGE_UTILS_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "base/tuple.h" 10 #include "base/tuple.h"
11 #include "ipc/ipc_message.h" 11 #include "ipc/ipc_message.h"
12 #include "ipc/ipc_message_utils.h" 12 #include "ipc/ipc_message_utils.h"
13 13
14 namespace ppapi { 14 namespace ppapi {
15 15
16 namespace internal { 16 namespace internal {
17 17
18 // TupleTypeMatch* check whether a tuple type contains elements of the specified 18 // TupleTypeMatch* check whether a tuple type contains elements of the specified
19 // types. They are used to make sure the output parameters of UnpackMessage() 19 // types. They are used to make sure the output parameters of UnpackMessage()
20 // match the corresponding message type. 20 // match the corresponding message type.
21 template <class TupleType, class A> 21 template <class TupleType, class A>
22 struct TupleTypeMatch1 { 22 struct TupleTypeMatch1 {
23 static const bool kValue = false; 23 static const bool kValue = false;
24 }; 24 };
25 template <class A> 25 template <class A>
26 struct TupleTypeMatch1<Tuple<A>, A> { 26 struct TupleTypeMatch1<base::Tuple<A>, A> {
27 static const bool kValue = true; 27 static const bool kValue = true;
28 }; 28 };
29 29
30 template <class TupleType, class A, class B> 30 template <class TupleType, class A, class B>
31 struct TupleTypeMatch2 { 31 struct TupleTypeMatch2 {
32 static const bool kValue = false; 32 static const bool kValue = false;
33 }; 33 };
34 template <class A, class B> 34 template <class A, class B>
35 struct TupleTypeMatch2<Tuple<A, B>, A, B> { 35 struct TupleTypeMatch2<base::Tuple<A, B>, A, B> {
36 static const bool kValue = true; 36 static const bool kValue = true;
37 }; 37 };
38 38
39 template <class TupleType, class A, class B, class C> 39 template <class TupleType, class A, class B, class C>
40 struct TupleTypeMatch3 { 40 struct TupleTypeMatch3 {
41 static const bool kValue = false; 41 static const bool kValue = false;
42 }; 42 };
43 template <class A, class B, class C> 43 template <class A, class B, class C>
44 struct TupleTypeMatch3<Tuple<A, B, C>, A, B, C> { 44 struct TupleTypeMatch3<base::Tuple<A, B, C>, A, B, C> {
45 static const bool kValue = true; 45 static const bool kValue = true;
46 }; 46 };
47 47
48 template <class TupleType, class A, class B, class C, class D> 48 template <class TupleType, class A, class B, class C, class D>
49 struct TupleTypeMatch4 { 49 struct TupleTypeMatch4 {
50 static const bool kValue = false; 50 static const bool kValue = false;
51 }; 51 };
52 template <class A, class B, class C, class D> 52 template <class A, class B, class C, class D>
53 struct TupleTypeMatch4<Tuple<A, B, C, D>, A, B, C, D> { 53 struct TupleTypeMatch4<base::Tuple<A, B, C, D>, A, B, C, D> {
54 static const bool kValue = true; 54 static const bool kValue = true;
55 }; 55 };
56 56
57 template <class TupleType, class A, class B, class C, class D, class E> 57 template <class TupleType, class A, class B, class C, class D, class E>
58 struct TupleTypeMatch5 { 58 struct TupleTypeMatch5 {
59 static const bool kValue = false; 59 static const bool kValue = false;
60 }; 60 };
61 template <class A, class B, class C, class D, class E> 61 template <class A, class B, class C, class D, class E>
62 struct TupleTypeMatch5<Tuple<A, B, C, D, E>, A, B, C, D, E> { 62 struct TupleTypeMatch5<base::Tuple<A, B, C, D, E>, A, B, C, D, E> {
63 static const bool kValue = true; 63 static const bool kValue = true;
64 }; 64 };
65 65
66 } // namespace internal 66 } // namespace internal
67 67
68 template <class MsgClass, class A> 68 template <class MsgClass, class A>
69 bool UnpackMessage(const IPC::Message& msg, A* a) { 69 bool UnpackMessage(const IPC::Message& msg, A* a) {
70 static_assert( 70 static_assert(
71 (internal::TupleTypeMatch1<typename MsgClass::Param, A>::kValue), 71 (internal::TupleTypeMatch1<typename MsgClass::Param, A>::kValue),
72 "tuple types should match"); 72 "tuple types should match");
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 return IPC::ReadParam(&msg, &iter, a) && 121 return IPC::ReadParam(&msg, &iter, a) &&
122 IPC::ReadParam(&msg, &iter, b) && 122 IPC::ReadParam(&msg, &iter, b) &&
123 IPC::ReadParam(&msg, &iter, c) && 123 IPC::ReadParam(&msg, &iter, c) &&
124 IPC::ReadParam(&msg, &iter, d) && 124 IPC::ReadParam(&msg, &iter, d) &&
125 IPC::ReadParam(&msg, &iter, e); 125 IPC::ReadParam(&msg, &iter, e);
126 } 126 }
127 127
128 } // namespace ppapi 128 } // namespace ppapi
129 129
130 #endif // PPAPI_PROXY_PPAPI_MESSAGE_UTILS_H_ 130 #endif // PPAPI_PROXY_PPAPI_MESSAGE_UTILS_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_var_tracker_unittest.cc ('k') | ppapi/proxy/ppapi_proxy_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698