Bug 32724 - [Qt] It should be possible to disable inspector
Summary: [Qt] It should be possible to disable inspector
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-18 10:53 PST by Ismail Donmez
Modified: 2010-02-16 03:10 PST (History)
5 users (show)

See Also:


Attachments
proposed patch (7.07 KB, patch)
2009-12-29 20:50 PST, Laszlo Gombos
no flags Details | Formatted Diff | Diff
Patch to add missing ifdef for the disabled inspector case (1.29 KB, patch)
2010-02-05 10:24 PST, Ismail Donmez
no flags Details | Formatted Diff | Diff
Patch to add missing ifdef for the disabled inspector case (add the semicolon to make it compile!) (1.29 KB, patch)
2010-02-05 10:26 PST, Ismail Donmez
no flags Details | Formatted Diff | Diff
Patch against latest SVN, fix new compilation failures (3.48 KB, patch)
2010-02-16 01:53 PST, Ismail Donmez
pfeldman: review+
Details | Formatted Diff | Diff
Surround the functions with a ifdef block, this is simpler (2.60 KB, patch)
2010-02-16 02:21 PST, Ismail Donmez
no flags Details | Formatted Diff | Diff
Simplify the patch (2.73 KB, patch)
2010-02-16 02:52 PST, Ismail Donmez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ismail Donmez 2009-12-18 10:53:51 PST
If you disable inspector in Platform.h via

#define ENABLE_INSPECTOR 0

build will fail ultimately, mostly because the build system does not handle this case. Disabling such features are important for embedded systems.
Comment 1 Ismail Donmez 2009-12-18 10:54:37 PST
Btw fixing the sources to handle !ENABLE(INSPECTOR) case is easy but the build system has inspector support hardcoded.
Comment 2 Laszlo Gombos 2009-12-29 20:50:37 PST
Created attachment 45636 [details]
proposed patch

To turn off inspector support built QtWebKit with the following command

build-webkit --no-javascript-debugger DEFINES+="ENABLE_INSPECTOR=0"
Comment 3 WebKit Review Bot 2009-12-29 20:53:29 PST
style-queue ran check-webkit-style on attachment 45636 [details] without any errors.
Comment 4 Eric Seidel (no email) 2009-12-29 23:48:22 PST
Comment on attachment 45636 [details]
proposed patch

Should InspectElement even be defined?
20372045         case InspectElement: {
Seems we might as well remove that when ENABLE(INSPECTOR) isn't defined (unless it's part of some public API header and difficutl to remove?)

In general this looks OK.  Why would we even compile InspectorClientQt when ENABLE(INSPECTOR) was not defined?
Comment 5 Ismail Donmez 2009-12-30 00:08:51 PST
Also --minimal should disable inspector too.
Comment 6 Simon Hausmann 2009-12-30 06:44:51 PST
Comment on attachment 45636 [details]
proposed patch

r=me. I wonder what the gain is for embedded builds, given that we exclude the bulk of data files anyway.
Comment 7 Ismail Donmez 2009-12-30 06:45:56 PST
Well even 10k matters for me on Windows CE 5.0. Thanks for the patch Laszlo, its appreciated.
Comment 8 WebKit Commit Bot 2009-12-30 08:44:06 PST
Comment on attachment 45636 [details]
proposed patch

Clearing flags on attachment: 45636

Committed r52662: <http://trac.webkit.org/changeset/52662>
Comment 9 WebKit Commit Bot 2009-12-30 08:44:11 PST
All reviewed patches have been landed.  Closing bug.
Comment 10 Ismail Donmez 2010-02-05 10:19:09 PST
The patch misses some ifdefs it seems, I get:

..\..\..\WebCore\rendering\RenderLayerBacking.cpp(1028) : error C2039: 'inspectorTimelineAgent' : is not a member of 'WebCore::Page' see declaration of 'WebCore::Page'
Comment 11 Ismail Donmez 2010-02-05 10:24:53 PST
Created attachment 48238 [details]
Patch to add missing ifdef for the disabled inspector case
Comment 12 Ismail Donmez 2010-02-05 10:26:17 PST
Created attachment 48239 [details]
Patch to add missing ifdef for the disabled inspector case (add the semicolon to make it compile!)
Comment 13 Ismail Donmez 2010-02-09 16:24:31 PST
Ping?
Comment 14 Ismail Donmez 2010-02-16 01:53:54 PST
Created attachment 48795 [details]
Patch against latest SVN, fix new compilation failures
Comment 15 Pavel Feldman 2010-02-16 02:05:49 PST
Comment on attachment 48795 [details]
Patch against latest SVN, fix new compilation failures

>  
>  static InspectorTimelineAgent* inspectorTimelineAgent(RenderObject* renderer)
>  {
> +#if !ENABLE(INSPECTOR)
> +    return 0;
> +#else
>      Frame* frame = renderer->document()->frame();
>      if (!frame)
>          return 0;
> @@ -1026,6 +1029,7 @@ static InspectorTimelineAgent* inspectorTimelineAgent(RenderObject* renderer)
>      if (!page)
>          return 0;
>      return page->inspectorTimelineAgent();
> +#endif
>  }


You should just surround this entire method with if ENABLE(INSPECTOR). Please fix this before landing.

