crosswalk-project/crosswalk — pull request #1281 by ricardotk (2013-12-09 13:07:16+00:00)
Title: [Extensions] Fix race condition in EPH, fix flaky CloseNativeWindow

The message filter used by EPH in certain conditions could try to post a
task to UI thread calling EPH. If EPH is destroyed and the message is
still enqueued, we crash.

The MessageFilter was posting a task instead of directly calling in IO
thread because EPH was trying to remove the filter, since we need to
track that message only once. Removing the filter should be called from
the UI thread (which is the "client" thread for IPC::SyncChannel).

This patch makes the code correct, removing the flaky crashes in
CloseNativeWindow browsertest. Next patches will address the TODO item
added by this patch: whether we can use only one MessageFilter.

I split the code this way so we choose whether we apply just this fix to
the current Beta branch or the remaining changes.

BUG=https://crosswalk-project.org/jira/browse/XWALK-153