[Merge 2403] Fix a race where backgroud page might ack an event before we're ready     to receive the ack on browser/.
[Merge 2403] Fix a race where backgroud page might ack an event before we're ready
    to receive the ack on browser/.

We perform a sanity check upon background page ACKing an event,
    by checking whether the ACKed message is expected to
    be ACKed. We store the pending ACK message IDs into a set
    |unacked_messages_|, but due to PostTask call to
    IncrementInFlightEventsOnUI, the event ack might arrive earlier
    than storing the pending message's ID. This results in incorectly
    kill the renderer process.

TBR=lazyboy@chromium.org
BUG=485440, 473821
Test=Rise Vision chrome app shouldn't crash anymore.

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

Cr-Commit-Position: refs/heads/master@{#330301}
(cherry picked from commit b2eaaaf0e87f56751783dbc6cab13827375ce847)

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

Cr-Commit-Position: d34a0005849006230ae7ffb1a9693419810a06bc@{#138}
Cr-Branched-From: 40cda19e609fd36fbf5fe489055423e611631abc@{#330231}

PeterWangIntel/chromium-crosswalk,Fireblend/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,Fireblend/chromium-crosswalk,Fireblend/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,Fireblend/chromium-crosswalk,Fireblend/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,Fireblend/chromium-crosswalk,Fireblend/chromium-crosswalk,Fireblend/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,Fireblend/chromium-crosswalk