Make the serialization of IPC::Messages inside other IPC::Messages independent
of the platform.

This is necessary for sending nested messages between nacl (which the IPC
system thinks is posix and so has extra header goo) and a Windows client app
(which doesn't have this stuff).

BUG=

Review URL: https://chromiumcodereview.appspot.com/10667002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144840 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ipc/ipc_message.cc b/ipc/ipc_message.cc
index feec91ab..9908bc7 100644
--- a/ipc/ipc_message.cc
+++ b/ipc/ipc_message.cc
@@ -67,6 +67,15 @@
   return *this;
 }
 
+void Message::SetHeaderValues(int32 routing, uint32 type, uint32 flags) {
+  // This should only be called when the message is already empty.
+  DCHECK(payload_size() == 0);
+
+  header()->routing = routing;
+  header()->type = type;
+  header()->flags = flags;
+}
+
 #ifdef IPC_MESSAGE_LOG_ENABLED
 void Message::set_sent_time(int64 time) {
   DCHECK((header()->flags & HAS_SENT_TIME_BIT) == 0);
@@ -116,6 +125,10 @@
   return descriptor->fd >= 0;
 }
 
+bool Message::HasFileDescriptors() const {
+  return file_descriptor_set_.get() && !file_descriptor_set_->empty();
+}
+
 void Message::EnsureFileDescriptorSet() {
   if (file_descriptor_set_.get() == NULL)
     file_descriptor_set_ = new FileDescriptorSet;