Skip to content

Commit

Permalink
Android renderThreadManager changed to non static (#2872)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcristici authored Sep 24, 2024
1 parent 8b6bc74 commit 3c250e8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public abstract class MapLibreSurfaceView extends SurfaceView implements SurfaceHolder.Callback2 {

protected static final String TAG = "MapLibreSurfaceView";
protected static final RenderThreadManager renderThreadManager = new RenderThreadManager();
protected final RenderThreadManager renderThreadManager = new RenderThreadManager();

protected SurfaceViewMapRenderer renderer;
protected RenderThread renderThread;
Expand Down Expand Up @@ -266,13 +266,14 @@ protected void onDetachedFromWindow() {
* sRenderThreadManager object. This avoids multiple-lock ordering issues.
*/
abstract static class RenderThread extends Thread {
RenderThread() {
RenderThread(RenderThreadManager aRenderThreadManager) {
super();
width = 0;
height = 0;
requestRender = true;
renderMode = MapRenderer.RenderingRefreshMode.WHEN_DIRTY;
wantRenderNotification = false;
renderThreadManager = aRenderThreadManager;
}

@Override
Expand Down Expand Up @@ -489,6 +490,7 @@ public void waitForEmpty() {
protected ArrayList<Runnable> eventQueue = new ArrayList<>();
protected boolean sizeChanged = true;
protected Runnable finishDrawingRunnable = null;
protected RenderThreadManager renderThreadManager = null;
// End of member variables protected by the sRenderThreadManager monitor.

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ static String formatEglError(String function, int error) {
*/
static class GLThread extends MapLibreSurfaceView.RenderThread {
GLThread(WeakReference<MapLibreGLSurfaceView> surfaceViewWeakRef) {
super();
super(surfaceViewWeakRef.get().renderThreadManager);

mSurfaceViewWeakRef = surfaceViewWeakRef;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected void createRenderThread() {

static class VulkanThread extends MapLibreSurfaceView.RenderThread {
VulkanThread(WeakReference<MapLibreVulkanSurfaceView> surfaceViewWeakRef) {
super();
super(surfaceViewWeakRef.get().renderThreadManager);
mSurfaceViewWeakRef = surfaceViewWeakRef;
}

Expand Down

0 comments on commit 3c250e8

Please sign in to comment.