Skip to content

Commit

Permalink
Minor fix to freeze state setter & Rename the caching properties
Browse files Browse the repository at this point in the history
  • Loading branch information
arickp authored and arickp committed Jan 3, 2017
1 parent fb5b834 commit 0b57afb
Showing 1 changed file with 15 additions and 13 deletions.
Expand Up @@ -32,8 +32,10 @@ public static enum ProfileMode
private final SimpleObjectProperty<FlameGraph> flameGraph;

private boolean frozen;
private Profile frozenProfile;
private FlameGraph frozenFlameGraph;
// While frozen, incoming profiles/graphs are cached in the following 2
// instance properties.
private Profile cachedProfile;
private FlameGraph cachedFlameGraph;

public ProfileContext(String name, ProfileMode mode)
{
Expand Down Expand Up @@ -85,23 +87,23 @@ public boolean isFrozen()
}

// Call only on FX Thread !
public void setFrozen(boolean frozen)
public void setFrozen(boolean freeze)
{
if (!frozen)
this.frozen = freeze;
if (!freeze)
{
if (frozenProfile != null)
if (cachedProfile != null)
{
update(frozenProfile);
frozenProfile = null;
update(cachedProfile);
cachedProfile = null;
}

if (frozenFlameGraph != null)
if (cachedFlameGraph != null)
{
update(frozenFlameGraph);
frozenFlameGraph = null;
update(cachedFlameGraph);
cachedFlameGraph = null;
}
}
this.frozen = frozen;
}

public ProfileListener getProfileListener()
Expand Down Expand Up @@ -147,7 +149,7 @@ private void update(Profile t)
{
if (frozen)
{
frozenProfile = t;
cachedProfile = t;
}
else
{
Expand All @@ -159,7 +161,7 @@ private void update(FlameGraph t)
{
if (frozen)
{
frozenFlameGraph = t;
cachedFlameGraph = t;
}
else
{
Expand Down

0 comments on commit 0b57afb

Please sign in to comment.