update_engine: Update libchrome APIs to r405848
The new libchrome has been ported from Chromium and some APIs have
changed. Make necessary changes at call sites.
Notable changes from libchrome:
- base::Bind() now explicitly disallows captures in lambdas (which was
never allowed in the style guide), so lambdas should now be written in
a way that take the captures as parameters.
Bug: 29104761
Test: All tests in update_engine_unittest pass on dragonboard-eng build
Change-Id: Iec04c126630fd876114076e3cb10cf917c8817b0
diff --git a/common/http_fetcher_unittest.cc b/common/http_fetcher_unittest.cc
index 0dd6f84..6f3e480 100644
--- a/common/http_fetcher_unittest.cc
+++ b/common/http_fetcher_unittest.cc
@@ -847,7 +847,8 @@
// Check that no other callback runs in the next two seconds. That would
// indicate a leaked callback.
bool timeout = false;
- auto callback = base::Bind([&timeout]{ timeout = true;});
+ auto callback = base::Bind([](bool* timeout) { *timeout = true; },
+ base::Unretained(&timeout));
this->loop_.PostDelayedTask(FROM_HERE, callback,
base::TimeDelta::FromSeconds(2));
EXPECT_TRUE(this->loop_.RunOnce(true));
diff --git a/common/subprocess_unittest.cc b/common/subprocess_unittest.cc
index cc1f353..58d4191 100644
--- a/common/subprocess_unittest.cc
+++ b/common/subprocess_unittest.cc
@@ -249,13 +249,13 @@
fifo_fd,
MessageLoop::WatchMode::kWatchRead,
false,
- base::Bind([fifo_fd, tag] {
+ base::Bind([](int fifo_fd, uint32_t tag) {
char c;
EXPECT_EQ(1, HANDLE_EINTR(read(fifo_fd, &c, 1)));
EXPECT_EQ('X', c);
LOG(INFO) << "Killing tag " << tag;
Subprocess::Get().KillExec(tag);
- }));
+ }, fifo_fd, tag));
// This test would leak a callback that runs when the child process exits
// unless we wait for it to run.