summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-04 18:08:45 +0000
committerapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-04 18:08:45 +0000
commit168ae92e90cafe51d7b4d62ce202a8aba093b88c (patch)
treeae330b8e28cc47d1b8dc5824cf01604e31b15be0
parent7fe2c0f6df1bf3bd495cf39f2cd7dcb515740455 (diff)
downloadchromium_src-168ae92e90cafe51d7b4d62ce202a8aba093b88c.zip
chromium_src-168ae92e90cafe51d7b4d62ce202a8aba093b88c.tar.gz
chromium_src-168ae92e90cafe51d7b4d62ce202a8aba093b88c.tar.bz2
Added new IPC message class for CommandBuffer.
Increased IPC message header type from 16 bits to 32 bits so it can accomodate more message classes. TEST=none BUG=none Review URL: http://codereview.chromium.org/399013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33832 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc4
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.h4
-rw-r--r--chrome/browser/renderer_host/database_dispatcher_host.cc2
-rw-r--r--chrome/browser/renderer_host/database_dispatcher_host.h2
-rw-r--r--chrome/browser/renderer_host/mock_render_process_host.cc2
-rw-r--r--chrome/browser/renderer_host/mock_render_process_host.h2
-rw-r--r--chrome/browser/renderer_host/render_process_host.h2
-rw-r--r--chrome/browser/views/about_ipc_dialog.cc2
-rw-r--r--chrome/common/appcache/appcache_dispatcher_host.cc2
-rw-r--r--chrome/common/appcache/appcache_dispatcher_host.h2
-rw-r--r--chrome/common/ipc_test_sink.cc4
-rw-r--r--chrome/common/ipc_test_sink.h4
-rw-r--r--chrome_frame/sync_msg_reply_dispatcher.h4
-rw-r--r--ipc/ipc_channel_posix.cc4
-rw-r--r--ipc/ipc_logging.cc4
-rw-r--r--ipc/ipc_logging.h4
-rw-r--r--ipc/ipc_message.cc4
-rw-r--r--ipc/ipc_message.h16
-rw-r--r--ipc/ipc_message_macros.h8
-rw-r--r--ipc/ipc_message_utils.h10
-rw-r--r--ipc/ipc_sync_message.cc2
-rw-r--r--ipc/ipc_sync_message.h2
22 files changed, 45 insertions, 45 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 741ad41..500e917 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -358,7 +358,7 @@ bool BrowserRenderProcessHost::WaitForPaintMsg(int render_widget_id,
return widget_helper_->WaitForPaintMsg(render_widget_id, max_delay, msg);
}
-void BrowserRenderProcessHost::ReceivedBadMessage(uint16 msg_type) {
+void BrowserRenderProcessHost::ReceivedBadMessage(uint32 msg_type) {
BadMessageTerminateProcess(msg_type, GetHandle());
}
@@ -789,7 +789,7 @@ void BrowserRenderProcessHost::OnChannelConnected(int32 peer_pid) {
// Static. This function can be called from any thread.
void BrowserRenderProcessHost::BadMessageTerminateProcess(
- uint16 msg_type, base::ProcessHandle process) {
+ uint32 msg_type, base::ProcessHandle process) {
LOG(ERROR) << "bad message " << msg_type << " terminating renderer.";
if (run_renderer_in_process()) {
// In single process mode it is better if we don't suicide but just crash.
diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h
index fae3145..cd94bf5 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.h
+++ b/chrome/browser/renderer_host/browser_render_process_host.h
@@ -66,7 +66,7 @@ class BrowserRenderProcessHost : public RenderProcessHost,
virtual bool WaitForPaintMsg(int render_widget_id,
const base::TimeDelta& max_delay,
IPC::Message* msg);
- virtual void ReceivedBadMessage(uint16 msg_type);
+ virtual void ReceivedBadMessage(uint32 msg_type);
virtual void WidgetRestored();
virtual void WidgetHidden();
virtual void ViewCreated();
@@ -89,7 +89,7 @@ class BrowserRenderProcessHost : public RenderProcessHost,
// If the a process has sent a message that cannot be decoded, it is deemed
// corrupted and thus needs to be terminated using this call. This function
// can be safely called from any thread.
- static void BadMessageTerminateProcess(uint16 msg_type,
+ static void BadMessageTerminateProcess(uint32 msg_type,
base::ProcessHandle renderer);
// NotificationObserver implementation.
diff --git a/chrome/browser/renderer_host/database_dispatcher_host.cc b/chrome/browser/renderer_host/database_dispatcher_host.cc
index 9a2d98a..41b8331 100644
--- a/chrome/browser/renderer_host/database_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/database_dispatcher_host.cc
@@ -90,7 +90,7 @@ bool DatabaseDispatcherHost::OnMessageReceived(
return handled;
}
-void DatabaseDispatcherHost::ReceivedBadMessage(uint16 msg_type) {
+void DatabaseDispatcherHost::ReceivedBadMessage(uint32 msg_type) {
BrowserRenderProcessHost::BadMessageTerminateProcess(
msg_type, process_handle_);
}
diff --git a/chrome/browser/renderer_host/database_dispatcher_host.h b/chrome/browser/renderer_host/database_dispatcher_host.h
index 7b6a558..eb0f8f1 100644
--- a/chrome/browser/renderer_host/database_dispatcher_host.h
+++ b/chrome/browser/renderer_host/database_dispatcher_host.h
@@ -55,7 +55,7 @@ class DatabaseDispatcherHost
void AddObserver();
void RemoveObserver();
- void ReceivedBadMessage(uint16 msg_type);
+ void ReceivedBadMessage(uint32 msg_type);
void SendMessage(IPC::Message* message);
// VFS message handlers (file thread)
diff --git a/chrome/browser/renderer_host/mock_render_process_host.cc b/chrome/browser/renderer_host/mock_render_process_host.cc
index e2aaa13..8be0416 100644
--- a/chrome/browser/renderer_host/mock_render_process_host.cc
+++ b/chrome/browser/renderer_host/mock_render_process_host.cc
@@ -37,7 +37,7 @@ bool MockRenderProcessHost::WaitForPaintMsg(int render_widget_id,
return false;
}
-void MockRenderProcessHost::ReceivedBadMessage(uint16 msg_type) {
+void MockRenderProcessHost::ReceivedBadMessage(uint32 msg_type) {
++bad_msg_count_;
}
diff --git a/chrome/browser/renderer_host/mock_render_process_host.h b/chrome/browser/renderer_host/mock_render_process_host.h
index 4550512..aa04651 100644
--- a/chrome/browser/renderer_host/mock_render_process_host.h
+++ b/chrome/browser/renderer_host/mock_render_process_host.h
@@ -38,7 +38,7 @@ class MockRenderProcessHost : public RenderProcessHost {
virtual bool WaitForPaintMsg(int render_widget_id,
const base::TimeDelta& max_delay,
IPC::Message* msg);
- virtual void ReceivedBadMessage(uint16 msg_type);
+ virtual void ReceivedBadMessage(uint32 msg_type);
virtual void WidgetRestored();
virtual void WidgetHidden();
virtual void ViewCreated();
diff --git a/chrome/browser/renderer_host/render_process_host.h b/chrome/browser/renderer_host/render_process_host.h
index 9425949..aad1f83 100644
--- a/chrome/browser/renderer_host/render_process_host.h
+++ b/chrome/browser/renderer_host/render_process_host.h
@@ -173,7 +173,7 @@ class RenderProcessHost : public IPC::Channel::Sender,
IPC::Message* msg) = 0;
// Called when a received message cannot be decoded.
- virtual void ReceivedBadMessage(uint16 msg_type) = 0;
+ virtual void ReceivedBadMessage(uint32 msg_type) = 0;
// Track the count of visible widgets. Called by listeners to register and
// unregister visibility.
diff --git a/chrome/browser/views/about_ipc_dialog.cc b/chrome/browser/views/about_ipc_dialog.cc
index d7ece5d..092106d 100644
--- a/chrome/browser/views/about_ipc_dialog.cc
+++ b/chrome/browser/views/about_ipc_dialog.cc
@@ -88,7 +88,7 @@ struct Settings {
} settings_views = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
-void CreateColumn(uint16 start, uint16 end, HWND hwnd,
+void CreateColumn(uint32 start, uint32 end, HWND hwnd,
CListViewCtrl** control) {
DCHECK(*control == NULL);
*control = new CListViewCtrl(hwnd);
diff --git a/chrome/common/appcache/appcache_dispatcher_host.cc b/chrome/common/appcache/appcache_dispatcher_host.cc
index 854d5d8..f6c316b 100644
--- a/chrome/common/appcache/appcache_dispatcher_host.cc
+++ b/chrome/common/appcache/appcache_dispatcher_host.cc
@@ -188,7 +188,7 @@ void AppCacheDispatcherHost::SwapCacheCallback(bool result, void* param) {
frontend_proxy_.sender()->Send(pending_reply_msg_.release());
}
-void AppCacheDispatcherHost::ReceivedBadMessage(uint16 msg_type) {
+void AppCacheDispatcherHost::ReceivedBadMessage(uint32 msg_type) {
// TODO(michaeln): Consider gathering UMA stats
// http://code.google.com/p/chromium/issues/detail?id=24634
BrowserRenderProcessHost::BadMessageTerminateProcess(
diff --git a/chrome/common/appcache/appcache_dispatcher_host.h b/chrome/common/appcache/appcache_dispatcher_host.h
index 7b04b9c..9ad46fb 100644
--- a/chrome/common/appcache/appcache_dispatcher_host.h
+++ b/chrome/common/appcache/appcache_dispatcher_host.h
@@ -54,7 +54,7 @@ class AppCacheDispatcherHost {
void StartUpdateCallback(bool result, void* param);
void SwapCacheCallback(bool result, void* param);
- void ReceivedBadMessage(uint16 msg_type);
+ void ReceivedBadMessage(uint32 msg_type);
AppCacheFrontendProxy frontend_proxy_;
appcache::AppCacheBackendImpl backend_impl_;
diff --git a/chrome/common/ipc_test_sink.cc b/chrome/common/ipc_test_sink.cc
index c278902..6a0e45b 100644
--- a/chrome/common/ipc_test_sink.cc
+++ b/chrome/common/ipc_test_sink.cc
@@ -26,7 +26,7 @@ const Message* TestSink::GetMessageAt(size_t index) const {
return &messages_[index];
}
-const Message* TestSink::GetFirstMessageMatching(uint16 id) const {
+const Message* TestSink::GetFirstMessageMatching(uint32 id) const {
for (size_t i = 0; i < messages_.size(); i++) {
if (messages_[i].type() == id)
return &messages_[i];
@@ -34,7 +34,7 @@ const Message* TestSink::GetFirstMessageMatching(uint16 id) const {
return NULL;
}
-const Message* TestSink::GetUniqueMessageMatching(uint16 id) const {
+const Message* TestSink::GetUniqueMessageMatching(uint32 id) const {
size_t found_index = 0;
size_t found_count = 0;
for (size_t i = 0; i < messages_.size(); i++) {
diff --git a/chrome/common/ipc_test_sink.h b/chrome/common/ipc_test_sink.h
index 995ae38..ec1e70c 100644
--- a/chrome/common/ipc_test_sink.h
+++ b/chrome/common/ipc_test_sink.h
@@ -63,14 +63,14 @@ class TestSink {
// Returns the first message with the given ID in the queue. If there is no
// message with the given ID, returns NULL. The returned pointer will only be
// valid until another message is received or the list is cleared.
- const Message* GetFirstMessageMatching(uint16 id) const;
+ const Message* GetFirstMessageMatching(uint32 id) const;
// Returns the message with the given ID in the queue. If there is no such
// message or there is more than one of that message, this will return NULL
// (with the expectation that you'll do an ASSERT_TRUE() on the result).
// The returned pointer will only be valid until another message is received
// or the list is cleared.
- const Message* GetUniqueMessageMatching(uint16 id) const;
+ const Message* GetUniqueMessageMatching(uint32 id) const;
private:
// The actual list of received messages.
diff --git a/chrome_frame/sync_msg_reply_dispatcher.h b/chrome_frame/sync_msg_reply_dispatcher.h
index 05e5162..a009fb9 100644
--- a/chrome_frame/sync_msg_reply_dispatcher.h
+++ b/chrome_frame/sync_msg_reply_dispatcher.h
@@ -51,12 +51,12 @@ class SyncMessageReplyDispatcher : public IPC::ChannelProxy::MessageFilter {
protected:
struct MessageSent {
MessageSent() {}
- MessageSent(int id, uint16 type, void* callback, void* key)
+ MessageSent(int id, uint32 type, void* callback, void* key)
: id(id), callback(callback), type(type), key(key) {}
int id;
void* callback;
void* key;
- uint16 type;
+ uint32 type;
};
typedef std::deque<MessageSent> PendingSyncMessageQueue;
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index cce2c03..0d178d5 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -772,7 +772,9 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
reinterpret_cast<int*>(CMSG_DATA(cmsg)));
msgh.msg_controllen = cmsg->cmsg_len;
- msg->header()->num_fds = num_fds;
+ // DCHECK_LE above already checks that
+ // num_fds < MAX_DESCRIPTORS_PER_MESSAGE so no danger of overflow.
+ msg->header()->num_fds = static_cast<uint16>(num_fds);
#if defined(OS_LINUX)
if (!uses_fifo_ &&
diff --git a/ipc/ipc_logging.cc b/ipc/ipc_logging.cc
index b2ee6bd..ac96666 100644
--- a/ipc/ipc_logging.cc
+++ b/ipc/ipc_logging.cc
@@ -157,13 +157,13 @@ void Logging::OnPostDispatchMessage(const Message& message,
}
}
-void Logging::GetMessageText(uint16 type, std::wstring* name,
+void Logging::GetMessageText(uint32 type, std::wstring* name,
const Message* message,
std::wstring* params) {
if (!log_function_mapping_)
return;
- int message_class = type >> 12;
+ int message_class = type >> 16;
if (log_function_mapping_[message_class] != NULL) {
log_function_mapping_[message_class](type, name, message, params);
} else {
diff --git a/ipc/ipc_logging.h b/ipc/ipc_logging.h
index e3bc33e..ad0559b 100644
--- a/ipc/ipc_logging.h
+++ b/ipc/ipc_logging.h
@@ -65,10 +65,10 @@ class Logging {
// Like the *MsgLog functions declared for each message class, except this
// calls the correct one based on the message type automatically. Defined in
// ipc_logging.cc.
- static void GetMessageText(uint16 type, std::wstring* name,
+ static void GetMessageText(uint32 type, std::wstring* name,
const Message* message, std::wstring* params);
- typedef void (*LogFunction)(uint16 type,
+ typedef void (*LogFunction)(uint32 type,
std::wstring* name,
const Message* msg,
std::wstring* params);
diff --git a/ipc/ipc_message.cc b/ipc/ipc_message.cc
index 8b608b6..7e5b77b 100644
--- a/ipc/ipc_message.cc
+++ b/ipc/ipc_message.cc
@@ -27,7 +27,7 @@ Message::Message()
InitLoggingVariables();
}
-Message::Message(int32 routing_id, uint16 type, PriorityValue priority)
+Message::Message(int32 routing_id, uint32 type, PriorityValue priority)
: Pickle(sizeof(Header)) {
header()->routing = routing_id;
header()->type = type;
@@ -121,4 +121,4 @@ void Message::EnsureFileDescriptorSet() {
#endif
-} // namespace IPC
+} // namespace IPC \ No newline at end of file
diff --git a/ipc/ipc_message.h b/ipc/ipc_message.h
index 6357c0b..8268fce 100644
--- a/ipc/ipc_message.h
+++ b/ipc/ipc_message.h
@@ -58,7 +58,7 @@ class Message : public Pickle {
// Initialize a message with a user-defined type, priority value, and
// destination WebView ID.
- Message(int32 routing_id, uint16 type, PriorityValue priority);
+ Message(int32 routing_id, uint32 type, PriorityValue priority);
// Initializes a message from a const block of data. The data is not copied;
// instead the data is merely referenced by this message. Only const methods
@@ -117,7 +117,7 @@ class Message : public Pickle {
return (header()->flags & PUMPING_MSGS_BIT) != 0;
}
- uint16 type() const {
+ uint32 type() const {
return header()->type;
}
@@ -216,13 +216,13 @@ class Message : public Pickle {
HAS_SENT_TIME_BIT = 0x0080,
};
-#pragma pack(push, 2)
+#pragma pack(push, 4)
struct Header : Pickle::Header {
int32 routing; // ID of the view that this message is destined for
- uint16 type; // specifies the user-defined message type
- uint16 flags; // specifies control flags for the message
+ uint32 type; // specifies the user-defined message type
+ uint32 flags; // specifies control flags for the message
#if defined(OS_POSIX)
- uint32 num_fds; // the number of descriptors included with this message
+ uint16 num_fds; // the number of descriptors included with this message
#endif
};
#pragma pack(pop)
@@ -273,7 +273,7 @@ enum SpecialRoutingIDs {
MSG_ROUTING_CONTROL = kint32max,
};
-#define IPC_REPLY_ID 0xFFF0 // Special message id for replies
-#define IPC_LOGGING_ID 0xFFF1 // Special message id for logging
+#define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies
+#define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging
#endif // IPC_IPC_MESSAGE_H__
diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h
index ba2a10a..e46ab12 100644
--- a/ipc/ipc_message_macros.h
+++ b/ipc/ipc_message_macros.h
@@ -145,8 +145,8 @@
// Do label##PreStart so that automation messages keep the same id as before.
#define IPC_BEGIN_MESSAGES(label) \
enum label##MsgType { \
- label##Start = label##MsgStart << 12, \
- label##PreStart = (label##MsgStart << 12) - 1,
+ label##Start = label##MsgStart << 16, \
+ label##PreStart = (label##MsgStart << 16) - 1,
#define IPC_END_MESSAGES(label) \
label##End \
@@ -387,7 +387,7 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \
#ifndef IPC_LOG_TABLE_CREATED
#define IPC_LOG_TABLE_CREATED
-typedef void (*LogFunction)(uint16 type,
+typedef void (*LogFunction)(uint32 type,
std::wstring* name,
const IPC::Message* msg,
std::wstring* params);
@@ -397,7 +397,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
#define IPC_BEGIN_MESSAGES(label) \
- void label##MsgLog(uint16 type, std::wstring* name, const IPC::Message* msg, std::wstring* params) { \
+ void label##MsgLog(uint32 type, std::wstring* name, const IPC::Message* msg, std::wstring* params) { \
switch (type) {
#define IPC_END_MESSAGES(label) \
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index fd0c064..114ec25 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -45,11 +45,9 @@ enum IPCMessageStart {
WorkerMsgStart,
WorkerHostMsgStart,
NaClProcessMsgStart,
+ //CommandBufferMsgStart,
// NOTE: When you add a new message class, also update
// IPCStatusView::IPCStatusView to ensure logging works.
- // NOTE: this enum is used by IPC_MESSAGE_MACRO to generate a unique message
- // id. Only 4 bits are used for the message type, so if this enum needs more
- // than 16 entries, that code needs to be updated.
LastMsgIndex
};
@@ -782,7 +780,7 @@ struct ParamTraits<XFORM> {
struct LogData {
std::string channel;
int32 routing_id;
- uint16 type; // "User-defined" message type, from ipc_message.h.
+ uint32 type; // "User-defined" message type, from ipc_message.h.
std::wstring flags;
int64 sent; // Time that the message was sent (i.e. at Send()).
int64 receive; // Time before it was dispatched (i.e. before calling
@@ -978,7 +976,7 @@ class MessageWithTuple : public Message {
typedef ParamType Param;
typedef typename ParamType::ParamTuple RefParam;
- MessageWithTuple(int32 routing_id, uint16 type, const RefParam& p)
+ MessageWithTuple(int32 routing_id, uint32 type, const RefParam& p)
: Message(routing_id, type, PRIORITY_NORMAL) {
WriteParam(this, p);
}
@@ -1142,7 +1140,7 @@ class MessageWithReply : public SyncMessage {
typedef typename SendParam::ParamTuple RefSendParam;
typedef ReplyParamType ReplyParam;
- MessageWithReply(int32 routing_id, uint16 type,
+ MessageWithReply(int32 routing_id, uint32 type,
const RefSendParam& send, const ReplyParam& reply)
: SyncMessage(routing_id, type, PRIORITY_NORMAL,
new ParamDeserializer<ReplyParam>(reply)) {
diff --git a/ipc/ipc_sync_message.cc b/ipc/ipc_sync_message.cc
index 519adb1..23f3d16 100644
--- a/ipc/ipc_sync_message.cc
+++ b/ipc/ipc_sync_message.cc
@@ -22,7 +22,7 @@ base::WaitableEvent* dummy_event = new base::WaitableEvent(true, true);
SyncMessage::SyncMessage(
int32 routing_id,
- uint16 type,
+ uint32 type,
PriorityValue priority,
MessageReplyDeserializer* deserializer)
: Message(routing_id, type, priority),
diff --git a/ipc/ipc_sync_message.h b/ipc/ipc_sync_message.h
index 5d072a7..37c6c71 100644
--- a/ipc/ipc_sync_message.h
+++ b/ipc/ipc_sync_message.h
@@ -22,7 +22,7 @@ class MessageReplyDeserializer;
class SyncMessage : public Message {
public:
- SyncMessage(int32 routing_id, uint16 type, PriorityValue priority,
+ SyncMessage(int32 routing_id, uint32 type, PriorityValue priority,
MessageReplyDeserializer* deserializer);
// Call this to get a deserializer for the output parameters.