summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderThread.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2017-12-01 16:18:53 -0800
committerJohn Reck <jreck@google.com>2017-12-01 16:35:06 -0800
commit259b25a310bf3beb5d41233717aaf3dc02a46c36 (patch)
treeebcfdbf6e6b35ee2954e9f7bbf3183b414228198 /libs/hwui/renderthread/RenderThread.cpp
parent9fdbc957c6d7b464fccfcfcd01a4771172f18c0e (diff)
Switch RenderThread to a Java daemon thread
Bug: 69962494 Test: device boots, hwui unit tests pass Change-Id: I9d5f2fccebf845328914c82aa97285cf605a4354
Diffstat (limited to 'libs/hwui/renderthread/RenderThread.cpp')
-rw-r--r--libs/hwui/renderthread/RenderThread.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index 05a9b75b4504..20443ec38c90 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -51,10 +51,17 @@ static const nsecs_t DISPATCH_FRAME_CALLBACKS_DELAY = milliseconds_to_nanosecond
static bool gHasRenderThreadInstance = false;
+static void (*gOnStartHook)() = nullptr;
+
bool RenderThread::hasInstance() {
return gHasRenderThreadInstance;
}
+void RenderThread::setOnStartHook(void (*onStartHook)()) {
+ LOG_ALWAYS_FATAL_IF(hasInstance(), "can't set an onStartHook after we've started...");
+ gOnStartHook = onStartHook;
+}
+
RenderThread& RenderThread::getInstance() {
// This is a pointer because otherwise __cxa_finalize
// will try to delete it like a Good Citizen but that causes us to crash
@@ -256,6 +263,9 @@ void RenderThread::requestVsync() {
bool RenderThread::threadLoop() {
setpriority(PRIO_PROCESS, 0, PRIORITY_DISPLAY);
+ if (gOnStartHook) {
+ gOnStartHook();
+ }
initThreadLocals();
while (true) {