PM: Fix PolicyManager calls with multiple variadic template arguments.

We've been using a pattern among PolicyManager calls whereas a single
variadic template argument was used to describe the types of first-class
arguments to the template method, but also the type signature of
a method that is another argument. This was causing issues where
template type inference was unable to resolve automatic casting / type
promotion among these two (otherwise compatible) type lists.

Instead, we now use a separate variadic template argument for these two
instances: ExpectedArgs... represents the types of arguments expected by
the policy methods, whereas ActualArgs... represents the types of
arguments that are actually provided to the PolicyManager. This allows
template type inference to succeed. To ensure that type
incompatibilities do not propagate far, resulting in cryptic compiler
errors, we further use explicit instantiation of subsequent templates in
the two public methods, PolicyREquest and AsyncPolicyRequest. This
ensures early on that the actual arguments can be converted to the
expected types.

Also, this removes parameter names from the declaration of function
arguments; they are not needed and decrease clarity.

BUG=None
TEST=Unit tests.

Change-Id: Ia5552714477c3f30f6ff1717461ba4461bea38be
Reviewed-on: https://chromium-review.googlesource.com/200570
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
2 files changed
tree: d93f3676ca1e046afa07bf3737903a9df8f0c426
  1. init/
  2. payload_generator/
  3. policy_manager/
  4. .gitignore
  5. 99-gpio-dutflag.rules
  6. action.h
  7. action_mock.h
  8. action_pipe.h
  9. action_pipe_unittest.cc
  10. action_processor.cc
  11. action_processor.h
  12. action_processor_mock.h
  13. action_processor_unittest.cc
  14. action_unittest.cc
  15. build
  16. bzip.cc
  17. bzip.h
  18. bzip_extent_writer.cc
  19. bzip_extent_writer.h
  20. bzip_extent_writer_unittest.cc
  21. certificate_checker.cc
  22. certificate_checker.h
  23. certificate_checker_mock.h
  24. certificate_checker_unittest.cc
  25. chrome_browser_proxy_resolver.cc
  26. chrome_browser_proxy_resolver.h
  27. chrome_browser_proxy_resolver_unittest.cc
  28. clock.cc
  29. clock.h
  30. clock_interface.h
  31. connection_manager.cc
  32. connection_manager.h
  33. connection_manager_unittest.cc
  34. constants.cc
  35. constants.h
  36. dbus_constants.h
  37. dbus_service.cc
  38. dbus_service.h
  39. dbus_wrapper_interface.h
  40. delta_performer.cc
  41. delta_performer.h
  42. delta_performer_unittest.cc
  43. download_action.cc
  44. download_action.h
  45. download_action_unittest.cc
  46. error_code.h
  47. extent_ranges.cc
  48. extent_ranges.h
  49. extent_ranges_unittest.cc
  50. extent_writer.cc
  51. extent_writer.h
  52. extent_writer_unittest.cc
  53. fake_clock.h
  54. fake_hardware.h
  55. fake_p2p_manager.h
  56. fake_p2p_manager_configuration.h
  57. fake_prefs.cc
  58. fake_prefs.h
  59. fake_system_state.cc
  60. fake_system_state.h
  61. file_descriptor.cc
  62. file_descriptor.h
  63. file_writer.cc
  64. file_writer.h
  65. file_writer_mock.h
  66. file_writer_unittest.cc
  67. filesystem_copier_action.cc
  68. filesystem_copier_action.h
  69. filesystem_copier_action_unittest.cc
  70. gen_coverage_html
  71. gpio_handler.cc
  72. gpio_handler.h
  73. gpio_handler_unittest.cc
  74. gpio_handler_unittest.h
  75. gpio_mock_file_descriptor.cc
  76. gpio_mock_file_descriptor.h
  77. gpio_mock_udev_interface.cc
  78. gpio_mock_udev_interface.h
  79. hardware.cc
  80. hardware.h
  81. hardware_interface.h
  82. http_common.cc
  83. http_common.h
  84. http_fetcher.cc
  85. http_fetcher.h
  86. http_fetcher_unittest.cc
  87. hwid_override.cc
  88. hwid_override.h
  89. hwid_override_unittest.cc
  90. inherit-review-settings-ok
  91. install_plan.cc
  92. install_plan.h
  93. libcurl_http_fetcher.cc
  94. libcurl_http_fetcher.h
  95. LICENSE
  96. local_coverage_rate
  97. main.cc
  98. metrics.cc
  99. metrics.h
  100. mock_connection_manager.h
  101. mock_dbus_wrapper.h
  102. mock_file_writer.h
  103. mock_gpio_handler.h
  104. mock_hardware.h
  105. mock_http_fetcher.cc
  106. mock_http_fetcher.h
  107. mock_p2p_manager.h
  108. mock_payload_state.h
  109. multi_range_http_fetcher.cc
  110. multi_range_http_fetcher.h
  111. omaha_hash_calculator.cc
  112. omaha_hash_calculator.h
  113. omaha_hash_calculator_unittest.cc
  114. omaha_request_action.cc
  115. omaha_request_action.h
  116. omaha_request_action_unittest.cc
  117. omaha_request_params.cc
  118. omaha_request_params.h
  119. omaha_request_params_unittest.cc
  120. omaha_response.h
  121. omaha_response_handler_action.cc
  122. omaha_response_handler_action.h
  123. omaha_response_handler_action_unittest.cc
  124. p2p_manager.cc
  125. p2p_manager.h
  126. p2p_manager_unittest.cc
  127. payload_constants.cc
  128. payload_constants.h
  129. payload_signer.cc
  130. payload_signer.h
  131. payload_signer_unittest.cc
  132. payload_state.cc
  133. payload_state.h
  134. payload_state_interface.h
  135. payload_state_unittest.cc
  136. postinstall_runner_action.cc
  137. postinstall_runner_action.h
  138. postinstall_runner_action_unittest.cc
  139. prefs.cc
  140. prefs.h
  141. prefs_interface.h
  142. prefs_mock.h
  143. prefs_unittest.cc
  144. proxy_resolver.cc
  145. proxy_resolver.h
  146. real_dbus_wrapper.h
  147. real_system_state.cc
  148. real_system_state.h
  149. run_unittests
  150. sample_omaha_v3_response.xml
  151. SConstruct
  152. simple_key_value_store.cc
  153. simple_key_value_store.h
  154. simple_key_value_store_unittest.cc
  155. subprocess.cc
  156. subprocess.h
  157. subprocess_unittest.cc
  158. system_state.h
  159. terminator.cc
  160. terminator.h
  161. terminator_unittest.cc
  162. test_http_server.cc
  163. test_utils.cc
  164. test_utils.h
  165. testrunner.cc
  166. udev_interface.h
  167. unittest_key.pem
  168. unittest_key2.pem
  169. update_attempter.cc
  170. update_attempter.h
  171. update_attempter_mock.h
  172. update_attempter_unittest.cc
  173. update_check_scheduler.cc
  174. update_check_scheduler.h
  175. update_check_scheduler_unittest.cc
  176. update_engine.xml
  177. update_engine_client.cc
  178. update_metadata.proto
  179. UpdateEngine.conf
  180. utils.cc
  181. utils.h
  182. utils_unittest.cc
  183. WATCHLISTS
  184. zip_unittest.cc