Closed Bug 504034 Opened 16 years ago Closed 16 years ago

RgnRectMemoryAllocator fails thread-safety assertions even when used only on non-main thread

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: cjones, Assigned: cjones)

References

Details

Attachments

(1 file, 2 obsolete files)

RgnRectMemoryAllocator wants to run only on a single thread, presumably so that it can avoid locking overhead. It does this by saving the thread on which it was created and asserting that its methods are only invoked on that thread. The use of RgnRectMemoryAllocator in nsRegion presents a problem, however. nsRegion uses a static RgnRectMemoryAllocator, which is thus always initialized on the main thread. This means that embedders who want to use libxul on a thread that's not main have to deal with heaps of assertion failure errors, even though that code is only being used on that non-main thread. Electrolysis is one such embedder. I don't know the best way to solve this issue. I'll go fishing with my first patch.
I'm using this patch in Electrolysis by invoking it when our "Gecko" thread is initialized in the child process.
Attachment #388426 - Flags: review?(vladimir)
Corrected to bz's original idea.
Attachment #388426 - Attachment is obsolete: true
Attachment #388433 - Flags: review?(vladimir)
Attachment #388426 - Flags: review?(vladimir)
So if that works... why not just make this heap-allocated (via new) from inside gfxPlatform::Init()?
(In reply to comment #3) > So if that works... why not just make this heap-allocated (via new) from inside > gfxPlatform::Init()? Two potential problems ... first, another statically-initialized variable is using RgnRectMemoryAllocator (potential tar baby in fixing that). Second, changing when this mini-heap is allocated might cause some obscure performance issue. What gfx performance tests should I look at to see if this change is detrimental?
Huh. What's the other variable?
Attachment #388433 - Attachment is obsolete: true
Attachment #388552 - Flags: review?(vladimir)
Attachment #388433 - Flags: review?(vladimir)
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Depends on: 515595
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: