Bug 61536 - [Chromium] Add missing compile guards for WebWorkers in WebKit
Summary: [Chromium] Add missing compile guards for WebWorkers in WebKit
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Leandro Graciá Gil
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-26 08:46 PDT by Leandro Graciá Gil
Modified: 2012-09-19 07:22 PDT (History)
4 users (show)

See Also:


Attachments
Patch (9.82 KB, patch)
2011-05-26 10:01 PDT, Leandro Graciá Gil
no flags Details | Formatted Diff | Diff
Patch (9.96 KB, patch)
2011-05-26 12:06 PDT, Leandro Graciá Gil
no flags Details | Formatted Diff | Diff
Patch (9.97 KB, patch)
2011-05-26 12:13 PDT, Leandro Graciá Gil
no flags Details | Formatted Diff | Diff
Patch (10.09 KB, patch)
2011-05-26 12:28 PDT, Leandro Graciá Gil
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Leandro Graciá Gil 2011-05-26 08:46:07 PDT
Some files in WebKit Chromium lack the appropriate #if ENABLED(WORKERS). This causes some files to fail when compiling if this feature is disabled.
Comment 1 Leandro Graciá Gil 2011-05-26 10:01:05 PDT
Created attachment 94992 [details]
Patch
Comment 2 Dmitry Titov 2011-05-26 11:22:30 PDT
Comment on attachment 94992 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=94992&action=review

Great! Couple of comments, lets do another iteration:

> Source/WebKit/chromium/src/DatabaseObserver.cpp:71
> +        return false;

Lets add ASSERT_NOT_REACHED() here, to document that we don't expect any other case but Document in this case.

> Source/WebKit/chromium/src/LocalFileSystemChromium.cpp:101
> +        allowed = false;

Same as above, ASSERT_NOT_REACHED() could be useful here.

> Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp:96
> +    m_callbacks->didOpenFileSystem(name, AsyncFileSystemChromium::create(m_type, path));

This duplicates a line of code... By placing #if/#endif around if/else, it's possible to avoid that.
Comment 3 Leandro Graciá Gil 2011-05-26 11:38:05 PDT
Comment on attachment 94992 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=94992&action=review

>> Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp:96
>> +    m_callbacks->didOpenFileSystem(name, AsyncFileSystemChromium::create(m_type, path));
> 
> This duplicates a line of code... By placing #if/#endif around if/else, it's possible to avoid that.

Yes, but it may introduce style errors in the bots that don't enable workers. If you think this is ok I'll be happy to fix it like you propose.
Comment 4 David Levin 2011-05-26 11:49:13 PDT
Comment on attachment 94992 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=94992&action=review

>>> Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp:96
>>> +    m_callbacks->didOpenFileSystem(name, AsyncFileSystemChromium::create(m_type, path));
>> 
>> This duplicates a line of code... By placing #if/#endif around if/else, it's possible to avoid that.
> 
> Yes, but it may introduce style errors in the bots that don't enable workers. If you think this is ok I'll be happy to fix it like you propose.

This could do 

OwnPtr<WebFileSystemCallbacksImpl> callbacks(this);

#if
if (m_context && m_context->isWorkerContext()) {
       m_callbacks->didOpenFileSystem(name, WorkerAsyncFileSystemChromium::create(m_context, m_type, path, m_synchronous));
   return;
}
#endif
m_callbacks->didOpenFileSystem(name, AsyncFileSystemChromium::create(m_type, path));

which addresses both issues.
Comment 5 Leandro Graciá Gil 2011-05-26 12:06:01 PDT
Created attachment 95015 [details]
Patch
Comment 6 Leandro Graciá Gil 2011-05-26 12:08:50 PDT
Comment on attachment 94992 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=94992&action=review

>> Source/WebKit/chromium/src/DatabaseObserver.cpp:71
>> +        return false;
> 
> Lets add ASSERT_NOT_REACHED() here, to document that we don't expect any other case but Document in this case.

Fixed.

>> Source/WebKit/chromium/src/LocalFileSystemChromium.cpp:101
>> +        allowed = false;
> 
> Same as above, ASSERT_NOT_REACHED() could be useful here.

Fixed.

>>>> Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp:96
>>>> +    m_callbacks->didOpenFileSystem(name, AsyncFileSystemChromium::create(m_type, path));
>>> 
>>> This duplicates a line of code... By placing #if/#endif around if/else, it's possible to avoid that.
>> 
>> Yes, but it may introduce style errors in the bots that don't enable workers. If you think this is ok I'll be happy to fix it like you propose.
> 
> This could do 
> 
> OwnPtr<WebFileSystemCallbacksImpl> callbacks(this);
> 
> #if
> if (m_context && m_context->isWorkerContext()) {
>        m_callbacks->didOpenFileSystem(name, WorkerAsyncFileSystemChromium::create(m_context, m_type, path, m_synchronous));
>    return;
> }
> #endif
> m_callbacks->didOpenFileSystem(name, AsyncFileSystemChromium::create(m_type, path));
> 
> which addresses both issues.

Thanks for the suggestion! Fixed.

However I just realized a compile error here when uploading the patch. Give me a minute and I'll fix it.
Comment 7 Leandro Graciá Gil 2011-05-26 12:13:06 PDT
Created attachment 95018 [details]
Patch

Fixing build error caused for not using adoptPtr.
Comment 8 Dmitry Titov 2011-05-26 12:22:51 PDT
Comment on attachment 95018 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=95018&action=review

One small thing:

> Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp:99
>      delete this;

I think this 'delete' is not needed now since there is OwnPtr for 'this'... While at this, lets add a comment to the OwnPtr about this object self-deleting on exit, to make it more explicit.
Comment 9 Leandro Graciá Gil 2011-05-26 12:28:01 PDT
Created attachment 95020 [details]
Patch

Performing review fixes.
Comment 10 Leandro Graciá Gil 2011-05-26 12:28:26 PDT
Comment on attachment 95018 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=95018&action=review

>> Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp:99
>>      delete this;
> 
> I think this 'delete' is not needed now since there is OwnPtr for 'this'... While at this, lets add a comment to the OwnPtr about this object self-deleting on exit, to make it more explicit.

Done.
Comment 11 Dmitry Titov 2011-05-26 13:04:14 PDT
Comment on attachment 95020 [details]
Patch

You could just always do cq? with r? if you intend to use commit queue. Reviewer can flip both at one step if appropriate then.
Comment 12 Leandro Graciá Gil 2011-05-26 13:56:25 PDT
(In reply to comment #11)
> (From update of attachment 95020 [details])
> You could just always do cq? with r? if you intend to use commit queue. Reviewer can flip both at one step if appropriate then.

I will, at least once the code seems ready to pass.
Thanks for the advice.
Comment 13 WebKit Commit Bot 2011-05-26 19:21:11 PDT
The commit-queue encountered the following flaky tests while processing attachment 95020 [details]:

inspector/debugger/debugger-scripts.html bug 59921 (authors: pfeldman@chromium.org and podivilov@chromium.org)
The commit-queue is continuing to process your patch.
Comment 14 WebKit Commit Bot 2011-05-26 19:22:51 PDT
Comment on attachment 95020 [details]
Patch

Clearing flags on attachment: 95020

Committed r87463: <http://trac.webkit.org/changeset/87463>
Comment 15 WebKit Commit Bot 2011-05-26 19:22:57 PDT
All reviewed patches have been landed.  Closing bug.