| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 190 |
| 191 template <> | 191 template <> |
| 192 struct ParamTraits<int> { | 192 struct ParamTraits<int> { |
| 193 typedef int param_type; | 193 typedef int param_type; |
| 194 static void Write(Message* m, const param_type& p) { | 194 static void Write(Message* m, const param_type& p) { |
| 195 m->WriteInt(p); | 195 m->WriteInt(p); |
| 196 } | 196 } |
| 197 static bool Read(const Message* m, void** iter, param_type* r) { | 197 static bool Read(const Message* m, void** iter, param_type* r) { |
| 198 return m->ReadInt(iter, r); | 198 return m->ReadInt(iter, r); |
| 199 } | 199 } |
| 200 static void Log(const param_type& p, std::string* l); | 200 IPC_EXPORT static void Log(const param_type& p, std::string* l); |
| 201 }; | 201 }; |
| 202 | 202 |
| 203 template <> | 203 template <> |
| 204 struct ParamTraits<unsigned int> { | 204 struct ParamTraits<unsigned int> { |
| 205 typedef unsigned int param_type; | 205 typedef unsigned int param_type; |
| 206 static void Write(Message* m, const param_type& p) { | 206 static void Write(Message* m, const param_type& p) { |
| 207 m->WriteInt(p); | 207 m->WriteInt(p); |
| 208 } | 208 } |
| 209 static bool Read(const Message* m, void** iter, param_type* r) { | 209 static bool Read(const Message* m, void** iter, param_type* r) { |
| 210 return m->ReadInt(iter, reinterpret_cast<int*>(r)); | 210 return m->ReadInt(iter, reinterpret_cast<int*>(r)); |
| 211 } | 211 } |
| 212 static void Log(const param_type& p, std::string* l); | 212 IPC_EXPORT static void Log(const param_type& p, std::string* l); |
| 213 }; | 213 }; |
| 214 | 214 |
| 215 template <> | 215 template <> |
| 216 struct ParamTraits<long> { | 216 struct ParamTraits<long> { |
| 217 typedef long param_type; | 217 typedef long param_type; |
| 218 static void Write(Message* m, const param_type& p) { | 218 static void Write(Message* m, const param_type& p) { |
| 219 m->WriteLong(p); | 219 m->WriteLong(p); |
| 220 } | 220 } |
| 221 static bool Read(const Message* m, void** iter, param_type* r) { | 221 static bool Read(const Message* m, void** iter, param_type* r) { |
| 222 return m->ReadLong(iter, r); | 222 return m->ReadLong(iter, r); |
| 223 } | 223 } |
| 224 static void Log(const param_type& p, std::string* l); | 224 IPC_EXPORT static void Log(const param_type& p, std::string* l); |
| 225 }; | 225 }; |
| 226 | 226 |
| 227 template <> | 227 template <> |
| 228 struct ParamTraits<unsigned long> { | 228 struct ParamTraits<unsigned long> { |
| 229 typedef unsigned long param_type; | 229 typedef unsigned long param_type; |
| 230 static void Write(Message* m, const param_type& p) { | 230 static void Write(Message* m, const param_type& p) { |
| 231 m->WriteLong(p); | 231 m->WriteLong(p); |
| 232 } | 232 } |
| 233 static bool Read(const Message* m, void** iter, param_type* r) { | 233 static bool Read(const Message* m, void** iter, param_type* r) { |
| 234 return m->ReadLong(iter, reinterpret_cast<long*>(r)); | 234 return m->ReadLong(iter, reinterpret_cast<long*>(r)); |
| 235 } | 235 } |
| 236 static void Log(const param_type& p, std::string* l); | 236 IPC_EXPORT static void Log(const param_type& p, std::string* l); |
| 237 }; | 237 }; |
| 238 | 238 |
| 239 template <> | 239 template <> |
| 240 struct ParamTraits<long long> { | 240 struct ParamTraits<long long> { |
| 241 typedef long long param_type; | 241 typedef long long param_type; |
| 242 static void Write(Message* m, const param_type& p) { | 242 static void Write(Message* m, const param_type& p) { |
| 243 m->WriteInt64(static_cast<int64>(p)); | 243 m->WriteInt64(static_cast<int64>(p)); |
| 244 } | 244 } |
| 245 static bool Read(const Message* m, void** iter, param_type* r) { | 245 static bool Read(const Message* m, void** iter, param_type* r) { |
| 246 return m->ReadInt64(iter, reinterpret_cast<int64*>(r)); | 246 return m->ReadInt64(iter, reinterpret_cast<int64*>(r)); |
| 247 } | 247 } |
| 248 static void Log(const param_type& p, std::string* l); | 248 IPC_EXPORT static void Log(const param_type& p, std::string* l); |
| 249 }; | 249 }; |
| 250 | 250 |
| 251 template <> | 251 template <> |
| 252 struct ParamTraits<unsigned long long> { | 252 struct ParamTraits<unsigned long long> { |
| 253 typedef unsigned long long param_type; | 253 typedef unsigned long long param_type; |
| 254 static void Write(Message* m, const param_type& p) { | 254 static void Write(Message* m, const param_type& p) { |
| 255 m->WriteInt64(p); | 255 m->WriteInt64(p); |
| 256 } | 256 } |
| 257 static bool Read(const Message* m, void** iter, param_type* r) { | 257 static bool Read(const Message* m, void** iter, param_type* r) { |
| 258 return m->ReadInt64(iter, reinterpret_cast<int64*>(r)); | 258 return m->ReadInt64(iter, reinterpret_cast<int64*>(r)); |
| 259 } | 259 } |
| 260 static void Log(const param_type& p, std::string* l); | 260 IPC_EXPORT static void Log(const param_type& p, std::string* l); |
| 261 }; | 261 }; |
| 262 | 262 |
| 263 template <> | 263 template <> |
| 264 struct ParamTraits<unsigned short> { | 264 struct IPC_EXPORT ParamTraits<unsigned short> { |
| 265 typedef unsigned short param_type; | 265 typedef unsigned short param_type; |
| 266 static void Write(Message* m, const param_type& p); | 266 static void Write(Message* m, const param_type& p); |
| 267 static bool Read(const Message* m, void** iter, param_type* r); | 267 static bool Read(const Message* m, void** iter, param_type* r); |
| 268 static void Log(const param_type& p, std::string* l); | 268 static void Log(const param_type& p, std::string* l); |
| 269 }; | 269 }; |
| 270 | 270 |
| 271 // Note that the IPC layer doesn't sanitize NaNs and +/- INF values. Clients | 271 // Note that the IPC layer doesn't sanitize NaNs and +/- INF values. Clients |
| 272 // should be sure to check the sanity of these values after receiving them over | 272 // should be sure to check the sanity of these values after receiving them over |
| 273 // IPC. | 273 // IPC. |
| 274 template <> | 274 template <> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 } | 309 } |
| 310 memcpy(r, data, sizeof(param_type)); | 310 memcpy(r, data, sizeof(param_type)); |
| 311 return true; | 311 return true; |
| 312 } | 312 } |
| 313 static void Log(const param_type& p, std::string* l) { | 313 static void Log(const param_type& p, std::string* l) { |
| 314 l->append(StringPrintf("%e", p)); | 314 l->append(StringPrintf("%e", p)); |
| 315 } | 315 } |
| 316 }; | 316 }; |
| 317 | 317 |
| 318 template <> | 318 template <> |
| 319 struct ParamTraits<base::Time> { | 319 struct IPC_EXPORT ParamTraits<base::Time> { |
| 320 typedef base::Time param_type; | 320 typedef base::Time param_type; |
| 321 static void Write(Message* m, const param_type& p); | 321 static void Write(Message* m, const param_type& p); |
| 322 static bool Read(const Message* m, void** iter, param_type* r); | 322 static bool Read(const Message* m, void** iter, param_type* r); |
| 323 static void Log(const param_type& p, std::string* l); | 323 static void Log(const param_type& p, std::string* l); |
| 324 }; | 324 }; |
| 325 | 325 |
| 326 template <> | 326 template <> |
| 327 struct ParamTraits<base::TimeDelta> { | 327 struct IPC_EXPORT ParamTraits<base::TimeDelta> { |
| 328 typedef base::TimeDelta param_type; | 328 typedef base::TimeDelta param_type; |
| 329 static void Write(Message* m, const param_type& p); | 329 static void Write(Message* m, const param_type& p); |
| 330 static bool Read(const Message* m, void** iter, param_type* r); | 330 static bool Read(const Message* m, void** iter, param_type* r); |
| 331 static void Log(const param_type& p, std::string* l); | 331 static void Log(const param_type& p, std::string* l); |
| 332 }; | 332 }; |
| 333 | 333 |
| 334 #if defined(OS_WIN) | 334 #if defined(OS_WIN) |
| 335 template <> | 335 template <> |
| 336 struct ParamTraits<LOGFONT> { | 336 struct ParamTraits<LOGFONT> { |
| 337 typedef LOGFONT param_type; | 337 typedef LOGFONT param_type; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 | 375 |
| 376 return result; | 376 return result; |
| 377 } | 377 } |
| 378 static void Log(const param_type& p, std::string* l) { | 378 static void Log(const param_type& p, std::string* l) { |
| 379 l->append("<MSG>"); | 379 l->append("<MSG>"); |
| 380 } | 380 } |
| 381 }; | 381 }; |
| 382 #endif // defined(OS_WIN) | 382 #endif // defined(OS_WIN) |
| 383 | 383 |
| 384 template <> | 384 template <> |
| 385 struct ParamTraits<base::DictionaryValue> { | 385 struct IPC_EXPORT ParamTraits<base::DictionaryValue> { |
| 386 typedef base::DictionaryValue param_type; | 386 typedef base::DictionaryValue param_type; |
| 387 static void Write(Message* m, const param_type& p); | 387 static void Write(Message* m, const param_type& p); |
| 388 static bool Read(const Message* m, void** iter, param_type* r); | 388 static bool Read(const Message* m, void** iter, param_type* r); |
| 389 static void Log(const param_type& p, std::string* l); | 389 static void Log(const param_type& p, std::string* l); |
| 390 }; | 390 }; |
| 391 | 391 |
| 392 template <> | 392 template <> |
| 393 struct ParamTraits<base::ListValue> { | 393 struct IPC_EXPORT ParamTraits<base::ListValue> { |
| 394 typedef base::ListValue param_type; | 394 typedef base::ListValue param_type; |
| 395 static void Write(Message* m, const param_type& p); | 395 static void Write(Message* m, const param_type& p); |
| 396 static bool Read(const Message* m, void** iter, param_type* r); | 396 static bool Read(const Message* m, void** iter, param_type* r); |
| 397 static void Log(const param_type& p, std::string* l); | 397 static void Log(const param_type& p, std::string* l); |
| 398 }; | 398 }; |
| 399 | 399 |
| 400 template <> | 400 template <> |
| 401 struct ParamTraits<std::string> { | 401 struct ParamTraits<std::string> { |
| 402 typedef std::string param_type; | 402 typedef std::string param_type; |
| 403 static void Write(Message* m, const param_type& p) { | 403 static void Write(Message* m, const param_type& p) { |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 | 577 |
| 578 template <> | 578 template <> |
| 579 struct ParamTraits<std::wstring> { | 579 struct ParamTraits<std::wstring> { |
| 580 typedef std::wstring param_type; | 580 typedef std::wstring param_type; |
| 581 static void Write(Message* m, const param_type& p) { | 581 static void Write(Message* m, const param_type& p) { |
| 582 m->WriteWString(p); | 582 m->WriteWString(p); |
| 583 } | 583 } |
| 584 static bool Read(const Message* m, void** iter, param_type* r) { | 584 static bool Read(const Message* m, void** iter, param_type* r) { |
| 585 return m->ReadWString(iter, r); | 585 return m->ReadWString(iter, r); |
| 586 } | 586 } |
| 587 static void Log(const param_type& p, std::string* l); | 587 IPC_EXPORT static void Log(const param_type& p, std::string* l); |
| 588 }; | 588 }; |
| 589 | 589 |
| 590 template <class A, class B> | 590 template <class A, class B> |
| 591 struct ParamTraits<std::pair<A, B> > { | 591 struct ParamTraits<std::pair<A, B> > { |
| 592 typedef std::pair<A, B> param_type; | 592 typedef std::pair<A, B> param_type; |
| 593 static void Write(Message* m, const param_type& p) { | 593 static void Write(Message* m, const param_type& p) { |
| 594 WriteParam(m, p.first); | 594 WriteParam(m, p.first); |
| 595 WriteParam(m, p.second); | 595 WriteParam(m, p.second); |
| 596 } | 596 } |
| 597 static bool Read(const Message* m, void** iter, param_type* r) { | 597 static bool Read(const Message* m, void** iter, param_type* r) { |
| 598 return ReadParam(m, iter, &r->first) && ReadParam(m, iter, &r->second); | 598 return ReadParam(m, iter, &r->first) && ReadParam(m, iter, &r->second); |
| 599 } | 599 } |
| 600 static void Log(const param_type& p, std::string* l) { | 600 static void Log(const param_type& p, std::string* l) { |
| 601 l->append("("); | 601 l->append("("); |
| 602 LogParam(p.first, l); | 602 LogParam(p.first, l); |
| 603 l->append(", "); | 603 l->append(", "); |
| 604 LogParam(p.second, l); | 604 LogParam(p.second, l); |
| 605 l->append(")"); | 605 l->append(")"); |
| 606 } | 606 } |
| 607 }; | 607 }; |
| 608 | 608 |
| 609 template <> | 609 template <> |
| 610 struct ParamTraits<NullableString16> { | 610 struct IPC_EXPORT ParamTraits<NullableString16> { |
| 611 typedef NullableString16 param_type; | 611 typedef NullableString16 param_type; |
| 612 static void Write(Message* m, const param_type& p); | 612 static void Write(Message* m, const param_type& p); |
| 613 static bool Read(const Message* m, void** iter, param_type* r); | 613 static bool Read(const Message* m, void** iter, param_type* r); |
| 614 static void Log(const param_type& p, std::string* l); | 614 static void Log(const param_type& p, std::string* l); |
| 615 }; | 615 }; |
| 616 | 616 |
| 617 // If WCHAR_T_IS_UTF16 is defined, then string16 is a std::wstring so we don't | 617 // If WCHAR_T_IS_UTF16 is defined, then string16 is a std::wstring so we don't |
| 618 // need this trait. | 618 // need this trait. |
| 619 #if !defined(WCHAR_T_IS_UTF16) | 619 #if !defined(WCHAR_T_IS_UTF16) |
| 620 template <> | 620 template <> |
| 621 struct ParamTraits<string16> { | 621 struct ParamTraits<string16> { |
| 622 typedef string16 param_type; | 622 typedef string16 param_type; |
| 623 static void Write(Message* m, const param_type& p) { | 623 static void Write(Message* m, const param_type& p) { |
| 624 m->WriteString16(p); | 624 m->WriteString16(p); |
| 625 } | 625 } |
| 626 static bool Read(const Message* m, void** iter, param_type* r) { | 626 static bool Read(const Message* m, void** iter, param_type* r) { |
| 627 return m->ReadString16(iter, r); | 627 return m->ReadString16(iter, r); |
| 628 } | 628 } |
| 629 static void Log(const param_type& p, std::string* l); | 629 IPC_EXPORT static void Log(const param_type& p, std::string* l); |
| 630 }; | 630 }; |
| 631 #endif | 631 #endif |
| 632 | 632 |
| 633 // and, a few more useful types... | 633 // and, a few more useful types... |
| 634 #if defined(OS_WIN) | 634 #if defined(OS_WIN) |
| 635 template <> | 635 template <> |
| 636 struct ParamTraits<HANDLE> { | 636 struct ParamTraits<HANDLE> { |
| 637 typedef HANDLE param_type; | 637 typedef HANDLE param_type; |
| 638 static void Write(Message* m, const param_type& p) { | 638 static void Write(Message* m, const param_type& p) { |
| 639 // Note that HWNDs/HANDLE/HCURSOR/HACCEL etc are always 32 bits, even on 64 | 639 // Note that HWNDs/HANDLE/HCURSOR/HACCEL etc are always 32 bits, even on 64 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 r->y = y; | 691 r->y = y; |
| 692 return true; | 692 return true; |
| 693 } | 693 } |
| 694 static void Log(const param_type& p, std::string* l) { | 694 static void Log(const param_type& p, std::string* l) { |
| 695 l->append(StringPrintf("(%d, %d)", p.x, p.y)); | 695 l->append(StringPrintf("(%d, %d)", p.x, p.y)); |
| 696 } | 696 } |
| 697 }; | 697 }; |
| 698 #endif // defined(OS_WIN) | 698 #endif // defined(OS_WIN) |
| 699 | 699 |
| 700 template <> | 700 template <> |
| 701 struct ParamTraits<FilePath> { | 701 struct IPC_EXPORT ParamTraits<FilePath> { |
| 702 typedef FilePath param_type; | 702 typedef FilePath param_type; |
| 703 static void Write(Message* m, const param_type& p); | 703 static void Write(Message* m, const param_type& p); |
| 704 static bool Read(const Message* m, void** iter, param_type* r); | 704 static bool Read(const Message* m, void** iter, param_type* r); |
| 705 static void Log(const param_type& p, std::string* l); | 705 static void Log(const param_type& p, std::string* l); |
| 706 }; | 706 }; |
| 707 | 707 |
| 708 #if defined(OS_POSIX) | 708 #if defined(OS_POSIX) |
| 709 // FileDescriptors may be serialised over IPC channels on POSIX. On the | 709 // FileDescriptors may be serialised over IPC channels on POSIX. On the |
| 710 // receiving side, the FileDescriptor is a valid duplicate of the file | 710 // receiving side, the FileDescriptor is a valid duplicate of the file |
| 711 // descriptor which was transmitted: *it is not just a copy of the integer like | 711 // descriptor which was transmitted: *it is not just a copy of the integer like |
| 712 // HANDLEs on Windows*. The only exception is if the file descriptor is < 0. In | 712 // HANDLEs on Windows*. The only exception is if the file descriptor is < 0. In |
| 713 // this case, the receiving end will see a value of -1. *Zero is a valid file | 713 // this case, the receiving end will see a value of -1. *Zero is a valid file |
| 714 // descriptor*. | 714 // descriptor*. |
| 715 // | 715 // |
| 716 // The received file descriptor will have the |auto_close| flag set to true. The | 716 // The received file descriptor will have the |auto_close| flag set to true. The |
| 717 // code which handles the message is responsible for taking ownership of it. | 717 // code which handles the message is responsible for taking ownership of it. |
| 718 // File descriptors are OS resources and must be closed when no longer needed. | 718 // File descriptors are OS resources and must be closed when no longer needed. |
| 719 // | 719 // |
| 720 // When sending a file descriptor, the file descriptor must be valid at the time | 720 // When sending a file descriptor, the file descriptor must be valid at the time |
| 721 // of transmission. Since transmission is not synchronous, one should consider | 721 // of transmission. Since transmission is not synchronous, one should consider |
| 722 // dup()ing any file descriptors to be transmitted and setting the |auto_close| | 722 // dup()ing any file descriptors to be transmitted and setting the |auto_close| |
| 723 // flag, which causes the file descriptor to be closed after writing. | 723 // flag, which causes the file descriptor to be closed after writing. |
| 724 template<> | 724 template<> |
| 725 struct ParamTraits<base::FileDescriptor> { | 725 struct IPC_EXPORT ParamTraits<base::FileDescriptor> { |
| 726 typedef base::FileDescriptor param_type; | 726 typedef base::FileDescriptor param_type; |
| 727 static void Write(Message* m, const param_type& p); | 727 static void Write(Message* m, const param_type& p); |
| 728 static bool Read(const Message* m, void** iter, param_type* r); | 728 static bool Read(const Message* m, void** iter, param_type* r); |
| 729 static void Log(const param_type& p, std::string* l); | 729 static void Log(const param_type& p, std::string* l); |
| 730 }; | 730 }; |
| 731 #endif // defined(OS_POSIX) | 731 #endif // defined(OS_POSIX) |
| 732 | 732 |
| 733 // A ChannelHandle is basically a platform-inspecific wrapper around the | 733 // A ChannelHandle is basically a platform-inspecific wrapper around the |
| 734 // fact that IPC endpoints are handled specially on POSIX. See above comments | 734 // fact that IPC endpoints are handled specially on POSIX. See above comments |
| 735 // on FileDescriptor for more background. | 735 // on FileDescriptor for more background. |
| 736 template<> | 736 template<> |
| 737 struct ParamTraits<IPC::ChannelHandle> { | 737 struct IPC_EXPORT ParamTraits<IPC::ChannelHandle> { |
| 738 typedef ChannelHandle param_type; | 738 typedef ChannelHandle param_type; |
| 739 static void Write(Message* m, const param_type& p); | 739 static void Write(Message* m, const param_type& p); |
| 740 static bool Read(const Message* m, void** iter, param_type* r); | 740 static bool Read(const Message* m, void** iter, param_type* r); |
| 741 static void Log(const param_type& p, std::string* l); | 741 static void Log(const param_type& p, std::string* l); |
| 742 }; | 742 }; |
| 743 | 743 |
| 744 #if defined(OS_WIN) | 744 #if defined(OS_WIN) |
| 745 template <> | 745 template <> |
| 746 struct ParamTraits<XFORM> { | 746 struct ParamTraits<XFORM> { |
| 747 typedef XFORM param_type; | 747 typedef XFORM param_type; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 760 } | 760 } |
| 761 | 761 |
| 762 return result; | 762 return result; |
| 763 } | 763 } |
| 764 static void Log(const param_type& p, std::string* l) { | 764 static void Log(const param_type& p, std::string* l) { |
| 765 l->append("<XFORM>"); | 765 l->append("<XFORM>"); |
| 766 } | 766 } |
| 767 }; | 767 }; |
| 768 #endif // defined(OS_WIN) | 768 #endif // defined(OS_WIN) |
| 769 | 769 |
| 770 struct LogData { | 770 struct IPC_EXPORT LogData { |
| 771 LogData(); | 771 LogData(); |
| 772 ~LogData(); | 772 ~LogData(); |
| 773 | 773 |
| 774 std::string channel; | 774 std::string channel; |
| 775 int32 routing_id; | 775 int32 routing_id; |
| 776 uint32 type; // "User-defined" message type, from ipc_message.h. | 776 uint32 type; // "User-defined" message type, from ipc_message.h. |
| 777 std::string flags; | 777 std::string flags; |
| 778 int64 sent; // Time that the message was sent (i.e. at Send()). | 778 int64 sent; // Time that the message was sent (i.e. at Send()). |
| 779 int64 receive; // Time before it was dispatched (i.e. before calling | 779 int64 receive; // Time before it was dispatched (i.e. before calling |
| 780 // OnMessageReceived). | 780 // OnMessageReceived). |
| 781 int64 dispatch; // Time after it was dispatched (i.e. after calling | 781 int64 dispatch; // Time after it was dispatched (i.e. after calling |
| 782 // OnMessageReceived). | 782 // OnMessageReceived). |
| 783 std::string message_name; | 783 std::string message_name; |
| 784 std::string params; | 784 std::string params; |
| 785 }; | 785 }; |
| 786 | 786 |
| 787 template <> | 787 template <> |
| 788 struct ParamTraits<LogData> { | 788 struct IPC_EXPORT ParamTraits<LogData> { |
| 789 typedef LogData param_type; | 789 typedef LogData param_type; |
| 790 static void Write(Message* m, const param_type& p); | 790 static void Write(Message* m, const param_type& p); |
| 791 static bool Read(const Message* m, void** iter, param_type* r); | 791 static bool Read(const Message* m, void** iter, param_type* r); |
| 792 static void Log(const param_type& p, std::string* l) { | 792 static void Log(const param_type& p, std::string* l) { |
| 793 // Doesn't make sense to implement this! | 793 // Doesn't make sense to implement this! |
| 794 } | 794 } |
| 795 }; | 795 }; |
| 796 | 796 |
| 797 template <> | 797 template <> |
| 798 struct ParamTraits<Message> { | 798 struct ParamTraits<Message> { |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 *a = params.a; | 1070 *a = params.a; |
| 1071 *b = params.b; | 1071 *b = params.b; |
| 1072 *c = params.c; | 1072 *c = params.c; |
| 1073 *d = params.d; | 1073 *d = params.d; |
| 1074 *e = params.e; | 1074 *e = params.e; |
| 1075 return true; | 1075 return true; |
| 1076 } | 1076 } |
| 1077 }; | 1077 }; |
| 1078 | 1078 |
| 1079 // defined in ipc_logging.cc | 1079 // defined in ipc_logging.cc |
| 1080 void GenerateLogData(const std::string& channel, const Message& message, | 1080 IPC_EXPORT void GenerateLogData(const std::string& channel, |
| 1081 LogData* data); | 1081 const Message& message, |
| 1082 LogData* data); |
| 1082 | 1083 |
| 1083 | 1084 |
| 1084 #if defined(IPC_MESSAGE_LOG_ENABLED) | 1085 #if defined(IPC_MESSAGE_LOG_ENABLED) |
| 1085 inline void AddOutputParamsToLog(const Message* msg, std::string* l) { | 1086 inline void AddOutputParamsToLog(const Message* msg, std::string* l) { |
| 1086 const std::string& output_params = msg->output_params(); | 1087 const std::string& output_params = msg->output_params(); |
| 1087 if (!l->empty() && !output_params.empty()) | 1088 if (!l->empty() && !output_params.empty()) |
| 1088 l->append(", "); | 1089 l->append(", "); |
| 1089 | 1090 |
| 1090 l->append(output_params); | 1091 l->append(output_params); |
| 1091 } | 1092 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 ReplyParam p(a, b, c, d, e); | 1221 ReplyParam p(a, b, c, d, e); |
| 1221 WriteParam(reply, p); | 1222 WriteParam(reply, p); |
| 1222 } | 1223 } |
| 1223 }; | 1224 }; |
| 1224 | 1225 |
| 1225 //----------------------------------------------------------------------------- | 1226 //----------------------------------------------------------------------------- |
| 1226 | 1227 |
| 1227 } // namespace IPC | 1228 } // namespace IPC |
| 1228 | 1229 |
| 1229 #endif // IPC_IPC_MESSAGE_UTILS_H_ | 1230 #endif // IPC_IPC_MESSAGE_UTILS_H_ |
| OLD | NEW |