Commit 72ba736a by olly Committed by Oliver Woodman

Clear up BaseRenderer.disable

- Call onDisabled last. onDisabled really shouldn't be doing
  anything with the stream, so pretty sure this is fine (and
  guarantees the stream is cleared properly even if onDisabled
  throws a RTE).
- Remove super.onDisabled calls from Text/Metadata renderers.
  This is just for consistency; we don't make such calls in
  other direct descendants of BaseRenderer.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156130640
parent 84875bbe
......@@ -142,9 +142,9 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
public final void disable() {
Assertions.checkState(state == STATE_ENABLED);
state = STATE_DISABLED;
onDisabled();
stream = null;
streamIsFinal = false;
onDisabled();
}
// RendererCapabilities implementation.
......@@ -300,8 +300,6 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
/**
* Returns whether the upstream source is ready.
*
* @return Whether the source is ready.
*/
protected final boolean isSourceReady() {
return readEndOfStream ? streamIsFinal : stream.isReady();
......
......@@ -153,7 +153,6 @@ public final class MetadataRenderer extends BaseRenderer implements Callback {
protected void onDisabled() {
flushPendingMetadata();
decoder = null;
super.onDisabled();
}
@Override
......
......@@ -254,7 +254,6 @@ public final class TextRenderer extends BaseRenderer implements Callback {
streamFormat = null;
clearOutput();
releaseDecoder();
super.onDisabled();
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment