Bug 1264398 - Avoid extra assign() on windows in IPC code (r=jld)
authorBill McCloskey <billm@mozilla.com>
Wed, 13 Apr 2016 16:45:37 -0700
changeset 331193 526423ac534375444a91f738338dea94d5793003
parent 331192 3b1fae9003385c071dab0e07b6048a3f831a198f
child 331194 d1c487cc4ef287f33f6e92779dcf8c2247197226
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjld
bugs1264398
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1264398 - Avoid extra assign() on windows in IPC code (r=jld)
ipc/chromium/src/chrome/common/ipc_channel_win.cc
--- a/ipc/chromium/src/chrome/common/ipc_channel_win.cc
+++ b/ipc/chromium/src/chrome/common/ipc_channel_win.cc
@@ -430,17 +430,21 @@ bool Channel::ChannelImpl::ProcessIncomi
           listener_->OnMessageReceived(mozilla::Move(m));
         }
         p = message_tail;
       } else {
         // Last message is partial.
         break;
       }
     }
-    input_overflow_buf_.assign(p, end - p);
+    if (p != input_overflow_buf_.data()) {
+      // Don't assign unless we have to since this will throw away any memory we
+      // might have reserved.
+      input_overflow_buf_.assign(p, end - p);
+    }
 
     bytes_read = 0;  // Get more data.
   }
 
   return true;
 }
 
 bool Channel::ChannelImpl::ProcessOutgoingMessages(