Title: [230166] trunk/Tools
Revision
230166
Author
[email protected]
Date
2018-04-02 11:09:04 -0700 (Mon, 02 Apr 2018)

Log Message

Remove Options constructor and use internal linkage for option handlers
https://bugs.webkit.org/show_bug.cgi?id=184229

Reviewed by Andy Estes.

Use C++11 default initializer syntax to remove the need to explicitly have a constructor
for the struct Options. Use internal linkage for option handler functions as these
are never invoked outside the translation unit they are defined in.

* WebKitTestRunner/Options.cpp:
(WTR::handleOptionNoTimeout):
(WTR::handleOptionVerbose):
(WTR::handleOptionGcBetweenTests):
(WTR::handleOptionPixelTests):
(WTR::handleOptionPrintSupportedFeatures):
(WTR::handleOptionComplexText):
(WTR::handleOptionAcceleratedDrawing):
(WTR::handleOptionRemoteLayerTree):
(WTR::handleOptionShowWebView):
(WTR::handleOptionShowTouches):
(WTR::handleOptionAllowedHost):
(WTR::handleOptionUnmatched):
(WTR::Options::Options): Deleted.
* WebKitTestRunner/Options.h:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (230165 => 230166)


--- trunk/Tools/ChangeLog	2018-04-02 17:51:34 UTC (rev 230165)
+++ trunk/Tools/ChangeLog	2018-04-02 18:09:04 UTC (rev 230166)
@@ -1,3 +1,30 @@
+2018-04-02  Daniel Bates  <[email protected]>
+
+        Remove Options constructor and use internal linkage for option handlers
+        https://bugs.webkit.org/show_bug.cgi?id=184229
+
+        Reviewed by Andy Estes.
+
+        Use C++11 default initializer syntax to remove the need to explicitly have a constructor
+        for the struct Options. Use internal linkage for option handler functions as these
+        are never invoked outside the translation unit they are defined in.
+
+        * WebKitTestRunner/Options.cpp:
+        (WTR::handleOptionNoTimeout):
+        (WTR::handleOptionVerbose):
+        (WTR::handleOptionGcBetweenTests):
+        (WTR::handleOptionPixelTests):
+        (WTR::handleOptionPrintSupportedFeatures):
+        (WTR::handleOptionComplexText):
+        (WTR::handleOptionAcceleratedDrawing):
+        (WTR::handleOptionRemoteLayerTree):
+        (WTR::handleOptionShowWebView):
+        (WTR::handleOptionShowTouches):
+        (WTR::handleOptionAllowedHost):
+        (WTR::handleOptionUnmatched):
+        (WTR::Options::Options): Deleted.
+        * WebKitTestRunner/Options.h:
+
 2018-04-02  Alejandro G. Castro  <[email protected]>
 
         Unreviewed GTK port dependencies fix after r230152.

Modified: trunk/Tools/WebKitTestRunner/Options.cpp (230165 => 230166)


