Skip to content

Commit

Permalink
more work on refining instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
btford committed Nov 14, 2012
1 parent 6871f87 commit e2d2ba9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
11 changes: 7 additions & 4 deletions js/inject/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ var inject = function () {
applyPerf: {},

scopes: {}, // map of scope.$ids --> scope objects
rootScopes: [], // array of refs to root scopes
rootScopes: {}, // map of $ids --> refs to root scopes

deps: []
};
Expand Down Expand Up @@ -268,7 +268,6 @@ var inject = function () {
return ret;
};
} else {
var thatScope = this;
watchExpression = function () {
var start = window.performance.webkitNow();
var ret = thatScope.$eval(w);
Expand All @@ -281,7 +280,7 @@ var inject = function () {

// patch applyFunction
// -------------------
if (applyFunction) {
if (typeof applyFunction === 'function') {
var applyStr = applyFunction.toString();
var unpatchedApplyFunction = applyFunction;
applyFunction = function () {
Expand Down Expand Up @@ -323,13 +322,17 @@ var inject = function () {
$delegate.__proto__.$new = function () {
var ret = _new.apply(this, arguments);

if (ret.$root) {
debug.rootScopes[ret.$root.$id] = ret.$root;
}

// create empty watchers array for this scope
if (!debug.watchers[ret.$id]) {
debug.watchers[ret.$id] = [];
}

return ret;
}
};

// patch apply
// -----------
Expand Down
15 changes: 5 additions & 10 deletions js/services/appContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ panelApp.factory('appContext', function (chromeExtension) {
}
},
function (data) {
_debugCache = data;
if (data) {
_debugCache = data;
}
_pollListeners.forEach(function (fn) {
fn();
});
Expand All @@ -30,12 +32,6 @@ panelApp.factory('appContext', function (chromeExtension) {
};
getDebugData();

// Helpers
// =======




// Public API
// ==========
return {
Expand Down Expand Up @@ -83,7 +79,6 @@ panelApp.factory('appContext', function (chromeExtension) {
return _debugCache.deps;
},


getAngularVersion: function (cb) {
chromeExtension.eval(function () {
return window.angular.version.full +
Expand Down Expand Up @@ -157,7 +152,7 @@ panelApp.factory('appContext', function (chromeExtension) {

getDebug: function (cb) {
chromeExtension.eval(function (window) {
return document.cookie.indexOf('__ngDebug=true') != -1;
return document.cookie.indexOf('__ngDebug=true') !== -1;
}, cb);
},

Expand All @@ -169,7 +164,7 @@ panelApp.factory('appContext', function (chromeExtension) {
'}');
},

// takes # of miliseconds
// takes # of milliseconds
setPollInterval: function (setting) {
_pollInterval = setting;
},
Expand Down

0 comments on commit e2d2ba9

Please sign in to comment.