update_engine: Replace scoped_refptr with shared_ptr in update_manager

It seems like scoped_refptr was a substitute for shared_ptr before
chromium was on C++11:
https://www.chromium.org/developers/smart-pointer-guidelines

But that is not the case anymore as we are already on C++14. So just
replace it in update_manager with shared_ptr.

There is still another use case of it for keeping dbus connections but
that can't easily be changed because brillo::DBusConnection is still
using scoped_refptr.

BUG=chromium:994048
TEST=FEATURES=test emerge update_engine

Change-Id: I1fab0408399d678d2851731aea40fc02be459295
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/1755262
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
Reviewed-by: Sen Jiang <senj@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Commit-Queue: Amin Hassani <ahassani@chromium.org>
diff --git a/update_manager/update_manager.cc b/update_manager/update_manager.cc
index 5664a5c..2974d7d 100644
--- a/update_manager/update_manager.cc
+++ b/update_manager/update_manager.cc
@@ -47,7 +47,11 @@
 }
 
 void UpdateManager::UnregisterEvalContext(EvaluationContext* ec) {
-  if (!ec_repo_.erase(ec)) {
+  // Since |ec_repo_|'s compare function is based on the value of the raw
+  // pointer |ec|, we can just create a |shared_ptr| here and pass it along to
+  // be erased.
+  if (!ec_repo_.erase(
+          std::shared_ptr<EvaluationContext>(ec, [](EvaluationContext*) {}))) {
     LOG(ERROR) << "Unregistering an unknown evaluation context, this is a bug.";
   }
 }