The message framework is the encapsulation and extension of the messaging loop,chromium the work of handling internal tasks in the message loop. With the internal work processing parasitic in the Windows message loop, there is a problem that there is no Windows self-message, and chromium internal work, when the internal actions can not be processed in time. Chromium this defines a custom message kmsghavework that is used to drive windows when there is work inside the chromium.
From the code level, the Chromium internal work queue is plugged into work when a kmsghavework message is post.
The news of the planned work is post in Schedulework.
The Message framework Pseudo-code is the following example:
1 for(;;)2 { 3 //1. Message Loops4 if(PeekMessage ())5 {6 //1.1 added the dispatcher for the response7 if(Dispatcher)8 {9Dispatcher->Dispatch ();Ten } One Else A { - TranslateMessage (); - DispatchMessage (); the } - } - //2. Internal work - DoWork (); + //3. Internal delay work - dodelaywork (); + //4. Internal idle work A doidlework (); at //5. Waiting for a message - waitmessage (); -}
Chromium's message pump (messaging pump) is a more rigorous, granular loop, in order to secure the external access to this loop, Chromium uses delegation mode and is derived from Messageloop. The internal "work" processing can be achieved by using the Messageloop class only.
messagepump Message pump abstract base class nested class Delegate delegate class provides external use.
Messagepumpwin message Pump implementation class Nested classes have observer observer classes and dispatcher distribution classes.
Messageloop is a derived class of the delegate delegate class.
General understanding, and so later used to detailed analysis.
1.4. Chromium source Code Analysis-chromiumframe-Message series