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

Side by Side Diff: ipc/ipc_message_utils.cc

Issue 2484943004: Remove unused parts of IPC::ChannelHandle. (Closed)
Patch Set: rebase Created 4 years, 1 month 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_channel_nacl.cc ('k') | ipc/ipc_message_utils_unittest.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 #include "ipc/ipc_message_utils.h" 5 #include "ipc/ipc_message_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/strings/nullable_string16.h" 12 #include "base/strings/nullable_string16.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "base/unguessable_token.h" 16 #include "base/unguessable_token.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "ipc/ipc_channel_handle.h" 19 #include "ipc/ipc_channel_handle.h"
20 #include "ipc/ipc_message_attachment.h" 20 #include "ipc/ipc_message_attachment.h"
21 #include "ipc/ipc_message_attachment_set.h" 21 #include "ipc/ipc_message_attachment_set.h"
22 #include "ipc/ipc_mojo_param_traits.h" 22 #include "ipc/ipc_mojo_param_traits.h"
23 23
24 #if defined(OS_POSIX) 24 #if defined(OS_POSIX)
25 #include "base/file_descriptor_posix.h"
25 #include "ipc/ipc_platform_file_attachment_posix.h" 26 #include "ipc/ipc_platform_file_attachment_posix.h"
26 #endif 27 #endif
27 28
28 #if (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN) 29 #if (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN)
29 #include "base/memory/shared_memory_handle.h" 30 #include "base/memory/shared_memory_handle.h"
30 #endif // (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN) 31 #endif // (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN)
31 32
32 #if defined(OS_MACOSX) && !defined(OS_IOS) 33 #if defined(OS_MACOSX) && !defined(OS_IOS)
33 #include "ipc/mach_port_mac.h" 34 #include "ipc/mach_port_mac.h"
34 #endif 35 #endif
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 return true; 1012 return true;
1012 } 1013 }
1013 1014
1014 void ParamTraits<base::UnguessableToken>::Log(const param_type& p, 1015 void ParamTraits<base::UnguessableToken>::Log(const param_type& p,
1015 std::string* l) { 1016 std::string* l) {
1016 l->append(p.ToString()); 1017 l->append(p.ToString());
1017 } 1018 }
1018 1019
1019 void ParamTraits<IPC::ChannelHandle>::GetSize(base::PickleSizer* sizer, 1020 void ParamTraits<IPC::ChannelHandle>::GetSize(base::PickleSizer* sizer,
1020 const param_type& p) { 1021 const param_type& p) {
1021 GetParamSize(sizer, p.name); 1022 #if defined(OS_NACL_SFI)
1022 #if defined(OS_POSIX)
1023 GetParamSize(sizer, p.socket); 1023 GetParamSize(sizer, p.socket);
1024 #else
1025 GetParamSize(sizer, p.mojo_handle);
1024 #endif 1026 #endif
1025 GetParamSize(sizer, p.mojo_handle);
1026 } 1027 }
1027 1028
1028 void ParamTraits<IPC::ChannelHandle>::Write(base::Pickle* m, 1029 void ParamTraits<IPC::ChannelHandle>::Write(base::Pickle* m,
1029 const param_type& p) { 1030 const param_type& p) {
1030 #if defined(OS_WIN) 1031 #if defined(OS_NACL_SFI)
1031 // On Windows marshalling pipe handle is not supported.
1032 DCHECK(p.pipe.handle == NULL);
1033 #endif // defined (OS_WIN)
1034 WriteParam(m, p.name);
1035 #if defined(OS_POSIX)
1036 WriteParam(m, p.socket); 1032 WriteParam(m, p.socket);
1033 #else
1034 WriteParam(m, p.mojo_handle);
1037 #endif 1035 #endif
1038 WriteParam(m, p.mojo_handle);
1039 } 1036 }
1040 1037
1041 bool ParamTraits<IPC::ChannelHandle>::Read(const base::Pickle* m, 1038 bool ParamTraits<IPC::ChannelHandle>::Read(const base::Pickle* m,
1042 base::PickleIterator* iter, 1039 base::PickleIterator* iter,
1043 param_type* r) { 1040 param_type* r) {
1044 return ReadParam(m, iter, &r->name) 1041 #if defined(OS_NACL_SFI)
1045 #if defined(OS_POSIX) 1042 return ReadParam(m, iter, &r->socket);
1046 && ReadParam(m, iter, &r->socket) 1043 #else
1044 return ReadParam(m, iter, &r->mojo_handle);
1047 #endif 1045 #endif
1048 && ReadParam(m, iter, &r->mojo_handle);
1049 } 1046 }
1050 1047
1051 void ParamTraits<IPC::ChannelHandle>::Log(const param_type& p, 1048 void ParamTraits<IPC::ChannelHandle>::Log(const param_type& p,
1052 std::string* l) { 1049 std::string* l) {
1053 l->append(base::StringPrintf("ChannelHandle(%s", p.name.c_str())); 1050 l->append("ChannelHandle(");
1054 #if defined(OS_POSIX) 1051 #if defined(OS_NACL_SFI)
1055 l->append(", ");
1056 ParamTraits<base::FileDescriptor>::Log(p.socket, l); 1052 ParamTraits<base::FileDescriptor>::Log(p.socket, l);
1053 #else
1054 LogParam(p.mojo_handle, l);
1057 #endif 1055 #endif
1058 l->append(", ");
1059 LogParam(p.mojo_handle, l);
1060 l->append(")"); 1056 l->append(")");
1061 } 1057 }
1062 1058
1063 void ParamTraits<LogData>::GetSize(base::PickleSizer* sizer, 1059 void ParamTraits<LogData>::GetSize(base::PickleSizer* sizer,
1064 const param_type& p) { 1060 const param_type& p) {
1065 GetParamSize(sizer, p.channel); 1061 GetParamSize(sizer, p.channel);
1066 GetParamSize(sizer, p.routing_id); 1062 GetParamSize(sizer, p.routing_id);
1067 GetParamSize(sizer, p.type); 1063 GetParamSize(sizer, p.type);
1068 GetParamSize(sizer, p.flags); 1064 GetParamSize(sizer, p.flags);
1069 GetParamSize(sizer, p.sent); 1065 GetParamSize(sizer, p.sent);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 return result; 1225 return result;
1230 } 1226 }
1231 1227
1232 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { 1228 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) {
1233 l->append("<MSG>"); 1229 l->append("<MSG>");
1234 } 1230 }
1235 1231
1236 #endif // OS_WIN 1232 #endif // OS_WIN
1237 1233
1238 } // namespace IPC 1234 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_nacl.cc ('k') | ipc/ipc_message_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698