GpuChannelHost: allocate route IDs on the client (renderer) side.

This avoids a timing-sensitive bug where the pattern of non-Host-allocated
route IDs are in conflict with non-Host-initiated-first-IPC.

BUG=360276
TEST=trybot and manual testing.
[email protected], [email protected], [email protected]

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262553 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/common/message_router.cc b/content/common/message_router.cc
index f73e654..469d85e9 100644
--- a/content/common/message_router.cc
+++ b/content/common/message_router.cc
@@ -26,8 +26,13 @@
   return false;
 }
 
-void MessageRouter::AddRoute(int32 routing_id, IPC::Listener* listener) {
+bool MessageRouter::AddRoute(int32 routing_id, IPC::Listener* listener) {
+  if (routes_.Lookup(routing_id)) {
+    DLOG(ERROR) << "duplicate routing ID";
+    return false;
+  }
   routes_.AddWithID(listener, routing_id);
+  return true;
 }
 
 void MessageRouter::RemoveRoute(int32 routing_id) {