diff options
author | Yifan Hong <elsk@google.com> | 2017-03-21 18:56:35 +0000 |
---|---|---|
committer | Yifan Hong <elsk@google.com> | 2017-03-23 17:12:08 +0000 |
commit | 31f07ffea072ad066bc73181f3368951ba21f50d (patch) | |
tree | 1d671fd05648cbfce3077dc0d4d2ac567cbee835 /utils | |
parent | 904b0389ccc5f9d9f49547a76f84b5e80540bce5 (diff) | |
download | hidl-31f07ffea072ad066bc73181f3368951ba21f50d.tar.gz |
Revert "Revert "getService should retry if getting nullptr""
Test: take picture with different modes
Test: take video
Test: take screenshot
Test: video plays
Test: after these steps, lshal doesn't have extra PIDs for
gralloc passthrough hal.
Test: dmesg doesn't have denials.
Bug: 36153684
Bug: 36383997
Bug: 36462585
This reverts commit 2f7abc9a96e58e693f0db7b0c7fcf59a856a4008.
Change-Id: I5d087d55caaf38a94dae7d06ded3179041994953
Diffstat (limited to 'utils')
-rw-r--r-- | utils/Formatter.cpp | 10 | ||||
-rw-r--r-- | utils/include/hidl-util/Formatter.h | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/utils/Formatter.cpp b/utils/Formatter.cpp index db763d98..503d1459 100644 --- a/utils/Formatter.cpp +++ b/utils/Formatter.cpp @@ -86,6 +86,11 @@ Formatter &Formatter::sElse(std::function<void(void)> block) { return this->block(block); } +Formatter &Formatter::sFor(const std::string &stmts, std::function<void(void)> block) { + (*this) << "for (" << stmts << ") "; + return this->block(block); +} + Formatter &Formatter::sTry(std::function<void(void)> block) { (*this) << "try "; return this->block(block); @@ -101,6 +106,11 @@ Formatter &Formatter::sFinally(std::function<void(void)> block) { return this->block(block); } +Formatter &Formatter::sWhile(const std::string &cond, std::function<void(void)> block) { + (*this) << "while (" << cond << ") "; + return this->block(block); +} + Formatter &Formatter::operator<<(const std::string &out) { const size_t len = out.length(); size_t start = 0; diff --git a/utils/include/hidl-util/Formatter.h b/utils/include/hidl-util/Formatter.h index 7e0c4f99..57fb3b61 100644 --- a/utils/include/hidl-util/Formatter.h +++ b/utils/include/hidl-util/Formatter.h @@ -79,6 +79,11 @@ struct Formatter { Formatter &sElseIf(const std::string &cond, std::function<void(void)> block); Formatter &sElse(std::function<void(void)> block); + // out.sFor("int i = 0; i < 10; i++", [&] { + // out << "printf(\"%d\", i);\n"; + // }).endl(); + Formatter &sFor(const std::string &stmts, std::function<void(void)> block); + // out.sTry([&] { // out << "throw RemoteException();\n" // }).sCatch("RemoteException ex", [&] { @@ -91,6 +96,11 @@ struct Formatter { Formatter &sCatch(const std::string &exception, std::function<void(void)> block); Formatter &sFinally(std::function<void(void)> block); + // out.sWhile("z < 10", [&] { + // out << "z++;\n"; + // }).endl(); + Formatter &sWhile(const std::string &cond, std::function<void(void)> block); + Formatter &operator<<(const std::string &out); Formatter &operator<<(size_t n); |