Fix memory leak if user of IPC::SyncMessage never calls GetReplyDeserializer().

This isn't a problem for most real code, because SyncChannel and SyncMessageFilter do it for you. It shows up in ppapi_unittests (and presumably any other tests that rely on IPC::TestSink).

Also removed some code that worked around the problem.

Bonus: Allow running ppapi_unittests in tools/valgrind/chrome_tests.py.

BUG=90240
TEST=valgrind trybots

Review URL: http://codereview.chromium.org/7831060

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100496 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ipc/ipc_sync_message.h b/ipc/ipc_sync_message.h
index 2c6ed8b..087df0d 100644
--- a/ipc/ipc_sync_message.h
+++ b/ipc/ipc_sync_message.h
@@ -11,6 +11,7 @@
 #endif
 #include <string>
 #include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
 #include "ipc/ipc_message.h"
 
 namespace base {
@@ -25,6 +26,7 @@
  public:
   SyncMessage(int32 routing_id, uint32 type, PriorityValue priority,
               MessageReplyDeserializer* deserializer);
+  virtual ~SyncMessage();
 
   // Call this to get a deserializer for the output parameters.
   // Note that this can only be called once, and the caller is responsible
@@ -76,7 +78,7 @@
   static bool ReadSyncHeader(const Message& msg, SyncHeader* header);
   static bool WriteSyncHeader(Message* msg, const SyncHeader& header);
 
-  MessageReplyDeserializer* deserializer_;
+  scoped_ptr<MessageReplyDeserializer> deserializer_;
   base::WaitableEvent* pump_messages_event_;
 };