DescriptionFixed the racy code around the message-only window in base::MessagePumpForUI on Windows.
The current implementation of base::MessagePumpForUI has a couple of problems:
- A window class registered for the message-only window has a predefined name. This leads to issues like registering the same class multiple times or unregistering it prematurely.
- base::MessagePumpForUI is a ref-counted class and can be destroyed on a different thread. As the result DestroyWindow() can be called on a wrong thread.
This CL introduces the following changes to address the above problems:
- MessageWindow is used to create the message-only window in base::MessagePumpForUI. This class registers a unique window class name for every window to make sure multiple message-only windows can exist at the same time. The implementation of MessageWindow is moved to src/base/win along with the corresponding unit test.
- 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
Patch Set 1 #Patch Set 2 : - #
Total comments: 4
Patch Set 3 : synchronizing without a lock #
Total comments: 11
Patch Set 4 : - #
Total comments: 9
Messages
Total messages: 20 (0 generated)
|