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 // Defining IPC Messages | 5 // Defining IPC Messages |
6 // | 6 // |
7 // Your IPC messages will be defined by macros inside of an XXX_messages.h | 7 // Your IPC messages will be defined by macros inside of an XXX_messages.h |
8 // header file. Most of the time, the system can automatically generate all | 8 // header file. Most of the time, the system can automatically generate all |
9 // of messaging mechanism from these definitions, but sometimes some manual | 9 // of messaging mechanism from these definitions, but sometimes some manual |
10 // coding is required. In these cases, you will also have an XXX_messages.cc | 10 // coding is required. In these cases, you will also have an XXX_messages.cc |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 msg_class(int32 routing_id) \ | 435 msg_class(int32 routing_id) \ |
436 : IPC::Message(routing_id, ID, PRIORITY_NORMAL) {} \ | 436 : IPC::Message(routing_id, ID, PRIORITY_NORMAL) {} \ |
437 }; | 437 }; |
438 | 438 |
439 #define IPC_ASYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 439 #define IPC_ASYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
440 class msg_class : \ | 440 class msg_class : \ |
441 public IPC::MessageWithTuple<IPC_TUPLE_IN_##in_cnt in_list> { \ | 441 public IPC::MessageWithTuple<IPC_TUPLE_IN_##in_cnt in_list> { \ |
442 public: \ | 442 public: \ |
443 enum { ID = IPC_MESSAGE_ID() }; \ | 443 enum { ID = IPC_MESSAGE_ID() }; \ |
444 msg_class(IPC_TYPE_IN_##in_cnt in_list); \ | 444 msg_class(IPC_TYPE_IN_##in_cnt in_list); \ |
445 ~msg_class(); \ | 445 virtual ~msg_class(); \ |
446 static void Log(std::string* name, const Message* msg, std::string* l); \ | 446 static void Log(std::string* name, const Message* msg, std::string* l); \ |
447 }; | 447 }; |
448 | 448 |
449 #define IPC_ASYNC_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 449 #define IPC_ASYNC_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
450 class msg_class : \ | 450 class msg_class : \ |
451 public IPC::MessageWithTuple<IPC_TUPLE_IN_##in_cnt in_list> { \ | 451 public IPC::MessageWithTuple<IPC_TUPLE_IN_##in_cnt in_list> { \ |
452 public: \ | 452 public: \ |
453 enum { ID = IPC_MESSAGE_ID() }; \ | 453 enum { ID = IPC_MESSAGE_ID() }; \ |
454 msg_class(int32 routing_id IPC_COMMA_##in_cnt \ | 454 msg_class(int32 routing_id IPC_COMMA_##in_cnt \ |
455 IPC_TYPE_IN_##in_cnt in_list); \ | 455 IPC_TYPE_IN_##in_cnt in_list); \ |
456 ~msg_class(); \ | 456 virtual ~msg_class(); \ |
457 static void Log(std::string* name, const Message* msg, std::string* l); \ | 457 static void Log(std::string* name, const Message* msg, std::string* l); \ |
458 }; | 458 }; |
459 | 459 |
460 #define IPC_SYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 460 #define IPC_SYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
461 class msg_class : \ | 461 class msg_class : \ |
462 public IPC::MessageWithReply<IPC_TUPLE_IN_##in_cnt in_list, \ | 462 public IPC::MessageWithReply<IPC_TUPLE_IN_##in_cnt in_list, \ |
463 IPC_TUPLE_OUT_##out_cnt out_list> { \ | 463 IPC_TUPLE_OUT_##out_cnt out_list> { \ |
464 public: \ | 464 public: \ |
465 enum { ID = IPC_MESSAGE_ID() }; \ | 465 enum { ID = IPC_MESSAGE_ID() }; \ |
466 msg_class(IPC_TYPE_IN_##in_cnt in_list \ | 466 msg_class(IPC_TYPE_IN_##in_cnt in_list \ |
467 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ | 467 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ |
468 IPC_TYPE_OUT_##out_cnt out_list); \ | 468 IPC_TYPE_OUT_##out_cnt out_list); \ |
469 ~msg_class(); \ | 469 virtual ~msg_class(); \ |
470 static void Log(std::string* name, const Message* msg, std::string* l); \ | 470 static void Log(std::string* name, const Message* msg, std::string* l); \ |
471 }; | 471 }; |
472 | 472 |
473 #define IPC_SYNC_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 473 #define IPC_SYNC_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
474 class msg_class : \ | 474 class msg_class : \ |
475 public IPC::MessageWithReply<IPC_TUPLE_IN_##in_cnt in_list, \ | 475 public IPC::MessageWithReply<IPC_TUPLE_IN_##in_cnt in_list, \ |
476 IPC_TUPLE_OUT_##out_cnt out_list> { \ | 476 IPC_TUPLE_OUT_##out_cnt out_list> { \ |
477 public: \ | 477 public: \ |
478 enum { ID = IPC_MESSAGE_ID() }; \ | 478 enum { ID = IPC_MESSAGE_ID() }; \ |
479 msg_class(int32 routing_id \ | 479 msg_class(int32 routing_id \ |
480 IPC_COMMA_OR_##in_cnt(IPC_COMMA_##out_cnt) \ | 480 IPC_COMMA_OR_##in_cnt(IPC_COMMA_##out_cnt) \ |
481 IPC_TYPE_IN_##in_cnt in_list \ | 481 IPC_TYPE_IN_##in_cnt in_list \ |
482 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ | 482 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ |
483 IPC_TYPE_OUT_##out_cnt out_list); \ | 483 IPC_TYPE_OUT_##out_cnt out_list); \ |
484 ~msg_class(); \ | 484 virtual ~msg_class(); \ |
485 static void Log(std::string* name, const Message* msg, std::string* l); \ | 485 static void Log(std::string* name, const Message* msg, std::string* l); \ |
486 }; | 486 }; |
487 | 487 |
488 #if defined(IPC_MESSAGE_IMPL) | 488 #if defined(IPC_MESSAGE_IMPL) |
489 | 489 |
490 // "Implementation" inclusion produces constructors, destructors, and | 490 // "Implementation" inclusion produces constructors, destructors, and |
491 // logging functions, except for the no-arg special cases, where the | 491 // logging functions, except for the no-arg special cases, where the |
492 // implementation occurs in the declaration, and there is no special | 492 // implementation occurs in the declaration, and there is no special |
493 // logging function. | 493 // logging function. |
494 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \ | 494 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \ |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 // This corresponds to an enum value from IPCMessageStart. | 770 // This corresponds to an enum value from IPCMessageStart. |
771 #define IPC_MESSAGE_CLASS(message) \ | 771 #define IPC_MESSAGE_CLASS(message) \ |
772 IPC_MESSAGE_ID_CLASS(message.type()) | 772 IPC_MESSAGE_ID_CLASS(message.type()) |
773 | 773 |
774 #endif // IPC_IPC_MESSAGE_MACROS_H_ | 774 #endif // IPC_IPC_MESSAGE_MACROS_H_ |
775 | 775 |
776 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 776 // Clean up IPC_MESSAGE_START in this unguarded section so that the |
777 // XXX_messages.h files need not do so themselves. This makes the | 777 // XXX_messages.h files need not do so themselves. This makes the |
778 // XXX_messages.h files easier to write. | 778 // XXX_messages.h files easier to write. |
779 #undef IPC_MESSAGE_START | 779 #undef IPC_MESSAGE_START |
780 | |
OLD | NEW |