update_engine: Enforce virtual destructors on virtual classes.

This patch enables -Wnon-virtual-dtor enforcing that virtual classes
such as interfaces have a virtual destructor. This is required by
the Google Coding Style and avoids some problems where the derived
class' destructor is not called.

BUG=None
TEST=FEATURES=test emerge-link update_engine

Change-Id: Id907e3c14923fcccc20b83bd064fa9c9c51fffb3
Reviewed-on: https://chromium-review.googlesource.com/228927
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/action.h b/action.h
index c806b48..63ab417 100644
--- a/action.h
+++ b/action.h
@@ -71,6 +71,7 @@
 class AbstractAction {
  public:
   AbstractAction() : processor_(nullptr) {}
+  virtual ~AbstractAction() = default;
 
   // Begin performing the action. Since this code is asynchronous, when this
   // method returns, it means only that the action has started, not necessarily
diff --git a/action_processor.h b/action_processor.h
index b3cc67b..121e0e1 100644
--- a/action_processor.h
+++ b/action_processor.h
@@ -80,6 +80,8 @@
 // ActionProcessor to register itself.
 class ActionProcessorDelegate {
  public:
+  virtual ~ActionProcessorDelegate() = default;
+
   // Called when all processing in an ActionProcessor has completed. A pointer
   // to the ActionProcessor is passed. |code| is set to the exit code of the
   // last completed action.
diff --git a/connection_manager.h b/connection_manager.h
index c77adee..f9973a3 100644
--- a/connection_manager.h
+++ b/connection_manager.h
@@ -37,6 +37,7 @@
   // Constructs a new ConnectionManager object initialized with the
   // given system state.
   explicit ConnectionManager(SystemState* system_state);
+  virtual ~ConnectionManager() = default;
 
   // Populates |out_type| with the type of the network connection
   // that we are currently connected and |out_tethering| with the estimate of
diff --git a/dbus_wrapper_interface.h b/dbus_wrapper_interface.h
index d6915ff..b765600 100644
--- a/dbus_wrapper_interface.h
+++ b/dbus_wrapper_interface.h
@@ -24,6 +24,8 @@
 
 class DBusWrapperInterface {
  public:
+  virtual ~DBusWrapperInterface() = default;
+
   // Wraps dbus_g_proxy_new_for_name().
   virtual DBusGProxy* ProxyNewForName(DBusGConnection* connection,
                                       const char* name,
diff --git a/download_action.h b/download_action.h
index 8e3809a..6f16e20 100644
--- a/download_action.h
+++ b/download_action.h
@@ -28,6 +28,8 @@
 
 class DownloadActionDelegate {
  public:
+  virtual ~DownloadActionDelegate() = default;
+
   // Called right before starting the download with |active| set to
   // true. Called after completing the download with |active| set to
   // false.
diff --git a/http_fetcher.h b/http_fetcher.h
index b8c6ad6..d291d6d 100644
--- a/http_fetcher.h
+++ b/http_fetcher.h
@@ -169,6 +169,8 @@
 // Interface for delegates
 class HttpFetcherDelegate {
  public:
+  virtual ~HttpFetcherDelegate() = default;
+
   // Called every time bytes are received.
   virtual void ReceivedBytes(HttpFetcher* fetcher,
                              const char* bytes,
diff --git a/omaha_request_params.h b/omaha_request_params.h
index 94db475..0657649 100644
--- a/omaha_request_params.h
+++ b/omaha_request_params.h
@@ -91,6 +91,8 @@
         force_lock_down_(false),
         forced_lock_down_(false) {}
 
+  virtual ~OmahaRequestParams() = default;
+
   // Setters and getters for the various properties.
   inline std::string os_platform() const { return os_platform_; }
   inline std::string os_version() const { return os_version_; }
diff --git a/payload_state_interface.h b/payload_state_interface.h
index 1825a40..95344c6 100644
--- a/payload_state_interface.h
+++ b/payload_state_interface.h
@@ -18,6 +18,8 @@
 // object.
 class PayloadStateInterface {
  public:
+  virtual ~PayloadStateInterface() = default;
+
   // Sets the internal payload state based on the given Omaha response. This
   // response could be the same or different from the one for which we've stored
   // the internal state. If it's different, then this method resets all the
diff --git a/update_engine.gyp b/update_engine.gyp
index 0e89d55..236574e 100644
--- a/update_engine.gyp
+++ b/update_engine.gyp
@@ -18,6 +18,7 @@
       '-Werror',
       '-Wno-unused-parameter',
       '-Wno-deprecated-register',
+      '-Wnon-virtual-dtor',
     ],
     'cflags_cc': [
       '-fno-strict-aliasing',