[Libreoffice-commits] core.git: Branch 'feature/priorities' - include/vcl vcl/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Jan 22 00:54:26 PST 2015


Hi Tobias,

On Wed, Jan 21, 2015 at 05:06:25AM -0800, Tobias Madl <tobias.madl.dev at gmail.com> wrote:
>  enum class IdlePriority {
> -    VCL_IDLE_PRIORITY_STARVATIONPROTECTION  = -1, // Do not use this for normal prioritizing!
> -
> -    VCL_IDLE_PRIORITY_HIGHEST               = 0,  // -> 0ms
> -    VCL_IDLE_PRIORITY_HIGH                  = 1,  // -> 1ms
> -    VCL_IDLE_PRIORITY_DEFAULT               = 1,  // -> 1ms
> -    VCL_IDLE_PRIORITY_REPAINT               = 2,  // -> 30ms
> -    VCL_IDLE_PRIORITY_RESIZE                = 3,  // -> 50ms
> -    VCL_IDLE_PRIORITY_MEDIUM                = 3,  // -> 50ms
> -    VCL_IDLE_PRIORITY_LOW                   = 4,  // -> 100ms
> -    VCL_IDLE_PRIORITY_LOWER                 = 5,  // -> 200ms
> -    VCL_IDLE_PRIORITY_LOWEST                = 6   // -> 400ms
> +    VCL_IDLE_PRIORITY_HIGHEST,
> +    VCL_IDLE_PRIORITY_HIGH,
> +    VCL_IDLE_PRIORITY_REPAINT,
> +    VCL_IDLE_PRIORITY_RESIZE,
> +    VCL_IDLE_PRIORITY_MEDIUM,
> +    VCL_IDLE_PRIORITY_LOW,
> +    VCL_IDLE_PRIORITY_LOWER,
> +    VCL_IDLE_PRIORITY_LOWEST

What's the benefit of still having the VCL_IDLE_PRIORITY_ prefix here if
the scope name already includes IdlePriority?

> +inline sal_Int32 convertToInt( IdlePriority ePriority )
> +{
> +    switch (ePriority)
> +    {
> +        case IdlePriority::VCL_IDLE_PRIORITY_HIGHEST:
> +            return 0;
> +        case IdlePriority::VCL_IDLE_PRIORITY_HIGH:
> +            return 1;

Can't you just use static_cast<sal_Int32>(ePriority) and avoid
hand-coding this method?

> +    return 42; // Should not happen

If you still consider convertToInt() necessary, what about including an
assert(false) here before returning a random value?

Regards,

Miklos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20150122/46ed9ce5/attachment.sig>


More information about the LibreOffice mailing list