Skip to content

Commit

Permalink
remove debug stack
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Garrett committed Nov 20, 2019
1 parent c1b614b commit 36d211b
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,10 @@ import { DebugStack } from '../utils/debug-stack';
// https://github.com/glimmerjs/glimmer-vm/blob/v0.24.0-beta.4/packages/%40glimmer/runtime/lib/component/interfaces.ts#L21

export default abstract class AbstractManager<T, U> implements ComponentManager<T, U> {
public debugStack: DebugStack | undefined = undefined;

prepareArgs(_state: U, _args: Arguments): Option<PreparedArguments> {
return null;
}

// must be implemented by inheritors, inheritors should also
// call `this._pushToDebugStack` to ensure the rerendering
// assertion messages are properly maintained

abstract create(
env: Environment,
definition: U,
Expand All @@ -43,9 +37,6 @@ export default abstract class AbstractManager<T, U> implements ComponentManager<
// noop
}

// inheritors should also call `this.debugStack.pop()` to
// ensure the rerendering assertion messages are properly
// maintained
didRenderLayout(_component: T, _bounds: Bounds): void {
// noop
}
Expand All @@ -63,9 +54,6 @@ export default abstract class AbstractManager<T, U> implements ComponentManager<
// noop
}

// inheritors should also call `this.debugStack.pop()` to
// ensure the rerendering assertion messages are properly
// maintained
didUpdateLayout(_bucket: T, _bounds: Bounds): void {
// noop
}
Expand Down
16 changes: 0 additions & 16 deletions packages/@ember/-internals/glimmer/lib/component-managers/curly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,6 @@ export default class CurlyComponentManager
callerSelfRef: VersionedPathReference,
hasBlock: boolean
): ComponentStateBucket {
if (DEBUG) {
environment.debugStack.push(`component:${state.name}`);
}

// Get the nearest concrete component instance from the scope. "Virtual"
// components will be skipped.
let parentView = dynamicScope.view;
Expand Down Expand Up @@ -430,10 +426,6 @@ export default class CurlyComponentManager
if (ENV._DEBUG_RENDER_TREE) {
bucket.environment.debugRenderTree.didRender(bucket, bounds);
}

if (DEBUG) {
bucket.environment.debugStack.pop();
}
}

getTag({ args, component }: ComponentStateBucket): Tag {
Expand All @@ -455,10 +447,6 @@ export default class CurlyComponentManager
environment.debugRenderTree.update(bucket);
}

if (DEBUG) {
environment.debugStack.push(component._debugContainerKey);
}

bucket.finalizer = _instrumentStart('render.component', rerenderInstrumentDetails, component);

if (args && !validate(args.tag, argsRevision)) {
Expand Down Expand Up @@ -486,10 +474,6 @@ export default class CurlyComponentManager
if (ENV._DEBUG_RENDER_TREE) {
bucket.environment.debugRenderTree.didRender(bucket, bounds);
}

if (DEBUG) {
bucket.environment.debugStack.pop();
}
}

didUpdate({ component, environment }: ComponentStateBucket): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ class MountManager extends AbstractManager<EngineState, EngineDefinitionState>
}

create(environment: Environment, { name }: EngineDefinitionState, args: Arguments) {
if (DEBUG) {
environment.debugStack.pushEngine(`engine:${name}`);
}

// TODO
// mount is a runtime helper, this shouldn't use dynamic layout
// we should resolve the engine app template in the helper
Expand Down Expand Up @@ -172,10 +168,6 @@ class MountManager extends AbstractManager<EngineState, EngineDefinitionState>
}

didRenderLayout(bucket: EngineState, bounds: Bounds): void {
if (DEBUG) {
bucket.environment.debugStack.pop();
}

if (ENV._DEBUG_RENDER_TREE) {
bucket.environment.debugRenderTree.didRender(bucket.controller, bounds);
bucket.environment.debugRenderTree.didRender(bucket, bounds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ class OutletComponentManager extends AbstractManager<OutletInstanceState, Outlet
args: Arguments,
dynamicScope: DynamicScope
): OutletInstanceState {
if (DEBUG) {
environment.debugStack.push(`template:${definition.template.referrer.moduleName}`);
}

let parentStateRef = dynamicScope.outletState;
let currentStateRef = definition.ref;

Expand Down Expand Up @@ -167,10 +163,6 @@ class OutletComponentManager extends AbstractManager<OutletInstanceState, Outlet
didRenderLayout(state: OutletInstanceState, bounds: Bounds): void {
state.finalize();

if (DEBUG) {
state.environment.debugStack.pop();
}

if (ENV._DEBUG_RENDER_TREE) {
state.environment.debugRenderTree.didRender(state, bounds);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ class RootComponentManager extends CurlyComponentManager {
) {
let component = this.component;

if (DEBUG) {
environment.debugStack.push((component as any)._debugContainerKey);
}

let finalizer = _instrumentStart('render.component', initialRenderInstrumentDetails, component);

dynamicScope.view = component;
Expand Down
13 changes: 0 additions & 13 deletions packages/@ember/-internals/glimmer/lib/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export default class Environment extends GlimmerEnvironment {
public isInteractive: boolean;
public destroyedComponents: Destroyable[];

private _debugStack: DebugStack | undefined;
private _debugRenderTree: DebugRenderTree | undefined;
public inTransaction = false;

Expand All @@ -52,23 +51,11 @@ export default class Environment extends GlimmerEnvironment {

installPlatformSpecificProtocolForURL(this);

if (DEBUG) {
this._debugStack = getDebugStack();
}

if (ENV._DEBUG_RENDER_TREE) {
this._debugRenderTree = new DebugRenderTree();
}
}

get debugStack(): DebugStack {
if (DEBUG) {
return this._debugStack!;
} else {
throw new Error("Can't access debug stack outside of debug mode");
}
}

get debugRenderTree(): DebugRenderTree {
if (ENV._DEBUG_RENDER_TREE) {
return this._debugRenderTree!;
Expand Down
3 changes: 3 additions & 0 deletions packages/@ember/-internals/glimmer/lib/utils/references.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ export class RootPropertyReference extends PropertyReference
super();

if (DEBUG) {
// Capture the stack when this reference is created, as that is the
// component/context that the component was created _in_. Later, it could
// be accessed from any number of components.
this.debugStackLog = env ? env.debugRenderTree.logCurrentRenderStack() : '';
}

Expand Down

0 comments on commit 36d211b

Please sign in to comment.