>  
>  // Up-call from compositing layer drawing callback.
> diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
> index 185a2ee..256d6c4 100644
> --- a/WebKit/qt/Api/qwebpage.cpp
> +++ b/WebKit/qt/Api/qwebpage.cpp
> @@ -163,27 +163,42 @@ QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page)
>  
>  void QWEBKIT_EXPORT qt_drt_webinspector_executeScript(QWebPage* page, long callId, const QString& script)
>  {

Nit: In case these are only used from within DRT, should you hide these methods as well and use guards in layout test controller instead?
Comment 16 Ismail Donmez 2010-02-16 02:07:54 PST
(In reply to comment #15)
> (From update of attachment 48795 [details])
> >  
> >  static InspectorTimelineAgent* inspectorTimelineAgent(RenderObject* renderer)
> >  {
> > +#if !ENABLE(INSPECTOR)
> > +    return 0;
> > +#else
> >      Frame* frame = renderer->document()->frame();
> >      if (!frame)
> >          return 0;
> > @@ -1026,6 +1029,7 @@ static InspectorTimelineAgent* inspectorTimelineAgent(RenderObject* renderer)
> >      if (!page)
> >          return 0;
> >      return page->inspectorTimelineAgent();
> > +#endif
> >  }
> 
> 
> You should just surround this entire method with if ENABLE(INSPECTOR). Please
> fix this before landing.

Since I cannot land myself anyway, if I just surround with if ENABLE(INSPECTOR) it would give a compiler warning/error saying the function should return a value.
Comment 17 Pavel Feldman 2010-02-16 02:09:17 PST
(In reply to comment #16)
> (In reply to comment #15)
> > (From update of attachment 48795 [details] [details])
> > >  
> > >  static InspectorTimelineAgent* inspectorTimelineAgent(RenderObject* renderer)
> > >  {
> > > +#if !ENABLE(INSPECTOR)
> > > +    return 0;
> > > +#else
> > >      Frame* frame = renderer->document()->frame();
> > >      if (!frame)
> > >          return 0;
> > > @@ -1026,6 +1029,7 @@ static InspectorTimelineAgent* inspectorTimelineAgent(RenderObject* renderer)
> > >      if (!page)
> > >          return 0;
> > >      return page->inspectorTimelineAgent();
> > > +#endif
> > >  }
> > 
> > 
> > You should just surround this entire method with if ENABLE(INSPECTOR). Please
> > fix this before landing.
> 
> Since I cannot land myself anyway, if I just surround with if ENABLE(INSPECTOR)
> it would give a compiler warning/error saying the function should return a
> value.

I mean surround the function, not its body. It should never be referenced if there is no inspector.
Comment 18 Ismail Donmez 2010-02-16 02:10:25 PST
(In reply to comment #17)
> (In reply to comment #16)
> > (In reply to comment #15)
> > > (From update of attachment 48795 [details] [details] [details])
> > > >  
> > > >  static InspectorTimelineAgent* inspectorTimelineAgent(RenderObject* renderer)
> > > >  {
> > > > +#if !ENABLE(INSPECTOR)
> > > > +    return 0;
> > > > +#else
> > > >      Frame* frame = renderer->document()->frame();
> > > >      if (!frame)
> > > >          return 0;
> > > > @@ -1026,6 +1029,7 @@ static InspectorTimelineAgent* inspectorTimelineAgent(RenderObject* renderer)
> > > >      if (!page)
> > > >          return 0;
> > > >      return page->inspectorTimelineAgent();
> > > > +#endif
> > > >  }
> > > 
> > > 
> > > You should just surround this entire method with if ENABLE(INSPECTOR). Please
> > > fix this before landing.
> > 
> > Since I cannot land myself anyway, if I just surround with if ENABLE(INSPECTOR)
> > it would give a compiler warning/error saying the function should return a
> > value.
> 
> I mean surround the function, not its body. It should never be referenced if
> there is no inspector.

That would require patching the header too, isn't that kind of ugly? :-)
Comment 19 Pavel Feldman 2010-02-16 02:15:17 PST
> That would require patching the header too, isn't that kind of ugly? :-)

There is no (should be no) header entry for it. It is just a static helper function defined for private use in this cpp.
Comment 20 Ismail Donmez 2010-02-16 02:18:47 PST
(In reply to comment #19)
> > That would require patching the header too, isn't that kind of ugly? :-)
> 
> There is no (should be no) header entry for it. It is just a static helper
> function defined for private use in this cpp.

I forgot the fact that the function was static, was lame of me. Let me upload a fixed patch.
Comment 21 Ismail Donmez 2010-02-16 02:21:09 PST
Created attachment 48797 [details]
Surround the functions with a ifdef block, this is simpler
Comment 22 Pavel Feldman 2010-02-16 02:31:30 PST
Comment on attachment 48797 [details]
Surround the functions with a ifdef block, this is simpler

What about

static InspectorTimelineAgent* inspectorTimelineAgent

It is still not hidden, while it was the only one I really cared about.
Comment 23 Ismail Donmez 2010-02-16 02:52:19 PST
Created attachment 48798 [details]
Simplify the patch
Comment 24 WebKit Commit Bot 2010-02-16 03:10:21 PST
Comment on attachment 48798 [details]
Simplify the patch

Clearing flags on attachment: 48798

Committed r54815: <http://trac.webkit.org/changeset/54815>
Comment 25 WebKit Commit Bot 2010-02-16 03:10:33 PST
All reviewed patches have been landed.  Closing bug.