[webkit-reviews] review requested: [Bug 22720] Make XMLHttpRequest work in Workers : [Attachment 27070] Part 5a: Add the GenericWorkTask infrastructure needed for WorkerThreadableLoader.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 27 02:29:07 PST 2009


David Levin <levin at chromium.org> has asked  for review:
Bug 22720: Make XMLHttpRequest work in Workers
https://bugs.webkit.org/show_bug.cgi?id=22720

Attachment 27070: Part 5a: Add the GenericWorkTask infrastructure needed for
WorkerThreadableLoader.
https://bugs.webkit.org/attachment.cgi?id=27070&action=review

------- Additional Comments from David Levin <levin at chromium.org>
Addressed these comments from part 5:

> > +		 return !m_messagingProxy ||
!m_messagingProxy->askedToTerminate();
> For tasks that do not need MessageProxy to operate, it's better not to have
it in the structure at all.

> > +	 template<typename T> struct CrossThreadAdapter { static T& adapt(T&
parameter) { return parameter; } };
> > +	 template<> struct CrossThreadAdapter<String> { static String
adapt(String&
parameter) { return parameter.copy(); } };

> Can this be made to fail on unknown types? I think you'd need specializations

> for all integral types that can be copied directly, but there aren't too many

> in C++.

I wish I had is_enum.  I couldn't figure out any easy way to do it -- (fwiw,
boost has one so it is possible).  Without is_enum, I had to include files that
had enum's and create specializations for each enum that are used.

In order to make the copying just work, I had to be able to modify the type
being returned from adapt (due to ResourceRequest becoming
auto_ptr<CrossThreadresourceRequestData>).

Along these same lines, different type needed to be treated differently in the
static create constructor.  Ideally they could all be const T& but that doesn't
work for auto_ptr which needs to avoid const, but T& doesn't work for returned
types (from adapt), so auto_ptr<> needs to be passed in as a auto_ptr<>.

Similar things happened for other types with the goal being to avoid doing an
expensive/complex copy during this process.


More information about the webkit-reviews mailing list