OLD | NEW |
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/format_macros.h" | 14 #include "base/format_macros.h" |
15 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
16 #include "base/string16.h" | 16 #include "base/string16.h" |
17 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
19 #include "base/tuple.h" | 19 #include "base/tuple.h" |
| 20 #include "ipc/ipc_message_start.h" |
20 #include "ipc/ipc_param_traits.h" | 21 #include "ipc/ipc_param_traits.h" |
21 #include "ipc/ipc_sync_message.h" | 22 #include "ipc/ipc_sync_message.h" |
22 | 23 |
23 #if defined(COMPILER_GCC) | 24 #if defined(COMPILER_GCC) |
24 // GCC "helpfully" tries to inline template methods in release mode. Except we | 25 // GCC "helpfully" tries to inline template methods in release mode. Except we |
25 // want the majority of the template junk being expanded once in the | 26 // want the majority of the template junk being expanded once in the |
26 // implementation file (and only provide the definitions in | 27 // implementation file (and only provide the definitions in |
27 // ipc_message_utils_impl.h in those files) and exported, instead of expanded | 28 // ipc_message_utils_impl.h in those files) and exported, instead of expanded |
28 // at every call site. Special note: GCC happily accepts the attribute before | 29 // at every call site. Special note: GCC happily accepts the attribute before |
29 // the method declaration, but only acts on it if it is after. | 30 // the method declaration, but only acts on it if it is after. |
30 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40500 | 31 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40500 |
31 // Starting in gcc 4.5, the noinline no longer implies the concept covered by | 32 // Starting in gcc 4.5, the noinline no longer implies the concept covered by |
32 // the introduced noclone attribute, which will create specialized versions of | 33 // the introduced noclone attribute, which will create specialized versions of |
33 // functions/methods when certain types are constant. | 34 // functions/methods when certain types are constant. |
34 // www.gnu.org/software/gcc/gcc-4.5/changes.html | 35 // www.gnu.org/software/gcc/gcc-4.5/changes.html |
35 #define IPC_MSG_NOINLINE __attribute__((noinline, noclone)); | 36 #define IPC_MSG_NOINLINE __attribute__((noinline, noclone)); |
36 #else | 37 #else |
37 #define IPC_MSG_NOINLINE __attribute__((noinline)); | 38 #define IPC_MSG_NOINLINE __attribute__((noinline)); |
38 #endif | 39 #endif |
39 #elif defined(COMPILER_MSVC) | 40 #elif defined(COMPILER_MSVC) |
40 // MSVC++ doesn't do this. | 41 // MSVC++ doesn't do this. |
41 #define IPC_MSG_NOINLINE | 42 #define IPC_MSG_NOINLINE |
42 #else | 43 #else |
43 #error "Please add the noinline property for your new compiler here." | 44 #error "Please add the noinline property for your new compiler here." |
44 #endif | 45 #endif |
45 | 46 |
46 // Used by IPC_BEGIN_MESSAGES so that each message class starts from a unique | |
47 // base. Messages have unique IDs across channels in order for the IPC logging | |
48 // code to figure out the message class from its ID. | |
49 enum IPCMessageStart { | |
50 AutomationMsgStart = 0, | |
51 ViewMsgStart, | |
52 PluginMsgStart, | |
53 ProfileImportMsgStart, | |
54 TestMsgStart, | |
55 DevToolsMsgStart, | |
56 WorkerMsgStart, | |
57 NaClMsgStart, | |
58 UtilityMsgStart, | |
59 GpuMsgStart, | |
60 ServiceMsgStart, | |
61 PpapiMsgStart, | |
62 FirefoxImporterUnittestMsgStart, | |
63 FileUtilitiesMsgStart, | |
64 MimeRegistryMsgStart, | |
65 DatabaseMsgStart, | |
66 DOMStorageMsgStart, | |
67 IndexedDBMsgStart, | |
68 PepperFileMsgStart, | |
69 SpeechRecognitionMsgStart, | |
70 PepperMsgStart, | |
71 AutofillMsgStart, | |
72 SafeBrowsingMsgStart, | |
73 P2PMsgStart, | |
74 SocketStreamMsgStart, | |
75 ResourceMsgStart, | |
76 FileSystemMsgStart, | |
77 ChildProcessMsgStart, | |
78 ClipboardMsgStart, | |
79 BlobMsgStart, | |
80 AppCacheMsgStart, | |
81 DeviceMotionMsgStart, | |
82 DeviceOrientationMsgStart, | |
83 DesktopNotificationMsgStart, | |
84 GeolocationMsgStart, | |
85 AudioMsgStart, | |
86 ChromeMsgStart, | |
87 DragMsgStart, | |
88 PrintMsgStart, | |
89 SpellCheckMsgStart, | |
90 ExtensionMsgStart, | |
91 VideoCaptureMsgStart, | |
92 QuotaMsgStart, | |
93 IconMsgStart, | |
94 TextInputClientMsgStart, | |
95 ChromeUtilityMsgStart, | |
96 MediaStreamMsgStart, | |
97 ChromeBenchmarkingMsgStart, | |
98 IntentsMsgStart, | |
99 JavaBridgeMsgStart, | |
100 GamepadMsgStart, | |
101 ShellMsgStart, | |
102 AccessibilityMsgStart, | |
103 PrerenderMsgStart, | |
104 ChromotingMsgStart, | |
105 OldBrowserPluginMsgStart, | |
106 BrowserPluginMsgStart, | |
107 HyphenatorMsgStart, | |
108 AndroidWebViewMsgStart, | |
109 MetroViewerMsgStart, | |
110 CCMsgStart, | |
111 MediaPlayerMsgStart, | |
112 LastIPCMsgStart // Must come last. | |
113 }; | |
114 | |
115 class FilePath; | 47 class FilePath; |
116 class NullableString16; | 48 class NullableString16; |
117 | 49 |
118 namespace base { | 50 namespace base { |
119 class DictionaryValue; | 51 class DictionaryValue; |
120 class ListValue; | 52 class ListValue; |
121 class Time; | 53 class Time; |
122 class TimeDelta; | 54 class TimeDelta; |
123 class TimeTicks; | 55 class TimeTicks; |
124 struct FileDescriptor; | 56 struct FileDescriptor; |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 template<typename TA, typename TB, typename TC, typename TD, typename TE> | 841 template<typename TA, typename TB, typename TC, typename TD, typename TE> |
910 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d, TE e) { | 842 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d, TE e) { |
911 ReplyParam p(a, b, c, d, e); | 843 ReplyParam p(a, b, c, d, e); |
912 WriteParam(reply, p); | 844 WriteParam(reply, p); |
913 } | 845 } |
914 }; | 846 }; |
915 | 847 |
916 } // namespace IPC | 848 } // namespace IPC |
917 | 849 |
918 #endif // IPC_IPC_MESSAGE_UTILS_H_ | 850 #endif // IPC_IPC_MESSAGE_UTILS_H_ |
OLD | NEW |