--- trunk/Tools/WebKitTestRunner/Options.cpp	2018-04-02 17:51:34 UTC (rev 230165)
+++ trunk/Tools/WebKitTestRunner/Options.cpp	2018-04-02 18:09:04 UTC (rev 230166)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2013 University of Szeged. All rights reserved.
  * Copyright (C) 2013 Samsung Electronics. All rights reserved.
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,89 +32,74 @@
 
 namespace WTR {
 
-Options::Options()
-    : useWaitToDumpWatchdogTimer(true)
-    , forceNoTimeout(false)
-    , verbose(false)
-    , gcBetweenTests(false)
-    , shouldDumpPixelsForAllTests(false)
-    , printSupportedFeatures(false)
-    , forceComplexText(false)
-    , shouldUseAcceleratedDrawing(false)
-    , shouldUseRemoteLayerTree(false)
-    , shouldShowWebView(false)
-    , shouldShowTouches(false)
+static bool handleOptionNoTimeout(Options& options, const char*, const char*)
 {
-}
-
-bool handleOptionNoTimeout(Options& options, const char*, const char*)
-{
     options.useWaitToDumpWatchdogTimer = false;
     options.forceNoTimeout = true;
     return true;
 }
 
-bool handleOptionVerbose(Options& options, const char*, const char*)
+static bool handleOptionVerbose(Options& options, const char*, const char*)
 {
     options.verbose = true;
     return true;
 }
 
-bool handleOptionGcBetweenTests(Options& options, const char*, const char*)
+static bool handleOptionGcBetweenTests(Options& options, const char*, const char*)
 {
     options.gcBetweenTests = true;
     return true;
 }
 
-bool handleOptionPixelTests(Options& options, const char*, const char*)
+static bool handleOptionPixelTests(Options& options, const char*, const char*)
 {
     options.shouldDumpPixelsForAllTests = true;
     return true;
 }
 
-bool handleOptionPrintSupportedFeatures(Options& options, const char*, const char*)
+static bool handleOptionPrintSupportedFeatures(Options& options, const char*, const char*)
 {
     options.printSupportedFeatures = true;
     return true;
 }
 
-bool handleOptionComplexText(Options& options, const char*, const char*)
+static bool handleOptionComplexText(Options& options, const char*, const char*)
 {
     options.forceComplexText = true;
     return true;
 }
 
-bool handleOptionAcceleratedDrawing(Options& options, const char*, const char*)
+static bool handleOptionAcceleratedDrawing(Options& options, const char*, const char*)
 {
     options.shouldUseAcceleratedDrawing = true;
     return true;
 }
 
-bool handleOptionRemoteLayerTree(Options& options, const char*, const char*)
+static bool handleOptionRemoteLayerTree(Options& options, const char*, const char*)
 {
     options.shouldUseRemoteLayerTree = true;
     return true;
 }
 
-bool handleOptionShowWebView(Options& options, const char*, const char*)
+static bool handleOptionShowWebView(Options& options, const char*, const char*)
 {
     options.shouldShowWebView = true;
     return true;
 }
-    
-bool handleOptionShowTouches(Options& options, const char*, const char*)
+
+static bool handleOptionShowTouches(Options& options, const char*, const char*)
 {
     options.shouldShowTouches = true;
     return true;
 }
 
-bool handleOptionAllowedHost(Options& options, const char*, const char* host)
+static bool handleOptionAllowedHost(Options& options, const char*, const char* host)
 {
     options.allowedHosts.push_back(host);
     return true;
 }
 
-bool handleOptionUnmatched(Options& options, const char* option, const char*)
+static bool handleOptionUnmatched(Options& options, const char* option, const char*)
 {
     if (option[0] && option[1] && option[0] == '-' && option[1] == '-')
         return true;

Modified: trunk/Tools/WebKitTestRunner/Options.h (230165 => 230166)


--- trunk/Tools/WebKitTestRunner/Options.h	2018-04-02 17:51:34 UTC (rev 230165)
+++ trunk/Tools/WebKitTestRunner/Options.h	2018-04-02 18:09:04 UTC (rev 230166)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2013 University of Szeged. All rights reserved.
  * Copyright (C) 2013 Samsung Electronics. All rights reserved.
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -25,8 +25,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef Options_h
-#define Options_h
+#pragma once
 
 #include <functional>
 #include <stdio.h>
@@ -37,18 +36,17 @@
 namespace WTR {
 
 struct Options {
-    Options();
-    bool useWaitToDumpWatchdogTimer;
-    bool forceNoTimeout;
-    bool verbose;
-    bool gcBetweenTests;
-    bool shouldDumpPixelsForAllTests;
-    bool printSupportedFeatures;
-    bool forceComplexText;
-    bool shouldUseAcceleratedDrawing;
-    bool shouldUseRemoteLayerTree;
-    bool shouldShowWebView;
-    bool shouldShowTouches;
+    bool useWaitToDumpWatchdogTimer { true };
+    bool forceNoTimeout { false };
+    bool verbose { false };
+    bool gcBetweenTests { false };
+    bool shouldDumpPixelsForAllTests { false };
+    bool printSupportedFeatures { false };
+    bool forceComplexText { false };
+    bool shouldUseAcceleratedDrawing { false };
+    bool shouldUseRemoteLayerTree { false };
+    bool shouldShowWebView { false };
+    bool shouldShowTouches { false };
     std::vector<std::string> paths;
     std::vector<std::string> allowedHosts;
 };
@@ -77,4 +75,3 @@
 
 } // namespace WTR
 
-#endif // Options_h
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to