| 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_H_ | 5 #ifndef IPC_IPC_MESSAGE_H_ |
| 6 #define IPC_IPC_MESSAGE_H_ | 6 #define IPC_IPC_MESSAGE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/pickle.h" | 12 #include "base/pickle.h" |
| 13 #include "ipc/ipc_export.h" | 13 #include "ipc/ipc_export.h" |
| 14 | 14 |
| 15 // TODO(brettw) remove this when the "typedef Sender" is removed below. |
| 16 #include "ipc/ipc_sender.h" |
| 17 |
| 15 // Ipc logging adds a dependency from the 'chrome' target on all ipc message | 18 // Ipc logging adds a dependency from the 'chrome' target on all ipc message |
| 16 // classes. In a component build, this would require exporting all message | 19 // classes. In a component build, this would require exporting all message |
| 17 // classes, so don't support ipc logging in the components build. | 20 // classes, so don't support ipc logging in the components build. |
| 18 #if !defined(NDEBUG) && !defined(COMPONENT_BUILD) | 21 #if !defined(NDEBUG) && !defined(COMPONENT_BUILD) |
| 19 #define IPC_MESSAGE_LOG_ENABLED | 22 #define IPC_MESSAGE_LOG_ENABLED |
| 20 #endif | 23 #endif |
| 21 | 24 |
| 22 #if defined(OS_POSIX) | 25 #if defined(OS_POSIX) |
| 23 #include "base/memory/ref_counted.h" | 26 #include "base/memory/ref_counted.h" |
| 24 #endif | 27 #endif |
| 25 | 28 |
| 26 namespace base { | 29 namespace base { |
| 27 struct FileDescriptor; | 30 struct FileDescriptor; |
| 28 } | 31 } |
| 29 | 32 |
| 30 class FileDescriptorSet; | 33 class FileDescriptorSet; |
| 31 | 34 |
| 32 namespace IPC { | 35 namespace IPC { |
| 33 | 36 |
| 34 //------------------------------------------------------------------------------ | 37 //------------------------------------------------------------------------------ |
| 35 | 38 |
| 36 class Channel; | 39 class Channel; |
| 37 class Message; | 40 class Message; |
| 38 struct LogData; | 41 struct LogData; |
| 39 | 42 |
| 40 class IPC_EXPORT Message : public Pickle { | 43 class IPC_EXPORT Message : public Pickle { |
| 41 public: | 44 public: |
| 42 // Implemented by objects that can send IPC messages across a channel. | 45 // IPC::Sender used to be IPC::Message::Sender which prevented forward |
| 43 class IPC_EXPORT Sender { | 46 // declarations. To keep existing code compiling, we provide this backwards- |
| 44 public: | 47 // compatible definition. New code should use IPC::Sender. |
| 45 virtual ~Sender() {} | 48 // TODO(brettw) convert users of this and delete. |
| 46 | 49 typedef IPC::Sender Sender; |
| 47 // Sends the given IPC message. The implementor takes ownership of the | |
| 48 // given Message regardless of whether or not this method succeeds. This | |
| 49 // is done to make this method easier to use. Returns true on success and | |
| 50 // false otherwise. | |
| 51 virtual bool Send(Message* msg) = 0; | |
| 52 }; | |
| 53 | 50 |
| 54 enum PriorityValue { | 51 enum PriorityValue { |
| 55 PRIORITY_LOW = 1, | 52 PRIORITY_LOW = 1, |
| 56 PRIORITY_NORMAL, | 53 PRIORITY_NORMAL, |
| 57 PRIORITY_HIGH | 54 PRIORITY_HIGH |
| 58 }; | 55 }; |
| 59 | 56 |
| 60 // Bit values used in the flags field. | 57 // Bit values used in the flags field. |
| 61 enum { | 58 enum { |
| 62 PRIORITY_MASK = 0x0003, // Low 2 bits of store the priority value. | 59 PRIORITY_MASK = 0x0003, // Low 2 bits of store the priority value. |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 MSG_ROUTING_NONE = -2, | 279 MSG_ROUTING_NONE = -2, |
| 283 | 280 |
| 284 // indicates a general message not sent to a particular tab. | 281 // indicates a general message not sent to a particular tab. |
| 285 MSG_ROUTING_CONTROL = kint32max, | 282 MSG_ROUTING_CONTROL = kint32max, |
| 286 }; | 283 }; |
| 287 | 284 |
| 288 #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies | 285 #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies |
| 289 #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging | 286 #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging |
| 290 | 287 |
| 291 #endif // IPC_IPC_MESSAGE_H_ | 288 #endif // IPC_IPC_MESSAGE_H_ |
| OLD | NEW |