[OpenJDK 2D-Dev] [14] RFR JDK-8235147: Release HDC from passiveDCList sooner

Alexey Ivanov alexey.ivanov at oracle.com
Mon Dec 2 10:45:20 UTC 2019


Hi Sergey,

On 02/12/2019 05:39, Sergey Bylokhov wrote:
> Hi, Alexey.
>
> Do we really need to pass passiveDCList everywhere, this is the only 
> one passive list?

I'm not sure. Yes, there's only one passive list. Yet there's also 
active list which is used with ReleaseDCList.

> I guess we can remove other methods which use hwnd, like 
> "RemoveAllDCs(HWND hWnd)"?

No, we can't. This version is used to release DC from active list:
1413             ReleaseDCList(GetHWnd(), activeDCList);

And the version with HWND is used in MoveDCToPassiveList:
7469     if ((removedDC = activeDCList.RemoveDC(hDC, hWnd)) != NULL) {


We can have two different functions though:
ReleaseActiveDCs(HWND);
ReleasePassiveDCs();

Then we can drop the list parameter.
What do you think?

>
> On 12/1/19 7:04 am, Alexey Ivanov wrote:
>> Hello,
>>
>> Please review the following fix for JDK:
>>
>> JBS: https://bugs.openjdk.java.net/browse/JDK-8235147
>> Webrev: http://cr.openjdk.java.net/~aivanov/8235147/webrev.00/
>>
>>
>> When a DC becomes unused, it is moved from activeDCList to 
>> passiveDCList to be released later. It will stay in the passiveDCList 
>> until a new DC is requested for the same window or the window is 
>> destroyed.
>>
>> The DCs in passiveDCList will never be used again, so we can release 
>> them as soon as another request for a DC comes in.
>>
>> The test case, ManyFramesTest.java, attached to the bug creates and 
>> displays 10 frames. Then it hides the 9 frames. At this point, 
>> passiveDCList contains 9 entries. These DCs will not be released 
>> until the corresponding frame is shown and painted again or the frame 
>> is destroyed.
>>
>>
>> The fix releases all DCs currently in passiveDCList when another DC 
>> is requested.
>> With the fix, when running ManyFramesTest.java test case, the number 
>> of entries in passiveDCList does not grow, the list contains at most 
>> 1 entry.
>>
>> Mach5 for client tests is green.
>>
-- 
Regards,
Alexey


More information about the 2d-dev mailing list