[mojo] Use base::Pickle for Message storage.

This CL modifies the mojo::Message implementation so that
its storage is always backed by a base::Pickle.

Part of a series of changes to support custom mojom serialization:

  1. https://codereview.chromium.org/1515423002
  2. https://codereview.chromium.org/1517043004
  3. https://codereview.chromium.org/1524693002
  4. https://codereview.chromium.org/1520153002
  5. This CL
  6. https://codereview.chromium.org/1526533002
  7. https://codereview.chromium.org/1524703002

BUG=569669

Review URL: https://codereview.chromium.org/1524613002

Cr-Commit-Position: refs/heads/master@{#365766}
diff --git a/base/pickle.h b/base/pickle.h
index 72b33ddc..8e82c62 100644
--- a/base/pickle.h
+++ b/base/pickle.h
@@ -258,6 +258,13 @@
   // of the header.
   void Resize(size_t new_capacity);
 
+  // Claims |num_bytes| bytes of payload. This is similar to Reserve() in that
+  // it may grow the capacity, but it also advances the write offset of the
+  // pickle by |num_bytes|. Claimed memory, including padding, is zeroed.
+  //
+  // Returns the address of the first byte claimed.
+  void* ClaimBytes(size_t num_bytes);
+
   // Find the end of the pickled data that starts at range_start.  Returns NULL
   // if the entire Pickle is not found in the given data range.
   static const char* FindNext(size_t header_size,
@@ -299,6 +306,8 @@
     WriteBytesStatic<sizeof(data)>(&data);
     return true;
   }
+
+  inline void* ClaimUninitializedBytesInternal(size_t num_bytes);
   inline void WriteBytesCommon(const void* data, size_t length);
 
   FRIEND_TEST_ALL_PREFIXES(PickleTest, DeepCopyResize);