Extended the tracing information for Bindings and Android NativeLifecycle.

This commit is contained in:
Rossen Hristov
2015-12-04 16:49:04 +02:00
parent 2c4a917af7
commit 91b46ea131
2 changed files with 12 additions and 7 deletions

View File

@ -100,7 +100,7 @@ export class Bindable extends dependencyObservable.DependencyObservable implemen
} }
public _onPropertyChanged(property: dependencyObservable.Property, oldValue: any, newValue: any) { public _onPropertyChanged(property: dependencyObservable.Property, oldValue: any, newValue: any) {
trace.write("Bindable._onPropertyChanged(" + this + ") " + property.name, trace.categories.Binding); trace.write(`${this}._onPropertyChanged(${property.name}, ${oldValue}, ${newValue})`, trace.categories.Binding);
super._onPropertyChanged(property, oldValue, newValue); super._onPropertyChanged(property, oldValue, newValue);
if (this instanceof viewModule.View) { if (this instanceof viewModule.View) {
if (property.metadata.inheritable && (<viewModule.View>(<any>this))._isInheritedChange() === true) { if (property.metadata.inheritable && (<viewModule.View>(<any>this))._isInheritedChange() === true) {
@ -110,11 +110,11 @@ export class Bindable extends dependencyObservable.DependencyObservable implemen
var binding = this.bindings[property.name]; var binding = this.bindings[property.name];
if (binding && !binding.updating) { if (binding && !binding.updating) {
if (binding.options.twoWay) { if (binding.options.twoWay) {
trace.write("_updateTwoWayBinding(" + this + "): " + property.name, trace.categories.Binding); trace.write(`${this}._updateTwoWayBinding(${property.name}, ${newValue});` + property.name, trace.categories.Binding);
this._updateTwoWayBinding(property.name, newValue); this._updateTwoWayBinding(property.name, newValue);
} }
else { else {
trace.write("_onPropertyChanged(" + this + ") removing binding for property: " + property.name, trace.categories.Binding); trace.write(`${this}.unbind(${property.name});`, trace.categories.Binding);
this.unbind(property.name); this.unbind(property.name);
} }
} }
@ -129,10 +129,7 @@ export class Bindable extends dependencyObservable.DependencyObservable implemen
continue; continue;
} }
trace.write( trace.write(`Binding ${binding.target.get()}.${binding.options.targetProperty} to new context ${newValue}`, trace.categories.Binding);
"Binding target: " + binding.target.get() +
" targetProperty: " + binding.options.targetProperty +
" to the changed context: " + newValue, trace.categories.Binding);
binding.unbind(); binding.unbind();
if (!types.isNullOrUndefined(newValue)) { if (!types.isNullOrUndefined(newValue)) {
binding.bind(newValue); binding.bind(newValue);

View File

@ -24,11 +24,13 @@ var navDepth = -1;
var PageFragmentBody = (<any>android.app.Fragment).extend({ var PageFragmentBody = (<any>android.app.Fragment).extend({
onCreate: function (savedInstanceState: android.os.Bundle) { onCreate: function (savedInstanceState: android.os.Bundle) {
trace.write(`PageFragmentBody.onCreate(${savedInstanceState})`, trace.categories.NativeLifecycle);
this.super.onCreate(savedInstanceState); this.super.onCreate(savedInstanceState);
this.super.setHasOptionsMenu(true); this.super.setHasOptionsMenu(true);
}, },
onCreateView: function (inflater: android.view.LayoutInflater, container: android.view.ViewGroup, savedInstanceState: android.os.Bundle): android.view.View { onCreateView: function (inflater: android.view.LayoutInflater, container: android.view.ViewGroup, savedInstanceState: android.os.Bundle): android.view.View {
trace.write(`PageFragmentBody.onCreateView(${inflater}, ${container}, ${savedInstanceState})`, trace.categories.NativeLifecycle);
var entry = this.entry; var entry = this.entry;
var page = entry.resolvedPage; var page = entry.resolvedPage;
if (savedInstanceState && savedInstanceState.getBoolean(HIDDEN, false)) { if (savedInstanceState && savedInstanceState.getBoolean(HIDDEN, false)) {
@ -42,6 +44,7 @@ var PageFragmentBody = (<any>android.app.Fragment).extend({
}, },
onHiddenChanged: function (hidden: boolean) { onHiddenChanged: function (hidden: boolean) {
trace.write(`PageFragmentBody.onHiddenChanged(${hidden})`, trace.categories.NativeLifecycle);
this.super.onHiddenChanged(hidden); this.super.onHiddenChanged(hidden);
if (hidden) { if (hidden) {
onFragmentHidden(this); onFragmentHidden(this);
@ -52,6 +55,7 @@ var PageFragmentBody = (<any>android.app.Fragment).extend({
}, },
onSaveInstanceState: function (outState: android.os.Bundle) { onSaveInstanceState: function (outState: android.os.Bundle) {
trace.write(`PageFragmentBody.onSaveInstanceState(${outState})`, trace.categories.NativeLifecycle);
this.super.onSaveInstanceState(outState); this.super.onSaveInstanceState(outState);
if (this.isHidden()) { if (this.isHidden()) {
outState.putBoolean(HIDDEN, true); outState.putBoolean(HIDDEN, true);
@ -59,17 +63,20 @@ var PageFragmentBody = (<any>android.app.Fragment).extend({
}, },
onDestroyView: function () { onDestroyView: function () {
trace.write(`PageFragmentBody.onDestroyView()`, trace.categories.NativeLifecycle);
this.super.onDestroyView(); this.super.onDestroyView();
onFragmentHidden(this); onFragmentHidden(this);
}, },
onDestroy: function () { onDestroy: function () {
trace.write(`PageFragmentBody.onDestroy()`, trace.categories.NativeLifecycle);
this.super.onDestroy(); this.super.onDestroy();
utils.GC(); utils.GC();
} }
}); });
function onFragmentShown(fragment) { function onFragmentShown(fragment) {
trace.write(`onFragmentShown(${fragment.toString()})`, trace.categories.NativeLifecycle);
if (fragment[CLEARING_HISTORY]) { if (fragment[CLEARING_HISTORY]) {
trace.write(`${fragment.toString() } has been shown, but we are currently clearing history. Returning.`, trace.categories.NativeLifecycle); trace.write(`${fragment.toString() } has been shown, but we are currently clearing history. Returning.`, trace.categories.NativeLifecycle);
return null; return null;
@ -106,6 +113,7 @@ function onFragmentShown(fragment) {
} }
function onFragmentHidden(fragment) { function onFragmentHidden(fragment) {
trace.write(`onFragmentHidden(${fragment.toString()})`, trace.categories.NativeLifecycle);
if (fragment[CLEARING_HISTORY]) { if (fragment[CLEARING_HISTORY]) {
trace.write(`${fragment.toString() } has been hidden, but we are currently clearing history. Returning.`, trace.categories.NativeLifecycle); trace.write(`${fragment.toString() } has been hidden, but we are currently clearing history. Returning.`, trace.categories.NativeLifecycle);
return null; return null;