Ensure that a listener's OnChannelConnected is called before OnMessageReceived.

A race condition existed since the listener thread could dispatch messages in two ways: a task being posted to it, or because the dispatch messages event is set.  The latter is needed to avoid deadlock when multiple SyncChannels are used on the same listener thread.  If the latter method was used to dispatch a message, it might occur before the task that calls OnChannelConnected gets run.

The fix is to call OnChannelConnected manually if we notice a message is being dispatched before it's called.

Note: I couldn't think of a way to test this since it depends on a race condition in the listener message looop (whether the task or objectwatcher gets run first).

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

git-svn-id: svn://svn.chromium.org/chrome/trunk@11522 0039d316-1c4b-4281-b951-d872f2087c98
3 files changed
tree: d0b1d46bc0c17fd4d8e452fdc49c4100667ee0e9
  1. depot_tools/
  2. deps/
  3. src/
  4. tools/