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

Side by Side Diff: ipc/ipc_message_utils.h

Issue 1532813002: Replace IOSurfaceManager by directly passing IOSurface Mach ports over Chrome IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Windows compile Created 5 years 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
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 10 matching lines...) Expand all
21 #include "base/memory/scoped_vector.h" 21 #include "base/memory/scoped_vector.h"
22 #include "base/strings/string16.h" 22 #include "base/strings/string16.h"
23 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
24 #include "base/strings/stringprintf.h" 24 #include "base/strings/stringprintf.h"
25 #include "base/tuple.h" 25 #include "base/tuple.h"
26 #include "ipc/brokerable_attachment.h" 26 #include "ipc/brokerable_attachment.h"
27 #include "ipc/ipc_message_start.h" 27 #include "ipc/ipc_message_start.h"
28 #include "ipc/ipc_param_traits.h" 28 #include "ipc/ipc_param_traits.h"
29 #include "ipc/ipc_sync_message.h" 29 #include "ipc/ipc_sync_message.h"
30 30
31 #if defined(OS_MACOSX)
32 #include "base/mac/scoped_mach_port.h"
33 #endif
34
31 #if defined(COMPILER_GCC) 35 #if defined(COMPILER_GCC)
32 // GCC "helpfully" tries to inline template methods in release mode. Except we 36 // GCC "helpfully" tries to inline template methods in release mode. Except we
33 // want the majority of the template junk being expanded once in the 37 // want the majority of the template junk being expanded once in the
34 // implementation file (and only provide the definitions in 38 // implementation file (and only provide the definitions in
35 // ipc_message_utils_impl.h in those files) and exported, instead of expanded 39 // ipc_message_utils_impl.h in those files) and exported, instead of expanded
36 // at every call site. Special note: GCC happily accepts the attribute before 40 // at every call site. Special note: GCC happily accepts the attribute before
37 // the method declaration, but only acts on it if it is after. 41 // the method declaration, but only acts on it if it is after.
38 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40500 42 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40500
39 // Starting in gcc 4.5, the noinline no longer implies the concept covered by 43 // Starting in gcc 4.5, the noinline no longer implies the concept covered by
40 // the introduced noclone attribute, which will create specialized versions of 44 // the introduced noclone attribute, which will create specialized versions of
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 struct IPC_EXPORT ParamTraits<MSG> { 923 struct IPC_EXPORT ParamTraits<MSG> {
920 typedef MSG param_type; 924 typedef MSG param_type;
921 static void Write(Message* m, const param_type& p); 925 static void Write(Message* m, const param_type& p);
922 static bool Read(const Message* m, 926 static bool Read(const Message* m,
923 base::PickleIterator* iter, 927 base::PickleIterator* iter,
924 param_type* r); 928 param_type* r);
925 static void Log(const param_type& p, std::string* l); 929 static void Log(const param_type& p, std::string* l);
926 }; 930 };
927 #endif // defined(OS_WIN) 931 #endif // defined(OS_WIN)
928 932
933 // Mac ParamTraits -------------------------------------------------------------
934
935 #if defined(OS_MACOSX) && !defined(OS_IOS)
936 template <>
937 struct IPC_EXPORT ParamTraits<base::mac::ScopedRefCountedMachSendRight> {
938 typedef base::mac::ScopedRefCountedMachSendRight param_type;
939 static void Write(Message* m, const param_type p);
940 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
erikchen 2015/12/21 23:00:38 Please add a comment indicating that Read() takes
Robert Sesek 2015/12/23 15:45:13 Done.
941 static void Log(const param_type& p, std::string* l);
942 };
943 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
944
929 //----------------------------------------------------------------------------- 945 //-----------------------------------------------------------------------------
930 // Generic message subclasses 946 // Generic message subclasses
931 947
932 // Used for asynchronous messages. 948 // Used for asynchronous messages.
933 template <class ParamType> 949 template <class ParamType>
934 class MessageSchema { 950 class MessageSchema {
935 public: 951 public:
936 typedef ParamType Param; 952 typedef ParamType Param;
937 typedef typename base::TupleTypes<ParamType>::ParamTuple RefParam; 953 typedef typename base::TupleTypes<ParamType>::ParamTuple RefParam;
938 954
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 template <typename... Ts> 1071 template <typename... Ts>
1056 static void WriteReplyParams(Message* reply, Ts... args) { 1072 static void WriteReplyParams(Message* reply, Ts... args) {
1057 ReplyParam p(args...); 1073 ReplyParam p(args...);
1058 WriteParam(reply, p); 1074 WriteParam(reply, p);
1059 } 1075 }
1060 }; 1076 };
1061 1077
1062 } // namespace IPC 1078 } // namespace IPC
1063 1079
1064 #endif // IPC_IPC_MESSAGE_UTILS_H_ 1080 #endif // IPC_IPC_MESSAGE_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698