Back out 5ebd6549bf93 and 73287cb2dc6a (bug 794091) on suspicion of breaking Win64 PGO builds

This commit is contained in:
Phil Ringnalda 2012-11-08 20:43:18 -08:00
Родитель 0c814d1bdf
Коммит 8028630a5a
8 изменённых файлов: 38 добавлений и 42 удалений

Просмотреть файл

@ -79,7 +79,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/debug.js");
Cu.import("resource:///modules/TelemetryTimestamps.jsm");
Cu.import("resource://gre/modules/TelemetryStopwatch.jsm");
Cu.import("resource://gre/modules/osfile.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
@ -442,18 +441,9 @@ let SessionStoreInternal = {
this._prefBranch.getBoolPref("sessionstore.resume_session_once"))
this._prefBranch.setBoolPref("sessionstore.resume_session_once", false);
this._initEncoding();
this._initialized = true;
},
_initEncoding : function ssi_initEncoding() {
// The (UTF-8) encoder used to write to files.
XPCOMUtils.defineLazyGetter(this, "_writeFileEncoder", function () {
return new TextEncoder();
});
},
_initPrefs : function() {
XPCOMUtils.defineLazyGetter(this, "_prefBranch", function () {
return Services.prefs.getBranch("browser.");
@ -4445,21 +4435,27 @@ let SessionStoreInternal = {
_writeFile: function ssi_writeFile(aFile, aData) {
let refObj = {};
TelemetryStopwatch.start("FX_SESSION_RESTORE_WRITE_FILE_MS", refObj);
let path = aFile.path;
let encoded = this._writeFileEncoder.encode(aData);
let promise = OS.File.writeAtomic(path, encoded, {tmpPath: path + ".tmp"});
// Initialize the file output stream.
var ostream = Cc["@mozilla.org/network/safe-file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
ostream.init(aFile, 0x02 | 0x08 | 0x20, 0600, ostream.DEFER_OPEN);
promise.then(
function onSuccess() {
// Obtain a converter to convert our data to a UTF-8 encoded input stream.
var converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
// Asynchronously copy the data to the file.
var istream = converter.convertToInputStream(aData);
var self = this;
NetUtil.asyncCopy(istream, ostream, function(rc) {
if (Components.isSuccessCode(rc)) {
TelemetryStopwatch.finish("FX_SESSION_RESTORE_WRITE_FILE_MS", refObj);
Services.obs.notifyObservers(null,
"sessionstore-state-write-complete",
"");
},
function onFailure(reason) {
TelemetryStopwatch.cancel("FX_SESSION_RESTORE_WRITE_FILE_MS", refObj);
Components.reportError("ssi_writeFile failure " + reason);
});
"sessionstore-state-write-complete",
"");
}
});
}
};

Просмотреть файл

@ -10,26 +10,9 @@ if (typeof Components != "undefined") {
this.EXPORTED_SYMBOLS = ["OS"];
Components.utils.import("resource://gre/modules/osfile/osfile_async_front.jsm", this);
} else {
// At this stage, we need to import all sources at once to avoid
// a unique failure on tbpl + talos that seems caused by a
// what looks like a nested event loop bug (see bug 794091).
#ifdef XP_WIN
importScripts(
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm",
"resource://gre/modules/osfile/osfile_win_allthreads.jsm",
"resource://gre/modules/osfile/ospath_win_back.jsm",
"resource://gre/modules/osfile/osfile_win_back.jsm",
"resource://gre/modules/osfile/osfile_shared_front.jsm",
"resource://gre/modules/osfile/osfile_win_front.jsm"
);
importScripts("resource://gre/modules/osfile/osfile_win_front.jsm");
#else
importScripts(
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm",
"resource://gre/modules/osfile/osfile_unix_allthreads.jsm",
"resource://gre/modules/osfile/ospath_unix_back.jsm",
"resource://gre/modules/osfile/osfile_unix_back.jsm",
"resource://gre/modules/osfile/osfile_shared_front.jsm",
"resource://gre/modules/osfile/osfile_unix_front.jsm"
);
importScripts("resource://gre/modules/osfile/osfile_unix_front.jsm");
#endif
}
}

Просмотреть файл

@ -22,6 +22,9 @@ if (typeof Components != "undefined") {
this.EXPORTED_SYMBOLS = ["OS"];
Components.utils.import("resource://gre/modules/ctypes.jsm");
Components.utils.import("resource://gre/modules/osfile/osfile_shared_allthreads.jsm", this);
} else {
// File is included from a chrome worker
importScripts("resource://gre/modules/osfile/osfile_shared_allthreads.jsm");
}
(function(exports) {

Просмотреть файл

@ -11,6 +11,8 @@
throw new Error("osfile_unix_back.jsm cannot be used from the main thread yet");
}
importScripts("resource://gre/modules/osfile/osfile_shared_allthreads.jsm");
importScripts("resource://gre/modules/osfile/osfile_unix_allthreads.jsm");
(function(exports) {
"use strict";
if (!exports.OS) {

Просмотреть файл

@ -16,6 +16,9 @@
throw new Error("osfile_unix_front.jsm cannot be used from the main thread yet");
}
importScripts("resource://gre/modules/osfile/osfile_unix_back.jsm");
importScripts("resource://gre/modules/osfile/ospath_unix_back.jsm");
importScripts("resource://gre/modules/osfile/osfile_shared_front.jsm");
(function(exports) {
"use strict";

Просмотреть файл

@ -22,6 +22,9 @@ if (typeof Components != "undefined") {
this.EXPORTED_SYMBOLS = ["OS"];
Components.utils.import("resource://gre/modules/ctypes.jsm");
Components.utils.import("resource://gre/modules/osfile/osfile_shared_allthreads.jsm", this);
} else {
// File is included from a chrome worker
importScripts("resource://gre/modules/osfile/osfile_shared_allthreads.jsm");
}
(function(exports) {

Просмотреть файл

@ -28,6 +28,8 @@
throw new Error("osfile_win.jsm cannot be used from the main thread yet");
}
importScripts("resource://gre/modules/osfile/osfile_shared_allthreads.jsm");
importScripts("resource://gre/modules/osfile/osfile_win_allthreads.jsm");
(function(exports) {
"use strict";

Просмотреть файл

@ -16,6 +16,10 @@
throw new Error("osfile_win_front.jsm cannot be used from the main thread yet");
}
importScripts("resource://gre/modules/osfile/osfile_win_back.jsm");
importScripts("resource://gre/modules/osfile/ospath_win_back.jsm");
importScripts("resource://gre/modules/osfile/osfile_shared_front.jsm");
(function(exports) {
"use strict";