Skip to content

Commit

Permalink
Allow profile format selection using pref
Browse files Browse the repository at this point in the history
  • Loading branch information
bgirard committed Apr 10, 2012
1 parent 384139a commit 178a5d9
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions lib/main.js
Expand Up @@ -39,7 +39,9 @@ Cu.import("resource://gre/modules/AddonManager.jsm");

//var DEFAULT_UI_URL = "http://ehsan.github.com/cleopatra/";
var DEFAULT_UI_URL = "http://varium.fantasytalesonline.com/cleopatra/";
//var DEFAULT_UI_URL = "file:///Users/bgirard/ben/sps/cleopatra/index.html";
//var DEFAULT_UI_URL = "http://localhost/~markus/cleopatra/";
var DEFAULT_PROFILE_FORMAT = "string"; // or json

let data = require("self").data;
let clipboard = require("clipboard");
Expand Down Expand Up @@ -104,6 +106,15 @@ function has_feature(feature) {
return false;
return profilerFeatures.indexOf(feature) !== -1;
}
function get_profile_format() {
return get_pref_string("profiler.", "format", DEFAULT_PROFILE_FORMAT).toLowerCase();
}
function is_string_profile_format() {
return get_profile_format() === "string";
}
function is_json_profile_format() {
return get_profile_format() === "json";
}

function sps_startup(force) {
if (get_pref_bool("profiler.", "enabled") || force == true) {
Expand Down Expand Up @@ -153,8 +164,12 @@ function get_profile(progress_callback, finish_callback) {
progress_callback({progress: 0, action: "Retrieving profile"});
}
timers.setTimeout(function() {
var profile = profiler.getProfileData();
console.log("Profile: " + profile);
var profile;
if (is_string_profile_format()) {
profile = profiler.GetProfile();
} else {
profile = profiler.getProfileData();
}
if (profile == null) {
progress_callback({progress: 1, action: "Empty profile"});
return;
Expand Down

0 comments on commit 178a5d9

Please sign in to comment.