Summary: | XMLHttpRequest needs to have the static defines made threadsafe. | ||
---|---|---|---|
Product: | WebKit | Reporter: | David Levin <levin> |
Component: | XML | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | ap |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | All | ||
OS: | All | ||
Attachments: |
Description
David Levin
2008-11-26 20:41:45 PST
Created attachment 25548 [details]
Removes the non-thread safe static initializations in XMLHttpRequest.cpp
Created attachment 25555 [details]
Very minor adjustment to the last patch (-- moves one brace for style purposes).
Hmm... The patch is executed perfectly, but I think that it may be over-engineered a bit. I don't see how having classes for each function helps - is it better than just protecting initialization parts of these functions with a mutex? Created attachment 25566 [details]
Changed the static initialization to happen in the XHR constructor.
I didn't like doing a mutex in the functions due to one of them being called inside of a loop. As discussed, I've tried out a solution that initializes the static variables in the constructor. I looked at a few ways of doing this. The reason I put the variables in a struct and then initialized into a local static was to take advantage of AtomicallyInitializedStatic.
If this doesn't seem that great, one alternative I can think of is to create another macro like AtomicallyInitializedStatic (in threading.h) that allowed me to call a function inside of this same mutex.
Created attachment 25568 [details]
Another revision. I think it is close.
Comment on attachment 25568 [details]
Another revision. I think it is close.
r=me
Committed revision 38827. I made a slight tweak I didn't think about earlier: made the global const. |