Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


Hi Tobias,

On Wed, Jan 21, 2015 at 05:06:25AM -0800, Tobias Madl <tobias.madl.dev@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

Attachment: signature.asc
Description: Digital signature


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.