Make sure that the UI window created by base::MessagePumpForUI is destoyed on the same thread (Windows).

Currently the window created base::MessagePumpForUI can be destroyed on a wrong thread. base::MessagePumpForUI is a ref-counted class so it can (and does) outlive the owning base::MessageLoop. As the result DestroyWindow() can be called on a wrong thread. This makes TSAN unhappy and it reports races deep unside user32.dll.

Changes in this CL:
- The message pump is now notified when the owning message loop is being destroyed. The notification is used to free all resources that hve to be released on the base::MessageLoop's thread.
- MessagePumpForUI::ScheduleWork() synchronizes access to the message-only window handle to avoid posting messages to the window during or after its destruction.

BUG=241939

Review URL: https://chromiumcodereview.appspot.com/15709015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207278 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: 002414c002a132b67937869d52aeb85a0547b639
10 files changed
tree: 371fb1b7e579b033c27356d7821bb44b59a0c784
  1. base/
  2. build/
  3. dbus/
  4. ipc/
  5. testing/
  6. third_party/