From 4f5428a3f8737c8200c04cd8c954bc20af0e2004 Mon Sep 17 00:00:00 2001 From: Harshad Vedartham Date: Thu, 15 Aug 2024 23:12:54 -0700 Subject: [PATCH] Removed unnecessary 'synchronized' calls for perf --- .../frontend/textview/HighlightingEditor.java | 2 +- .../frontend/textview/SyntaxHighlighterBase.java | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/net/gsantner/markor/frontend/textview/HighlightingEditor.java b/app/src/main/java/net/gsantner/markor/frontend/textview/HighlightingEditor.java index d5dfc845c..b513682d1 100644 --- a/app/src/main/java/net/gsantner/markor/frontend/textview/HighlightingEditor.java +++ b/app/src/main/java/net/gsantner/markor/frontend/textview/HighlightingEditor.java @@ -110,7 +110,7 @@ public boolean onPreDraw() { } @Override - protected void onDraw(Canvas canvas) { + protected void onDraw(final Canvas canvas) { super.onDraw(canvas); if (_numEnabled) { diff --git a/app/src/main/java/net/gsantner/markor/frontend/textview/SyntaxHighlighterBase.java b/app/src/main/java/net/gsantner/markor/frontend/textview/SyntaxHighlighterBase.java index 70092becc..3b30f6af2 100644 --- a/app/src/main/java/net/gsantner/markor/frontend/textview/SyntaxHighlighterBase.java +++ b/app/src/main/java/net/gsantner/markor/frontend/textview/SyntaxHighlighterBase.java @@ -154,7 +154,7 @@ public SyntaxHighlighterBase clearAll() { * * @return this */ - public synchronized SyntaxHighlighterBase clearDynamic() { + public SyntaxHighlighterBase clearDynamic() { if (_spannable == null) { return this; } @@ -173,7 +173,7 @@ public synchronized SyntaxHighlighterBase clearDynamic() { * * @return this */ - public synchronized SyntaxHighlighterBase clearStatic() { + public SyntaxHighlighterBase clearStatic() { if (_spannable == null) { return this; } @@ -197,7 +197,7 @@ public synchronized SyntaxHighlighterBase clearStatic() { * @param spannable Spannable to work on * @return this */ - public synchronized SyntaxHighlighterBase setSpannable(@Nullable final Spannable spannable) { + public SyntaxHighlighterBase setSpannable(@Nullable final Spannable spannable) { if (spannable != _spannable) { _groups.clear(); _appliedDynamic.clear(); @@ -232,7 +232,7 @@ public SyntaxHighlighterBase fixup(final int start, final int before, final int * @param delta Apply to * @return this */ - public synchronized SyntaxHighlighterBase fixup(final int after, final int delta) { + public SyntaxHighlighterBase fixup(final int after, final int delta) { for (int i = _groups.size() - 1; i >= 0; i--) { final SpanGroup group = _groups.get(i); // Very simple fixup. If the group is entirely after 'after', adjust it's region @@ -260,7 +260,7 @@ public SyntaxHighlighterBase applyDynamic() { * * @return this */ - public synchronized SyntaxHighlighterBase applyDynamic(final int[] range) { + public SyntaxHighlighterBase applyDynamic(final int[] range) { if (_spannable == null) { return this; } @@ -292,7 +292,7 @@ public synchronized SyntaxHighlighterBase applyDynamic(final int[] range) { return this; } - public synchronized SyntaxHighlighterBase applyStatic() { + public SyntaxHighlighterBase applyStatic() { if (_spannable == null || _staticApplied) { return this; } @@ -314,7 +314,7 @@ public final SyntaxHighlighterBase reflow() { } // Reflow selected region's lines - public final synchronized SyntaxHighlighterBase reflow(final int[] range) { + public final SyntaxHighlighterBase reflow(final int[] range) { if (TextViewUtils.checkRange(_spannable, range)) { _spannable.setSpan(_layoutUpdater, range[0], range[1], Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); _spannable.removeSpan(_layoutUpdater); @@ -328,7 +328,7 @@ public final synchronized SyntaxHighlighterBase reflow(final int[] range) { * * @return this */ - public synchronized final SyntaxHighlighterBase recompute() { + public final SyntaxHighlighterBase recompute() { _groups.clear(); _appliedDynamic.clear(); _staticApplied = false;