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

Side by Side Diff: ppapi/host/dispatch_host_message.h

Issue 1772763002: Replace base::Tuple in //ppapi with std::tuple (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update #include Created 4 years, 9 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 | « no previous file | ppapi/proxy/dispatch_reply_message.h » ('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 // This file provides infrastructure for dispatching host resource call 5 // This file provides infrastructure for dispatching host resource call
6 // messages. Normal IPC message handlers can't take extra parameters or 6 // messages. Normal IPC message handlers can't take extra parameters or
7 // return values. We want to take a HostMessageContext as a parameter and 7 // return values. We want to take a HostMessageContext as a parameter and
8 // also return the int32_t return value to the caller. 8 // also return the int32_t return value to the caller.
9 9
10 #ifndef PPAPI_HOST_DISPATCH_HOST_MESSAGE_H_ 10 #ifndef PPAPI_HOST_DISPATCH_HOST_MESSAGE_H_
11 #define PPAPI_HOST_DISPATCH_HOST_MESSAGE_H_ 11 #define PPAPI_HOST_DISPATCH_HOST_MESSAGE_H_
12 12
13 #include <stdint.h> 13 #include <stdint.h>
14 14
15 #include <tuple>
16
15 #include "base/profiler/scoped_profile.h" 17 #include "base/profiler/scoped_profile.h"
16 #include "ipc/ipc_message_macros.h" 18 #include "ipc/ipc_message_macros.h"
17 #include "ppapi/c/pp_errors.h" 19 #include "ppapi/c/pp_errors.h"
18 20
19 namespace ppapi { 21 namespace ppapi {
20 namespace host { 22 namespace host {
21 23
22 struct HostMessageContext; 24 struct HostMessageContext;
23 25
24 template <class ObjT, class Method> 26 template <class ObjT, class Method>
25 inline int32_t DispatchResourceCall(ObjT* obj, Method method, 27 inline int32_t DispatchResourceCall(ObjT* obj, Method method,
26 HostMessageContext* context, 28 HostMessageContext* context,
27 base::Tuple<>& arg) { 29 std::tuple<>& arg) {
28 return (obj->*method)(context); 30 return (obj->*method)(context);
29 } 31 }
30 32
31 template <class ObjT, class Method, class A> 33 template <class ObjT, class Method, class A>
32 inline int32_t DispatchResourceCall(ObjT* obj, Method method, 34 inline int32_t DispatchResourceCall(ObjT* obj, Method method,
33 HostMessageContext* context, 35 HostMessageContext* context,
34 base::Tuple<A>& arg) { 36 std::tuple<A>& arg) {
35 return (obj->*method)(context, base::get<0>(arg)); 37 return (obj->*method)(context, std::get<0>(arg));
36 } 38 }
37 39
38 template<class ObjT, class Method, class A, class B> 40 template<class ObjT, class Method, class A, class B>
39 inline int32_t DispatchResourceCall(ObjT* obj, Method method, 41 inline int32_t DispatchResourceCall(ObjT* obj, Method method,
40 HostMessageContext* context, 42 HostMessageContext* context,
41 base::Tuple<A, B>& arg) { 43 std::tuple<A, B>& arg) {
42 return (obj->*method)(context, base::get<0>(arg), base::get<1>(arg)); 44 return (obj->*method)(context, std::get<0>(arg), std::get<1>(arg));
43 } 45 }
44 46
45 template<class ObjT, class Method, class A, class B, class C> 47 template<class ObjT, class Method, class A, class B, class C>
46 inline int32_t DispatchResourceCall(ObjT* obj, Method method, 48 inline int32_t DispatchResourceCall(ObjT* obj, Method method,
47 HostMessageContext* context, 49 HostMessageContext* context,
48 base::Tuple<A, B, C>& arg) { 50 std::tuple<A, B, C>& arg) {
49 return (obj->*method)(context, base::get<0>(arg), base::get<1>(arg), 51 return (obj->*method)(context, std::get<0>(arg), std::get<1>(arg),
50 base::get<2>(arg)); 52 std::get<2>(arg));
51 } 53 }
52 54
53 template<class ObjT, class Method, class A, class B, class C, class D> 55 template<class ObjT, class Method, class A, class B, class C, class D>
54 inline int32_t DispatchResourceCall(ObjT* obj, Method method, 56 inline int32_t DispatchResourceCall(ObjT* obj, Method method,
55 HostMessageContext* context, 57 HostMessageContext* context,
56 base::Tuple<A, B, C, D>& arg) { 58 std::tuple<A, B, C, D>& arg) {
57 return (obj->*method)(context, base::get<0>(arg), base::get<1>(arg), 59 return (obj->*method)(context, std::get<0>(arg), std::get<1>(arg),
58 base::get<2>(arg), base::get<3>(arg)); 60 std::get<2>(arg), std::get<3>(arg));
59 } 61 }
60 62
61 template<class ObjT, class Method, class A, class B, class C, class D, class E> 63 template<class ObjT, class Method, class A, class B, class C, class D, class E>
62 inline int32_t DispatchResourceCall(ObjT* obj, Method method, 64 inline int32_t DispatchResourceCall(ObjT* obj, Method method,
63 HostMessageContext* context, 65 HostMessageContext* context,
64 base::Tuple<A, B, C, D, E>& arg) { 66 std::tuple<A, B, C, D, E>& arg) {
65 return (obj->*method)(context, base::get<0>(arg), base::get<1>(arg), 67 return (obj->*method)(context, std::get<0>(arg), std::get<1>(arg),
66 base::get<2>(arg), base::get<3>(arg), 68 std::get<2>(arg), std::get<3>(arg),
67 base::get<4>(arg)); 69 std::get<4>(arg));
68 } 70 }
69 71
70 // Note that this only works for message with 1 or more parameters. For 72 // Note that this only works for message with 1 or more parameters. For
71 // 0-parameter messages you need to use the _0 version below (since there are 73 // 0-parameter messages you need to use the _0 version below (since there are
72 // no params in the message). 74 // no params in the message).
73 #define PPAPI_DISPATCH_HOST_RESOURCE_CALL(msg_class, member_func) \ 75 #define PPAPI_DISPATCH_HOST_RESOURCE_CALL(msg_class, member_func) \
74 case msg_class::ID: { \ 76 case msg_class::ID: { \
75 TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \ 77 TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \
76 msg_class::Schema::Param p; \ 78 msg_class::Schema::Param p; \
77 if (msg_class::Read(&ipc_message__, &p)) { \ 79 if (msg_class::Read(&ipc_message__, &p)) { \
78 return ppapi::host::DispatchResourceCall( \ 80 return ppapi::host::DispatchResourceCall( \
79 this, \ 81 this, \
80 &_IpcMessageHandlerClass::member_func, \ 82 &_IpcMessageHandlerClass::member_func, \
81 context, p); \ 83 context, p); \
82 } \ 84 } \
83 return PP_ERROR_FAILED; \ 85 return PP_ERROR_FAILED; \
84 } 86 }
85 87
86 #define PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(msg_class, member_func) \ 88 #define PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(msg_class, member_func) \
87 case msg_class::ID: { \ 89 case msg_class::ID: { \
88 TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \ 90 TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \
89 return member_func(context); \ 91 return member_func(context); \
90 } 92 }
91 93
92 } // namespace host 94 } // namespace host
93 } // namespace ppapi 95 } // namespace ppapi
94 96
95 #endif // PPAPI_HOST_DISPATCH_HOST_MESSAGE_H_ 97 #endif // PPAPI_HOST_DISPATCH_HOST_MESSAGE_H_
OLDNEW
« no previous file with comments | « no previous file | ppapi/proxy/dispatch_reply_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698