Start thread pool in skia_dm on Android.

Android media framework is expected to be run with the background
thread pool for handling binder RPC calls.

Test: skia_dm does not hang with heif files.
Bug: 65463215 Bug: 72869975
Change-Id: I2333d5a13d6145e9468464fa93807851e3a17bc8
Reviewed-on: https://skia-review.googlesource.com/108141
Reviewed-by: Chong Zhang <chz@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
This commit is contained in:
Dongwon Kang 2018-02-16 10:55:21 -08:00 committed by Skia Commit-Bot
parent c9a025de53
commit 0c7861ff0c
2 changed files with 12 additions and 0 deletions

View File

@ -60,6 +60,10 @@ extern void SkPDFImageDumpStats();
#include <unistd.h>
#endif
#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) && defined(SK_HAS_HEIF_LIBRARY)
#include <binder/IPCThreadState.h>
#endif
extern bool gSkForceRasterPipelineBlitter;
DECLARE_bool(undefok);
@ -1313,6 +1317,9 @@ static sk_sp<SkTypeface> create_from_name(const char familyName[], SkFontStyle s
extern sk_sp<SkTypeface> (*gCreateTypefaceDelegate)(const char [], SkFontStyle );
int main(int argc, char** argv) {
#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) && defined(SK_HAS_HEIF_LIBRARY)
android::ProcessState::self()->startThreadPool();
#endif
SkCommandLineFlags::Parse(argc, argv);
if (!FLAGS_nativeFonts) {

View File

@ -185,6 +185,11 @@ cc_test {
srcs: [
$dm_srcs
],
shared_libs: [
"libbinder",
"libutils",
],
}
cc_test {