[webkit-reviews] review granted: [Bug 27777] ImageSourceCG makes bad data refs (race condition causes blank images) : [Attachment 33674] Patch to fix (ref/deref backing data)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 28 15:12:21 PDT 2009


Darin Adler <darin at apple.com> has granted Avi Drissman <avi at drissman.com>'s
request for review:
Bug 27777: ImageSourceCG makes bad data refs (race condition causes blank
images)
https://bugs.webkit.org/show_bug.cgi?id=27777

Attachment 33674: Patch to fix (ref/deref backing data)
https://bugs.webkit.org/attachment.cgi?id=33674&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
> +void SharedBufferDerefCallback(void*, void* info)

Function names should start with a lowercase letter. Since this is private to
this source file it should use "static" to get internal linkage.

> +    SharedBuffer* sharedBuffer = reinterpret_cast<SharedBuffer*>(info);

This should be static_cast, which can convert a void* to a specific pointer
type.

> +    data->ref();
> +    CFAllocatorContext context = {0, data, 0, 0, 0, 0, 0,
SharedBufferDerefCallback, 0};
> +    CFAllocatorRef derefAllocator = CFAllocatorCreate(kCFAllocatorDefault,
&context);
> +    CFDataRef cfData = CFDataCreateWithBytesNoCopy(0, reinterpret_cast<const
UInt8*>(data->data()), data->size(), derefAllocator);
> +    CFRelease(derefAllocator);

Creating a unique allocator each time is unfortunate, but I can't think of any
better idea.

r=me but the style issues I mention above should be fixed


More information about the webkit-reviews mailing list