> On Lis. 26, 2016, 7:20 odp., David Faure wrote:
> > src/widgets/krun.cpp, line 436
> > <https://git.reviewboard.kde.org/r/129399/diff/2/?file=486397#file486397line436>
> >
> >     Is it needed to do this check more than once?
> >     If this can't change over time, there could be a static enum here (not 
> > check yet, present, absent) to avoid making a dbus blocking call every time.
> 
> Jan Grulich wrote:
>     I'm not sure how to do that as static variables cannot be mutable thus I 
> need to initialize it immediately and cannot change later. I'm also not able 
> to put it into KRunPrivate as its member variables also cannot be used in 
> KRun static methods. Could you give me a hint what do you mean exactly?
> 
> David Faure wrote:
>     Static variables can definitely be mutable, as long as they are not 
> declared const.
>     
>         enum DiscreteGpuCheck { NotChecked, Present, Absent };
>         static DiscreteGpuCheck s_gpuCheck = NotChecked;
>         if (s_gpuCheck == NotChecked) {
>             <make dbus call>
>             <set s_gpuCheck to either Present or Absent>
>         }
>         // use s_gpuCheck here.
>     
>     (This is only used in the GUI thread, in KRun, KPropertiesDialog and 
> klauncher, so no mutex needed)
>     
>     Possibly this whole code could be in Solid, so that it's only in one 
> place (and so that the dbus call is only made once per process, rather than 2 
> or 3 times given that this is needed in multiple places). I have no overview 
> on the Solid API though, to be able to say where it would fit best.
>     
>     Also, KIO depends on Solid, but not klauncher. So maybe klauncher needs 
> its own copy -- there is only one klauncher process so it would do the call 
> only once.
> 
> Jan Grulich wrote:
>     Already tried that, but getting error: ISO C++ forbids in-class 
> initialization of non-const static member ‘KRun::s_gpuCheck’. From what I've 
> read on the internet this will compile maybe on some compilers, but it's not 
> a valid code.

Ok, ignore that comment, moving this outside makes it compile.


- Jan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/129399/#review101128
-----------------------------------------------------------


On Lis. 22, 2016, 12:13 odp., Jan Grulich wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/129399/
> -----------------------------------------------------------
> 
> (Updated Lis. 22, 2016, 12:13 odp.)
> 
> 
> Review request for KDE Frameworks and David Faure.
> 
> 
> Repository: kio
> 
> 
> Description
> -------
> 
> When running an app using KRun, check whether X-KDE-RunOnDiscreteGpu is set 
> and whether we have a discrete graphics card and set the environment variable 
> accordingly.
> 
> 
> Diffs
> -----
> 
>   src/widgets/krun.cpp d93b1f2 
> 
> Diff: https://git.reviewboard.kde.org/r/129399/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jan Grulich
> 
>

Reply via email to