Merge last green changeset from mozilla-central to mozilla-inbound

This commit is contained in:
Matt Brubeck 2011-08-19 16:26:25 -07:00
Родитель 0d83f6cb50 1b4b04d3c1
Коммит eb3dcefecf
64 изменённых файлов: 932 добавлений и 6108 удалений

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

@ -203,6 +203,21 @@ codesighs:
# defined in package-name.mk
export MOZ_SOURCE_STAMP
#XXX: this is a hack, since we don't want to clobber for MSVC
# PGO support, but we can't do this test in client.mk
ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
# No point in clobbering if PGO has been explicitly disabled.
ifndef NO_PROFILE_GUIDED_OPTIMIZE
maybe_clobber_profiledbuild: clean
else
maybe_clobber_profiledbuild:
endif
else
maybe_clobber_profiledbuild:
endif
.PHONY: maybe_clobber_profiledbuild
# Look for R_386_PC32 relocations in shared libs, these
# break x86_64 builds and SELinux users.
ifeq ($(OS_TARGET)_$(TARGET_XPCOM_ABI),Linux_x86-gcc3)

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

@ -184,23 +184,6 @@ let Storage = {
return existingData;
},
// ----------
// Function: readWindowBusyState
// Returns the current busyState for the given window.
readWindowBusyState: function Storage_readWindowBusyState(win) {
let state;
try {
let data = this._sessionStore.getWindowState(win);
if (data)
state = JSON.parse(data);
} catch (e) {
Utils.log("Error while parsing window state");
}
return (state && state.windows[0].busy);
},
// ----------
// Function: saveGroupItemsData
// Saves the global data for the <GroupItems> singleton for the given window.

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

@ -123,9 +123,9 @@ let UI = {
wasInTabView: false
},
// Variable: _storageBusy
// Tells whether the storage is currently busy or not.
_storageBusy: false,
// Variable: _storageBusyCount
// Used to keep track of how many calls to storageBusy vs storageReady.
_storageBusyCount: 0,
// Variable: isDOMWindowClosing
// Tells wether the parent window is about to close
@ -169,10 +169,6 @@ let UI = {
// ___ storage
Storage.init();
if (Storage.readWindowBusyState(gWindow))
this.storageBusy();
let data = Storage.readUIData(gWindow);
this._storageSanity(data);
this._pageBounds = data.pageBounds;
@ -616,13 +612,12 @@ let UI = {
// Pauses the storage activity that conflicts with sessionstore updates and
// private browsing mode switches. Calls can be nested.
storageBusy: function UI_storageBusy() {
if (this._storageBusy)
return;
this._storageBusy = true;
if (!this._storageBusyCount) {
TabItems.pauseReconnecting();
GroupItems.pauseAutoclose();
}
this._storageBusyCount++;
},
// ----------
@ -630,11 +625,8 @@ let UI = {
// Resumes the activity paused by storageBusy, and updates for any new group
// information in sessionstore. Calls can be nested.
storageReady: function UI_storageReady() {
if (!this._storageBusy)
return;
this._storageBusy = false;
this._storageBusyCount--;
if (!this._storageBusyCount) {
let hasGroupItemsData = GroupItems.load();
if (!hasGroupItemsData)
this.reset();
@ -642,6 +634,7 @@ let UI = {
TabItems.resumeReconnecting();
GroupItems._updateTabBar();
GroupItems.resumeAutoclose();
}
},
// ----------
@ -737,7 +730,7 @@ let UI = {
} else {
// If we're currently in the process of entering private browsing,
// we don't want to go to the Tab View UI.
if (self._storageBusy)
if (self._storageBusyCount)
return;
// if not closing the last tab

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

@ -37,20 +37,26 @@ function setupTwo(win) {
contentWindow.TabItems.update(tabItem.tab);
tabItem.addSubscriber("savedCachedImageData", function onSaved(item) {
item.removeSubscriber("savedCachedImageData", onSaved);
if (!--numTabsToSave)
restoreWindow();
--numTabsToSave;
});
});
// after the window is closed, restore it.
let restoreWindow = function() {
let xulWindowDestory = function() {
Services.obs.removeObserver(
xulWindowDestory, "xul-window-destroyed", false);
// "xul-window-destroyed" is just fired just before a XUL window is
// destroyed so restore window and test it after a delay
executeSoon(function() {
restoredWin = undoCloseWindow();
restoredWin.addEventListener("load", function onLoad(event) {
restoredWin.removeEventListener("load", onLoad, false);
registerCleanupFunction(function() restoredWin.close());
// ensure that closed tabs have been saved
is(numTabsToSave, 0, "All tabs were saved when window was closed.");
is(restoredWin.gBrowser.tabs.length, 3, "The total number of tabs is 3");
// setup tab variables and listen to the tabs load progress
@ -97,6 +103,7 @@ function setupTwo(win) {
}, false);
});
};
Services.obs.addObserver(xulWindowDestory, "xul-window-destroyed", false);
win.close();
}

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

@ -49,15 +49,11 @@ function onTabViewLoadedAndShown() {
groupTitles[a] = gi.getTitle();
}
contentWindow.gPrefBranch.setBoolPref("animate_zoom", false);
// Create a second tab
gBrowser.addTab("about:robots");
is(gBrowser.tabs.length, 2, "we now have 2 tabs");
registerCleanupFunction(function() {
gBrowser.removeTab(gBrowser.tabs[1]);
contentWindow.gPrefBranch.clearUserPref("animate_zoom");
});
afterAllTabsLoaded(function() {

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

@ -361,10 +361,7 @@ function togglePrivateBrowsing(callback) {
Services.obs.addObserver(function observe() {
Services.obs.removeObserver(observe, topic);
// use executeSoon() to let Panorama load its group data from the session
// before we call afterAllTabsLoaded()
executeSoon(function () afterAllTabsLoaded(callback));
afterAllTabsLoaded(callback);
}, topic, false);
let pb = Cc["@mozilla.org/privatebrowsing;1"].

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

@ -785,7 +785,7 @@ SessionStoreService.prototype = {
aWindow.__SSi = "window" + Date.now();
// and create its data object
this._windows[aWindow.__SSi] = { tabs: [], selected: 0, _closedTabs: [], busy: false };
this._windows[aWindow.__SSi] = { tabs: [], selected: 0, _closedTabs: [] };
if (!this._isWindowLoaded(aWindow))
this._windows[aWindow.__SSi]._restoring = true;
if (!aWindow.toolbar.visible)
@ -969,9 +969,6 @@ SessionStoreService.prototype = {
// save the window if it has multiple tabs or a single saveable tab
if (winData.tabs.length > 1 ||
(winData.tabs.length == 1 && this._shouldSaveTabState(winData.tabs[0]))) {
// we don't want to save the busy state
delete winData.busy;
this._closedWindows.unshift(winData);
this._capClosedWindows();
}
@ -1268,7 +1265,7 @@ SessionStoreService.prototype = {
throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
var window = aTab.ownerDocument.defaultView;
this._setWindowStateBusy(window);
this._sendWindowStateEvent(window, "Busy");
this.restoreHistoryPrecursor(window, [aTab], [tabState], 0, 0, 0);
},
@ -1284,7 +1281,7 @@ SessionStoreService.prototype = {
tabState.index = Math.max(1, Math.min(tabState.index, tabState.entries.length));
tabState.pinned = false;
this._setWindowStateBusy(aWindow);
this._sendWindowStateEvent(aWindow, "Busy");
let newTab = aTab == aWindow.gBrowser.selectedTab ?
aWindow.gBrowser.addTab(null, {relatedToCurrent: true, ownerTab: aTab}) :
aWindow.gBrowser.addTab();
@ -1327,7 +1324,7 @@ SessionStoreService.prototype = {
let closedTab = closedTabs.splice(aIndex, 1).shift();
let closedTabState = closedTab.state;
this._setWindowStateBusy(aWindow);
this._sendWindowStateEvent(aWindow, "Busy");
// create a new tab
let browser = aWindow.gBrowser;
let tab = browser.addTab();
@ -2537,7 +2534,7 @@ SessionStoreService.prototype = {
// We're not returning from this before we end up calling restoreHistoryPrecursor
// for this window, so make sure we send the SSWindowStateBusy event.
this._setWindowStateBusy(aWindow);
this._sendWindowStateEvent(aWindow, "Busy");
if (root._closedWindows)
this._closedWindows = root._closedWindows;
@ -2724,7 +2721,7 @@ SessionStoreService.prototype = {
if (aTabs.length == 0) {
// this is normally done in restoreHistory() but as we're returning early
// here we need to take care of it.
this._setWindowStateReady(aWindow);
this._sendWindowStateEvent(aWindow, "Ready");
return;
}
@ -2869,7 +2866,7 @@ SessionStoreService.prototype = {
if (aTabs.length == 0) {
// At this point we're essentially ready for consumers to read/write data
// via the sessionstore API so we'll send the SSWindowStateReady event.
this._setWindowStateReady(aWindow);
this._sendWindowStateEvent(aWindow, "Ready");
return; // no more tabs to restore
}
@ -4014,42 +4011,6 @@ SessionStoreService.prototype = {
this._restoreCount = -1;
},
/**
* Set the given window's busy state
* @param aWindow the window
* @param aValue the window's busy state
*/
_setWindowStateBusyValue:
function sss__changeWindowStateBusyValue(aWindow, aValue) {
this._windows[aWindow.__SSi].busy = aValue;
// Keep the to-be-restored state in sync because that is returned by
// getWindowState() as long as the window isn't loaded, yet.
if (!this._isWindowLoaded(aWindow)) {
let stateToRestore = this._statesToRestore[aWindow.__SS_restoreID].windows[0];
stateToRestore.busy = aValue;
}
},
/**
* Set the given window's state to 'not busy'.
* @param aWindow the window
*/
_setWindowStateReady: function sss__setWindowStateReady(aWindow) {
this._setWindowStateBusyValue(aWindow, false);
this._sendWindowStateEvent(aWindow, "Ready");
},
/**
* Set the given window's state to 'busy'.
* @param aWindow the window
*/
_setWindowStateBusy: function sss__setWindowStateBusy(aWindow) {
this._setWindowStateBusyValue(aWindow, true);
this._sendWindowStateEvent(aWindow, "Busy");
},
/**
* Dispatch an SSWindowState_____ event for the given window.
* @param aWindow the window

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

@ -151,7 +151,6 @@ _BROWSER_TEST_FILES = \
browser_636279.js \
browser_645428.js \
browser_659591.js \
browser_662812.js \
$(NULL)
ifneq ($(OS_ARCH),Darwin)

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

@ -4,6 +4,8 @@
const TAB_STATE_NEEDS_RESTORE = 1;
const TAB_STATE_RESTORING = 2;
let stateBackup = ss.getBrowserState();
let state = {windows:[{tabs:[
{entries:[{url:"http://example.com#1"}]},
{entries:[{url:"http://example.com#2"}]},
@ -20,12 +22,20 @@ function test() {
registerCleanupFunction(function () {
Services.prefs.clearUserPref("browser.sessionstore.restore_hidden_tabs");
TabsProgressListener.uninit();
ss.setBrowserState(stateBackup);
});
TabsProgressListener.init();
// First stage: restoreHiddenTabs = true
// Second stage: restoreHiddenTabs = false
test_loadTabs(true, function () {
test_loadTabs(false, finish);
test_loadTabs(false, function () {
waitForFocus(finish);
});
});
}
@ -33,9 +43,10 @@ function test_loadTabs(restoreHiddenTabs, callback) {
Services.prefs.setBoolPref("browser.sessionstore.restore_hidden_tabs", restoreHiddenTabs);
let expectedTabs = restoreHiddenTabs ? 8 : 4;
let firstProgress = true;
newWindowWithState(state, function (win, needsRestore, isRestoring) {
TabsProgressListener.setCallback(function (needsRestore, isRestoring) {
if (firstProgress) {
firstProgress = false;
is(isRestoring, 3, "restoring 3 tabs concurrently");
@ -43,75 +54,60 @@ function test_loadTabs(restoreHiddenTabs, callback) {
ok(isRestoring < 4, "restoring max. 3 tabs concurrently");
}
if (win.gBrowser.tabs.length - needsRestore == expectedTabs) {
is(win.gBrowser.visibleTabs.length, 4, "only 4 visible tabs");
TabsProgressListener.uninit();
if (gBrowser.tabs.length - needsRestore == expectedTabs) {
TabsProgressListener.unsetCallback();
is(gBrowser.visibleTabs.length, 4, "only 4 visible tabs");
callback();
}
});
ss.setBrowserState(JSON.stringify(state));
}
function countTabs() {
let needsRestore = 0, isRestoring = 0;
let windowsEnum = Services.wm.getEnumerator("navigator:browser");
while (windowsEnum.hasMoreElements()) {
let window = windowsEnum.getNext();
if (window.closed)
continue;
for (let i = 0; i < window.gBrowser.tabs.length; i++) {
let browser = window.gBrowser.tabs[i].linkedBrowser;
if (browser.__SS_restoreState == TAB_STATE_RESTORING)
isRestoring++;
else if (browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE)
needsRestore++;
}
}
return [needsRestore, isRestoring];
}
let TabsProgressListener = {
init: function (win) {
this.window = win;
this.window.gBrowser.addTabsProgressListener(this);
init: function () {
gBrowser.addTabsProgressListener(this);
},
uninit: function () {
this.window.gBrowser.removeTabsProgressListener(this);
delete this.window;
delete this.callback;
this.unsetCallback();
gBrowser.removeTabsProgressListener(this);
},
setCallback: function (callback) {
this.callback = callback;
},
unsetCallback: function () {
delete this.callback;
},
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
if (this.callback && aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)
this.callback.apply(null, [this.window].concat(this.countTabs()));
},
countTabs: function () {
let needsRestore = 0, isRestoring = 0;
for (let i = 0; i < this.window.gBrowser.tabs.length; i++) {
let browser = this.window.gBrowser.tabs[i].linkedBrowser;
if (browser.__SS_restoreState == TAB_STATE_RESTORING)
isRestoring++;
else if (browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE)
needsRestore++;
}
return [needsRestore, isRestoring];
this.callback.apply(null, countTabs());
}
}
// ----------
function whenWindowLoaded(win, callback) {
win.addEventListener("load", function onLoad() {
win.removeEventListener("load", onLoad, false);
executeSoon(callback);
}, false);
}
// ----------
function newWindowWithState(state, callback) {
let opts = "chrome,all,dialog=no,height=800,width=800";
let win = window.openDialog(getBrowserURL(), "_blank", opts);
registerCleanupFunction(function () win.close());
whenWindowLoaded(win, function () {
TabsProgressListener.init(win);
TabsProgressListener.setCallback(callback);
ss.setWindowState(win, JSON.stringify(state), true);
});
}

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

@ -1,34 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
window.addEventListener("SSWindowStateBusy", function onBusy() {
window.removeEventListener("SSWindowStateBusy", onBusy, false);
let state = JSON.parse(ss.getWindowState(window));
ok(state.windows[0].busy, "window is busy");
window.addEventListener("SSWindowStateReady", function onReady() {
window.removeEventListener("SSWindowStateReady", onReady, false);
let state = JSON.parse(ss.getWindowState(window));
ok(!state.windows[0].busy, "window is not busy");
gBrowser.removeTab(gBrowser.tabs[1]);
executeSoon(finish);
}, false);
}, false);
// create a new tab
let tab = gBrowser.addTab("about:mozilla");
let browser = tab.linkedBrowser;
// close and restore it
browser.addEventListener("load", function onLoad() {
browser.removeEventListener("load", onLoad, true);
gBrowser.removeTab(tab);
ss.undoCloseTab(window, 0);
}, true);
}

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

@ -212,6 +212,7 @@ profiledbuild::
$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_GENERATE=1
$(MAKE) -C $(PGO_OBJDIR) package
OBJDIR=${PGO_OBJDIR} JARLOG_DIR=${PGO_OBJDIR}/jarlog/en-US $(PROFILE_GEN_SCRIPT)
$(MAKE) -f $(TOPSRCDIR)/client.mk maybe_clobber_profiledbuild
$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_USE=1
#####################################################
@ -253,7 +254,7 @@ endif
# loop through them.
ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_BUILD_PROJECTS),,1))
configure depend realbuild install export libs clean realclean distclean alldep preflight postflight upload sdk::
configure depend realbuild install export libs clean realclean distclean alldep preflight postflight maybe_clobber_profiledbuild upload sdk::
set -e; \
for app in $(MOZ_BUILD_PROJECTS); do \
$(MAKE) -f $(TOPSRCDIR)/client.mk $@ MOZ_CURRENT_PROJECT=$$app; \
@ -353,7 +354,7 @@ realbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
# Other targets
# Pass these target onto the real build system
install export libs clean realclean distclean alldep upload sdk:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
install export libs clean realclean distclean alldep maybe_clobber_profiledbuild upload sdk:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
$(MOZ_MAKE) $@
####################################
@ -412,4 +413,4 @@ echo-variable-%:
# in parallel.
.NOTPARALLEL:
.PHONY: checkout real_checkout depend realbuild build profiledbuild export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all upload sdk
.PHONY: checkout real_checkout depend realbuild build profiledbuild maybe_clobber_profiledbuild export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all upload sdk

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

@ -898,9 +898,6 @@ ifdef SHARED_LIBRARY
$(SHARED_LIBRARY_NAME) $(DIST)/$(MOZ_APP_NAME)
endif
endif # SHARED_LIBRARY || PROGRAM
else # ! WINNT_
# Force rebuilding all objects on the second pass
$(OBJS): FORCE
endif # WINNT_
endif # MOZ_PROFILE_USE
ifdef MOZ_PROFILE_GENERATE

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

@ -118,8 +118,15 @@ interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
[notxpcom] nsIContent getOwnerContent();
};
[scriptable, uuid(ed6522fd-ffb6-4920-b50d-cf629309616b)]
interface nsIChromeFrameMessageManager : nsIFrameMessageManager
[scriptable, uuid(6331bbca-2c9f-4766-b3c7-ae75554bf1ec)]
interface nsITreeItemFrameMessageManager : nsIFrameMessageManager
{
readonly attribute unsigned long childCount;
nsITreeItemFrameMessageManager getChildAt(in unsigned long aIndex);
};
[scriptable, uuid(23e6ef7b-8cc5-4e8b-9391-453440a3b858)]
interface nsIChromeFrameMessageManager : nsITreeItemFrameMessageManager
{
/*
* Load a script in the (remote) frame. aURL must be the absolute URL.

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

@ -1791,7 +1791,7 @@ nsFrameLoader::TryRemoteBrowser()
return false;
}
ContentParent* parent = ContentParent::GetSingleton();
ContentParent* parent = ContentParent::GetNewOrUsed();
NS_ASSERTION(parent->IsAlive(), "Process parent should be alive; something is very wrong!");
mRemoteBrowser = parent->CreateTab(chromeFlags);
if (mRemoteBrowser) {

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

@ -98,6 +98,8 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameMessageManager)
!mChrome && !mIsProcessManager)
/* Message managers in child process support nsISyncMessageSender. */
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISyncMessageSender, !mChrome)
/* Message managers in chrome process support nsITreeItemFrameMessageManager. */
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsITreeItemFrameMessageManager, mChrome)
/* Process message manager doesn't support nsIChromeFrameMessageManager. */
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIChromeFrameMessageManager,
mChrome && !mIsProcessManager)
@ -323,6 +325,24 @@ nsFrameMessageManager::GetDocShell(nsIDocShell** aDocShell)
return NS_OK;
}
NS_IMETHODIMP
nsFrameMessageManager::GetChildCount(PRUint32* aChildCount)
{
*aChildCount = static_cast<PRUint32>(mChildManagers.Count());
return NS_OK;
}
NS_IMETHODIMP
nsFrameMessageManager::GetChildAt(PRUint32 aIndex,
nsITreeItemFrameMessageManager** aMM)
{
*aMM = nsnull;
nsCOMPtr<nsITreeItemFrameMessageManager> mm =
do_QueryInterface(mChildManagers.SafeObjectAt(static_cast<PRUint32>(aIndex)));
mm.swap(*aMM);
return NS_OK;
}
NS_IMETHODIMP
nsFrameMessageManager::Btoa(const nsAString& aBinaryData,
nsAString& aAsciiBase64String)
@ -823,7 +843,7 @@ bool SendAsyncMessageToChildProcess(void* aCallbackData,
const nsAString& aJSON)
{
mozilla::dom::ContentParent* cp =
mozilla::dom::ContentParent::GetSingleton(PR_FALSE);
static_cast<mozilla::dom::ContentParent*>(aCallbackData);
NS_WARN_IF_FALSE(cp, "No child process!");
if (cp) {
return cp->SendAsyncMessage(nsString(aMessage), nsString(aJSON));
@ -857,6 +877,7 @@ bool SendAsyncMessageToParentProcess(void* aCallbackData,
return true;
}
// This creates the global parent process message manager.
nsresult
NS_NewParentProcessMessageManager(nsIFrameMessageManager** aResult)
{
@ -865,9 +886,9 @@ NS_NewParentProcessMessageManager(nsIFrameMessageManager** aResult)
NS_ENSURE_TRUE(IsChromeProcess(), NS_ERROR_NOT_AVAILABLE);
nsFrameMessageManager* mm = new nsFrameMessageManager(PR_TRUE,
nsnull,
SendAsyncMessageToChildProcess,
nsnull,
&nsFrameMessageManager::sParentProcessManager,
nsnull,
nsnull,
nsnull,
nsnull,
PR_FALSE,
@ -877,6 +898,25 @@ NS_NewParentProcessMessageManager(nsIFrameMessageManager** aResult)
return CallQueryInterface(mm, aResult);
}
nsFrameMessageManager*
nsFrameMessageManager::NewProcessMessageManager(mozilla::dom::ContentParent* aProcess)
{
if (!nsFrameMessageManager::sParentProcessManager) {
nsCOMPtr<nsIFrameMessageManager> dummy;
NS_NewParentProcessMessageManager(getter_AddRefs(dummy));
}
nsFrameMessageManager* mm = new nsFrameMessageManager(PR_TRUE,
nsnull,
SendAsyncMessageToChildProcess,
nsnull,
aProcess,
nsFrameMessageManager::sParentProcessManager,
nsnull,
PR_FALSE,
PR_TRUE);
return mm;
}
nsresult
NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult)

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

@ -52,6 +52,12 @@
#include "mozilla/Services.h"
#include "nsIObserverService.h"
namespace mozilla {
namespace dom {
class ContentParent;
}
}
class nsAXPCNativeCallContext;
struct JSContext;
struct JSObject;
@ -125,6 +131,10 @@ public:
NS_DECL_NSISYNCMESSAGESENDER
NS_DECL_NSICONTENTFRAMEMESSAGEMANAGER
NS_DECL_NSICHROMEFRAMEMESSAGEMANAGER
NS_DECL_NSITREEITEMFRAMEMESSAGEMANAGER
static nsFrameMessageManager*
NewProcessMessageManager(mozilla::dom::ContentParent* aProcess);
nsresult ReceiveMessage(nsISupports* aTarget, const nsAString& aMessage,
PRBool aSync, const nsAString& aJSON,

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

@ -70,6 +70,7 @@ GK_ATOM(mozeditorbogusnode, "_moz_editor_bogus_node")
GK_ATOM(mozgeneratedcontentbefore, "_moz_generated_content_before")
GK_ATOM(mozgeneratedcontentafter, "_moz_generated_content_after")
GK_ATOM(mozgeneratedcontentimage, "_moz_generated_content_image")
GK_ATOM(_moz_original_size, "_moz_original_size")
GK_ATOM(_moz_target, "_moz_target")
GK_ATOM(_moz_type, "_moz-type")
GK_ATOM(menuactive, "_moz-menuactive")

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

@ -44,6 +44,7 @@
#include "History.h"
#include "mozilla/ipc/TestShellParent.h"
#include "mozilla/net/NeckoParent.h"
#include "mozilla/Preferences.h"
#include "nsHashPropertyBag.h"
#include "nsIFilePicker.h"
#include "nsIWindowWatcher.h"
@ -111,6 +112,7 @@
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
static const char* sClipboardTextFlavors[] = { kUnicodeMime };
using mozilla::Preferences;
using namespace mozilla::ipc;
using namespace mozilla::net;
using namespace mozilla::places;
@ -154,21 +156,39 @@ MemoryReportRequestParent::~MemoryReportRequestParent()
MOZ_COUNT_DTOR(MemoryReportRequestParent);
}
ContentParent* ContentParent::gSingleton;
nsTArray<ContentParent*>* ContentParent::gContentParents;
ContentParent*
ContentParent::GetSingleton(PRBool aForceNew)
ContentParent::GetNewOrUsed()
{
if (gSingleton && !gSingleton->IsAlive())
gSingleton = nsnull;
if (!gContentParents)
gContentParents = new nsTArray<ContentParent*>();
if (!gSingleton && aForceNew) {
nsRefPtr<ContentParent> parent = new ContentParent();
gSingleton = parent;
parent->Init();
PRInt32 maxContentProcesses = Preferences::GetInt("dom.ipc.processCount", 1);
if (maxContentProcesses < 1)
maxContentProcesses = 1;
if (gContentParents->Length() >= PRUint32(maxContentProcesses)) {
ContentParent* p = (*gContentParents)[rand() % gContentParents->Length()];
NS_ASSERTION(p->IsAlive(), "Non-alive contentparent in gContentParents?");
return p;
}
return gSingleton;
nsRefPtr<ContentParent> p = new ContentParent();
p->Init();
gContentParents->AppendElement(p);
return p;
}
void
ContentParent::GetAll(nsTArray<ContentParent*>& aArray)
{
if (!gContentParents) {
aArray.Clear();
return;
}
aArray = *gContentParents;
}
void
@ -195,7 +215,7 @@ ContentParent::Init()
threadInt->SetObserver(this);
}
if (obs) {
obs->NotifyObservers(nsnull, "ipc:content-created", nsnull);
obs->NotifyObservers(static_cast<nsIObserver*>(this), "ipc:content-created", nsnull);
}
#ifdef ACCESSIBILITY
@ -274,6 +294,8 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
#endif
}
mMessageManager->Disconnect();
// clear the child memory reporters
InfallibleTArray<MemoryReport> empty;
SetChildMemoryReporters(empty);
@ -295,6 +317,14 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
if (mRunToCompletionDepth)
mRunToCompletionDepth = 0;
if (gContentParents) {
gContentParents->RemoveElement(this);
if (!gContentParents->Length()) {
delete gContentParents;
gContentParents = NULL;
}
}
mIsAlive = false;
if (obs) {
@ -362,6 +392,7 @@ ContentParent::ContentParent()
, mShouldCallUnblockChild(false)
, mIsAlive(true)
, mProcessStartTime(time(NULL))
, mSendPermissionUpdates(false)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
mSubprocess = new GeckoChildProcessHost(GeckoProcessType_Content);
@ -372,6 +403,7 @@ ContentParent::ContentParent()
nsChromeRegistryChrome* chromeRegistry =
static_cast<nsChromeRegistryChrome*>(registrySvc.get());
chromeRegistry->SendRegisteredChrome(this);
mMessageManager = nsFrameMessageManager::NewProcessMessageManager(this);
}
ContentParent::~ContentParent()
@ -380,10 +412,8 @@ ContentParent::~ContentParent()
base::CloseProcessHandle(OtherProcess());
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
//If the previous content process has died, a new one could have
//been started since.
if (gSingleton == this)
gSingleton = nsnull;
NS_ASSERTION(!gContentParents || !gContentParents->Contains(this),
"Should have been removed in ActorDestroy");
}
bool
@ -459,7 +489,7 @@ ContentParent::RecvReadPermissions(InfallibleTArray<IPC::Permission>* aPermissio
}
// Ask for future changes
permissionManager->ChildRequestPermissions();
mSendPermissionUpdates = true;
#endif
return true;
@ -1083,7 +1113,7 @@ bool
ContentParent::RecvSyncMessage(const nsString& aMsg, const nsString& aJSON,
InfallibleTArray<nsString>* aRetvals)
{
nsRefPtr<nsFrameMessageManager> ppm = nsFrameMessageManager::sParentProcessManager;
nsRefPtr<nsFrameMessageManager> ppm = mMessageManager;
if (ppm) {
ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()),
aMsg,PR_TRUE, aJSON, nsnull, aRetvals);
@ -1094,7 +1124,7 @@ ContentParent::RecvSyncMessage(const nsString& aMsg, const nsString& aJSON,
bool
ContentParent::RecvAsyncMessage(const nsString& aMsg, const nsString& aJSON)
{
nsRefPtr<nsFrameMessageManager> ppm = nsFrameMessageManager::sParentProcessManager;
nsRefPtr<nsFrameMessageManager> ppm = mMessageManager;
if (ppm) {
ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()),
aMsg, PR_FALSE, aJSON, nsnull, nsnull);

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

@ -55,6 +55,7 @@
#include "nsIMemoryReporter.h"
#include "nsCOMArray.h"
class nsFrameMessageManager;
namespace mozilla {
namespace ipc {
@ -77,12 +78,8 @@ private:
typedef mozilla::ipc::TestShellParent TestShellParent;
public:
static ContentParent* GetSingleton(PRBool aForceNew = PR_TRUE);
#if 0
// TODO: implement this somewhere!
static ContentParent* FreeSingleton();
#endif
static ContentParent* GetNewOrUsed();
static void GetAll(nsTArray<ContentParent*>& aArray);
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
@ -102,12 +99,16 @@ public:
void SetChildMemoryReporters(const InfallibleTArray<MemoryReport>& report);
bool NeedsPermissionsUpdate() {
return mSendPermissionUpdates;
}
protected:
void OnChannelConnected(int32 pid);
virtual void ActorDestroy(ActorDestroyReason why);
private:
static ContentParent* gSingleton;
static nsTArray<ContentParent*>* gContentParents;
// Hide the raw constructor methods since we don't want client code
// using them.
@ -230,6 +231,10 @@ private:
bool mIsAlive;
nsCOMPtr<nsIPrefServiceInternal> mPrefService;
time_t mProcessStartTime;
bool mSendPermissionUpdates;
nsRefPtr<nsFrameMessageManager> mMessageManager;
};
} // namespace dom

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

@ -106,14 +106,37 @@
if (!didThrow) {
alert("One shouldn't be able to create content process message manager in chrome process!");
}
var tppm = ppm.QueryInterface(Components.interfaces.nsITreeItemFrameMessageManager);
if (tppm.childCount != 1) {
alert("Should have one child process!");
}
var childprocessmm = tppm.getChildAt(0);
childprocessmm.addMessageListener("ppm-sync",
function(m) {
if (m.target != childprocessmm) alert("Wrong target!");
document.getElementById("messageLog").value += "[SYNC1 PPM]";
}
);
ppm.addMessageListener("ppm-sync",
function(m) {
document.getElementById("messageLog").value += "[SYNC PPM]";
// Check that global process message manager gets the per-process mm as target.
if (m.target != childprocessmm) alert("Wrong target!");
document.getElementById("messageLog").value += "[SYNC2 PPM]";
}
);
childprocessmm.addMessageListener("ppm-async",
function(m) {
if (m.target != childprocessmm) alert("Wrong target!");
document.getElementById("messageLog").value += "[ASYNC1 PPM]";
}
);
ppm.addMessageListener("ppm-async",
function(m) {
document.getElementById("messageLog").value += "[ASYNC PPM]";
// Check that global process message manager gets the per-process mm as target.
if (m.target != childprocessmm) alert("Wrong target!");
document.getElementById("messageLog").value += "[ASYNC2 PPM]";
}
);
messageManager.loadFrameScript("chrome://global/content/remote-test-ipc.js", true);

0
dom/system/NetworkGeolocationProvider.js Normal file → Executable file
Просмотреть файл

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

@ -89,23 +89,6 @@ ChildProcess()
}
/**
* @returns The parent process object, or if we are not in the parent
* process, nsnull.
*/
static ContentParent*
ParentProcess()
{
if (!IsChildProcess()) {
ContentParent* cpc = ContentParent::GetSingleton();
if (!cpc)
NS_RUNTIMEABORT("Content Process is NULL!");
return cpc;
}
return nsnull;
}
#define ENSURE_NOT_CHILD_PROCESS_(onError) \
PR_BEGIN_MACRO \
if (IsChildProcess()) { \
@ -170,7 +153,6 @@ NS_IMPL_ISUPPORTS3(nsPermissionManager, nsIPermissionManager, nsIObserver, nsISu
nsPermissionManager::nsPermissionManager()
: mLargestID(0)
, mUpdateChildProcess(PR_FALSE)
{
}
@ -467,12 +449,16 @@ nsPermissionManager::AddInternal(const nsAFlatCString &aHost,
DBOperationType aDBOperation)
{
if (!IsChildProcess()) {
// In the parent, send the update now, if the child is ready
if (mUpdateChildProcess) {
IPC::Permission permission((aHost),
(aType),
aPermission, aExpireType, aExpireTime);
unused << ParentProcess()->SendAddPermission(permission);
nsTArray<ContentParent*> cplist;
ContentParent::GetAll(cplist);
for (PRUint32 i = 0; i < cplist.Length(); ++i) {
ContentParent* cp = cplist[i];
if (cp->NeedsPermissionsUpdate())
unused << cp->SendAddPermission(permission);
}
}

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

@ -250,17 +250,6 @@ private:
// An array to store the strings identifying the different types.
nsTArray<nsCString> mTypeArray;
// Whether we should update the child process with every change to a
// permission. This is set to true once the child is ready to receive
// such updates.
PRBool mUpdateChildProcess;
public:
void ChildRequestPermissions()
{
mUpdateChildProcess = PR_TRUE;
}
};
// {4F6B5E00-0C36-11d5-A535-0010A401EB10}

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

@ -155,12 +155,12 @@ CPPSRCS = \
jsxml.cpp \
prmjtime.cpp \
sharkctl.cpp \
vm/Debugger.cpp \
vm/GlobalObject.cpp \
vm/Stack.cpp \
vm/String.cpp \
frontend/ParseMaps.cpp \
vm/Unicode.cpp \
Debugger.cpp \
GlobalObject.cpp \
Stack.cpp \
String.cpp \
ParseMaps.cpp \
Unicode.cpp \
$(NULL)
# Changes to internal header files, used externally, massively slow down
@ -236,70 +236,79 @@ INSTALLED_HEADERS = \
######################################################
# BEGIN include sources for the engine subdirectories
#
VPATH += \
$(srcdir)/vm \
$(srcdir)/frontend \
$(NULL)
EXPORTS_NAMESPACES = vm
EXPORTS_vm = \
vm/ArgumentsObject.h \
vm/GlobalObject.h \
vm/Stack.h \
vm/String.h \
vm/StringObject.h \
vm/Unicode.h \
ArgumentsObject.h \
GlobalObject.h \
Stack.h \
String.h \
StringObject.h \
Unicode.h \
$(NULL)
###############################################
# BEGIN include sources for low-level code shared with Gecko
#
MFBT_DIR = $(srcdir)/../../mfbt
VPATH += \
$(srcdir)/../../mfbt \
$(NULL)
EXPORTS_NAMESPACES += mozilla
EXPORTS_mozilla = \
$(MFBT_DIR)/RangedPtr.h \
$(MFBT_DIR)/RefPtr.h \
$(MFBT_DIR)/Types.h \
$(MFBT_DIR)/Util.h \
RangedPtr.h \
RefPtr.h \
Types.h \
Util.h \
$(NULL)
ifdef ENABLE_TRACEJIT
VPATH += \
$(srcdir)/tracejit \
$(srcdir)/nanojit \
INSTALLED_HEADERS += \
jsbuiltins.h \
nanojit/Assembler.h \
nanojit/Allocator.h \
nanojit/CodeAlloc.h \
nanojit/Containers.h \
nanojit/LIR.h \
nanojit/LIRopcode.tbl \
nanojit/avmplus.h \
nanojit/Fragmento.h \
nanojit/Native.h \
nanojit/NativeCommon.h \
nanojit/Native$(NANOJIT_ARCH).h \
nanojit/njconfig.h \
nanojit/njcpudetect.h \
nanojit/RegAlloc.h \
nanojit/nanojit.h \
nanojit/VMPI.h \
tracejit/Writer.h \
Assembler.h \
Allocator.h \
CodeAlloc.h \
Containers.h \
LIR.h \
LIRopcode.tbl \
avmplus.h \
Fragmento.h \
Native.h \
NativeCommon.h \
Native$(NANOJIT_ARCH).h \
njconfig.h \
njcpudetect.h \
RegAlloc.h \
nanojit.h \
VMPI.h \
Writer.h \
$(NULL)
CPPSRCS += \
jstracer.cpp \
nanojit/Assembler.cpp \
nanojit/Allocator.cpp \
nanojit/CodeAlloc.cpp \
nanojit/Containers.cpp \
nanojit/Fragmento.cpp \
nanojit/LIR.cpp \
nanojit/njconfig.cpp \
nanojit/RegAlloc.cpp \
nanojit/avmplus.cpp \
nanojit/Native$(NANOJIT_ARCH).cpp \
Assembler.cpp \
Allocator.cpp \
CodeAlloc.cpp \
Containers.cpp \
Fragmento.cpp \
LIR.cpp \
njconfig.cpp \
RegAlloc.cpp \
avmplus.cpp \
Native$(NANOJIT_ARCH).cpp \
jsbuiltins.cpp \
nanojit/VMPI.cpp \
tracejit/Writer.cpp \
VMPI.cpp \
Writer.cpp \
$(NULL)
endif # ENABLE_TRACEJIT
@ -308,41 +317,41 @@ ifdef ENABLE_METHODJIT
###############################################
# BEGIN include sources for the method JIT
#
VPATH += $(srcdir)/methodjit
CPPSRCS += \
methodjit/MethodJIT.cpp \
methodjit/StubCalls.cpp \
methodjit/Compiler.cpp \
methodjit/FrameState.cpp \
methodjit/FastArithmetic.cpp \
methodjit/FastOps.cpp \
methodjit/StubCompiler.cpp \
methodjit/MonoIC.cpp \
methodjit/PolyIC.cpp \
methodjit/ImmutableSync.cpp \
methodjit/InvokeHelpers.cpp \
methodjit/Retcon.cpp \
methodjit/TrampolineCompiler.cpp \
CPPSRCS += MethodJIT.cpp \
StubCalls.cpp \
Compiler.cpp \
FrameState.cpp \
FastArithmetic.cpp \
FastOps.cpp \
StubCompiler.cpp \
MonoIC.cpp \
PolyIC.cpp \
ImmutableSync.cpp \
InvokeHelpers.cpp \
Retcon.cpp \
TrampolineCompiler.cpp \
$(NULL)
ifeq (86, $(findstring 86,$(TARGET_CPU)))
ifeq (x86_64, $(TARGET_CPU))
ifdef _MSC_VER
ASFILES += methodjit/TrampolineMasmX64.asm
ASFILES += TrampolineMasmX64.asm
endif
ifeq ($(OS_ARCH),WINNT)
ifdef GNU_CC
ASFILES += methodjit/TrampolineMingwX64.s
ASFILES += TrampolineMingwX64.s
endif
endif
ifdef SOLARIS_SUNPRO_CXX
ASFILES += methodjit/TrampolineSUNWX64.s
ASFILES += TrampolineSUNWX64.s
endif
#CPPSRCS += only_on_x86_64.cpp
else
#CPPSRCS += only_on_x86.cpp
ifdef SOLARIS_SUNPRO_CXX
ASFILES += methodjit/TrampolineSUNWX86.s
ASFILES += TrampolineSUNWX86.s
endif
endif
endif
@ -350,7 +359,7 @@ ifeq (arm, $(TARGET_CPU))
#CPPSRCS += only_on_arm.cpp
endif
ifeq (sparc, $(findstring sparc,$(TARGET_CPU)))
ASFILES += methodjit/TrampolineSparc.s
ASFILES += TrampolineSparc.s
endif
#
# END enclude sources for the method JIT
@ -361,16 +370,17 @@ endif
###############################################
# BEGIN include sources for V8 dtoa
#
VPATH += $(srcdir)/v8-dtoa \
$(NONE)
CPPSRCS += \
v8-dtoa/checks.cc \
v8-dtoa/conversions.cc \
v8-dtoa/diy-fp.cc \
v8-dtoa/v8-dtoa.cc \
v8-dtoa/fast-dtoa.cc \
v8-dtoa/platform.cc \
v8-dtoa/utils.cc \
$(NULL)
CPPSRCS += checks.cc \
conversions.cc \
diy-fp.cc \
v8-dtoa.cc \
fast-dtoa.cc \
platform.cc \
utils.cc \
$(NONE)
#
# END enclude sources for V8 dtoa
@ -442,10 +452,11 @@ endif
endif
ifdef JS_HAS_CTYPES
VPATH += $(srcdir)/ctypes
CPPSRCS += \
ctypes/CTypes.cpp \
ctypes/Library.cpp \
CTypes.cpp \
Library.cpp \
$(NULL)
ifdef MOZ_NATIVE_FFI
@ -485,12 +496,13 @@ endif
# it just doesn't necessarily do anything useful. There is one
# implementation source file per supported operating system, plus a stub
# for unsupported OSes, plus the Javascript wrapper.
INSTALLED_HEADERS += perf/jsperf.h
CPPSRCS += perf/jsperf.cpp
VPATH += $(srcdir)/perf
INSTALLED_HEADERS += jsperf.h
CPPSRCS += jsperf.cpp
ifdef HAVE_LINUX_PERF_EVENT_H
CPPSRCS += perf/pm_linux.cpp
CPPSRCS += pm_linux.cpp
else
CPPSRCS += perf/pm_stub.cpp
CPPSRCS += pm_stub.cpp
endif
ifeq ($(OS_ARCH),WINNT)
@ -703,14 +715,6 @@ distclean::
# our build system doesn't handle subdir srcs very gracefully today
export::
$(MKDIR) -p nanojit
$(MKDIR) -p vm
$(MKDIR) -p frontend
$(MKDIR) -p tracejit
$(MKDIR) -p methodjit
$(MKDIR) -p v8-dtoa
$(MKDIR) -p perf
GARBAGE_DIRS += nanojit vm frontend tracejit methodjit v8-dtoa perf
DEFINES += -DEXPORT_JS_API

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

@ -898,9 +898,6 @@ ifdef SHARED_LIBRARY
$(SHARED_LIBRARY_NAME) $(DIST)/$(MOZ_APP_NAME)
endif
endif # SHARED_LIBRARY || PROGRAM
else # ! WINNT_
# Force rebuilding all objects on the second pass
$(OBJS): FORCE
endif # WINNT_
endif # MOZ_PROFILE_USE
ifdef MOZ_PROFILE_GENERATE

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

@ -61,6 +61,7 @@
#include "nsMenuPopupFrame.h"
#include "nsIScreenManager.h"
#include "mozilla/dom/Element.h"
#include "nsContentErrors.h"
//
@ -253,13 +254,6 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
appUnitsRect.height = mRect.height;
nsIntRect cssRect = appUnitsRect.ToInsidePixels(nsPresContext::AppUnitsPerCSSPixel());
nsAutoString widthstr, heightstr;
widthstr.AppendInt(cssRect.width);
heightstr.AppendInt(cssRect.height);
// for XUL elements, just set the width and height attributes. For
// other elements, set style.width and style.height
if (contentToResize->IsXUL()) {
nsIntRect oldRect;
nsWeakFrame weakFrame(menuPopupFrame);
if (menuPopupFrame) {
@ -274,13 +268,11 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
rect.y -= clientOffset.y;
}
// only set the property if the element could have changed in that direction
if (direction.mHorizontal) {
contentToResize->SetAttr(kNameSpaceID_None, nsGkAtoms::width, widthstr, PR_TRUE);
}
if (direction.mVertical) {
contentToResize->SetAttr(kNameSpaceID_None, nsGkAtoms::height, heightstr, PR_TRUE);
}
SizeInfo sizeInfo, originalSizeInfo;
sizeInfo.width.AppendInt(cssRect.width);
sizeInfo.height.AppendInt(cssRect.height);
ResizeContent(contentToResize, direction, sizeInfo, &originalSizeInfo);
MaybePersistOriginalSize(contentToResize, originalSizeInfo);
if (weakFrame.IsAlive() &&
(oldRect.x != rect.x || oldRect.y != rect.y) &&
@ -289,25 +281,6 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
menuPopupFrame->MoveTo(rect.x, rect.y, PR_TRUE);
}
}
else {
nsCOMPtr<nsIDOMElementCSSInlineStyle> inlineStyleContent =
do_QueryInterface(contentToResize);
if (inlineStyleContent) {
nsCOMPtr<nsIDOMCSSStyleDeclaration> decl;
inlineStyleContent->GetStyle(getter_AddRefs(decl));
// only set the property if the element could have changed in that direction
if (direction.mHorizontal) {
widthstr.AppendLiteral("px");
decl->SetProperty(NS_LITERAL_STRING("width"), widthstr, EmptyString());
}
if (direction.mVertical) {
heightstr.AppendLiteral("px");
decl->SetProperty(NS_LITERAL_STRING("height"), heightstr, EmptyString());
}
}
}
}
else {
window->SetPositionAndSize(rect.x, rect.y, rect.width, rect.height, PR_TRUE); // do the repaint.
}
@ -323,6 +296,25 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
MouseClicked(aPresContext, aEvent);
}
break;
case NS_MOUSE_DOUBLECLICK:
if (aEvent->eventStructType == NS_MOUSE_EVENT &&
static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton)
{
nsCOMPtr<nsIBaseWindow> window;
nsIPresShell* presShell = aPresContext->GetPresShell();
nsIContent* contentToResize =
GetContentToResize(presShell, getter_AddRefs(window));
if (contentToResize) {
nsIFrame* frameToResize = contentToResize->GetPrimaryFrame();
if (frameToResize && frameToResize->GetType() == nsGkAtoms::menuPopupFrame)
break; // Don't restore original sizing for menupopup frames until
// we handle screen constraints here. (Bug 357725)
RestoreOriginalSize(contentToResize);
}
}
break;
}
if (!doDefault)
@ -418,6 +410,102 @@ nsResizerFrame::AdjustDimensions(PRInt32* aPos, PRInt32* aSize,
}
}
/* static */ void
nsResizerFrame::ResizeContent(nsIContent* aContent, const Direction& aDirection,
const SizeInfo& aSizeInfo, SizeInfo* aOriginalSizeInfo)
{
// for XUL elements, just set the width and height attributes. For
// other elements, set style.width and style.height
if (aContent->IsXUL()) {
if (aOriginalSizeInfo) {
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::width,
aOriginalSizeInfo->width);
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::height,
aOriginalSizeInfo->height);
}
// only set the property if the element could have changed in that direction
if (aDirection.mHorizontal) {
aContent->SetAttr(kNameSpaceID_None, nsGkAtoms::width, aSizeInfo.width, PR_TRUE);
}
if (aDirection.mVertical) {
aContent->SetAttr(kNameSpaceID_None, nsGkAtoms::height, aSizeInfo.height, PR_TRUE);
}
}
else {
nsCOMPtr<nsIDOMElementCSSInlineStyle> inlineStyleContent =
do_QueryInterface(aContent);
if (inlineStyleContent) {
nsCOMPtr<nsIDOMCSSStyleDeclaration> decl;
inlineStyleContent->GetStyle(getter_AddRefs(decl));
if (aOriginalSizeInfo) {
decl->GetPropertyValue(NS_LITERAL_STRING("width"),
aOriginalSizeInfo->width);
decl->GetPropertyValue(NS_LITERAL_STRING("height"),
aOriginalSizeInfo->height);
}
// only set the property if the element could have changed in that direction
if (aDirection.mHorizontal) {
nsAutoString widthstr(aSizeInfo.width);
if (!widthstr.IsEmpty() &&
!Substring(widthstr, widthstr.Length() - 2, 2).EqualsLiteral("px"))
widthstr.AppendLiteral("px");
decl->SetProperty(NS_LITERAL_STRING("width"), widthstr, EmptyString());
}
if (aDirection.mVertical) {
nsAutoString heightstr(aSizeInfo.height);
if (!heightstr.IsEmpty() &&
!Substring(heightstr, heightstr.Length() - 2, 2).EqualsLiteral("px"))
heightstr.AppendLiteral("px");
decl->SetProperty(NS_LITERAL_STRING("height"), heightstr, EmptyString());
}
}
}
}
/* static */ void
nsResizerFrame::SizeInfoDtorFunc(void *aObject, nsIAtom *aPropertyName,
void *aPropertyValue, void *aData)
{
nsResizerFrame::SizeInfo *propertyValue =
static_cast<nsResizerFrame::SizeInfo*>(aPropertyValue);
delete propertyValue;
}
/* static */ void
nsResizerFrame::MaybePersistOriginalSize(nsIContent* aContent,
const SizeInfo& aSizeInfo)
{
nsresult rv;
aContent->GetProperty(nsGkAtoms::_moz_original_size, &rv);
if (rv != NS_PROPTABLE_PROP_NOT_THERE)
return;
nsAutoPtr<SizeInfo> sizeInfo(new SizeInfo(aSizeInfo));
rv = aContent->SetProperty(nsGkAtoms::_moz_original_size, sizeInfo.get(),
&SizeInfoDtorFunc);
if (NS_SUCCEEDED(rv))
sizeInfo.forget();
}
/* static */ void
nsResizerFrame::RestoreOriginalSize(nsIContent* aContent)
{
nsresult rv;
SizeInfo* sizeInfo =
static_cast<SizeInfo*>(aContent->GetProperty(nsGkAtoms::_moz_original_size,
&rv));
if (NS_FAILED(rv))
return;
NS_ASSERTION(sizeInfo, "We set a null sizeInfo!?");
Direction direction = {1, 1};
ResizeContent(aContent, direction, *sizeInfo, nsnull);
aContent->DeleteProperty(nsGkAtoms::_moz_original_size);
}
/* returns a Direction struct containing the horizontal and vertical direction
*/
nsResizerFrame::Direction

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

@ -71,6 +71,15 @@ protected:
static void AdjustDimensions(PRInt32* aPos, PRInt32* aSize,
PRInt32 aMovement, PRInt8 aResizerDirection);
struct SizeInfo {
nsString width, height;
};
static void SizeInfoDtorFunc(void *aObject, nsIAtom *aPropertyName,
void *aPropertyValue, void *aData);
static void ResizeContent(nsIContent* aContent, const Direction& aDirection,
const SizeInfo& aSizeInfo, SizeInfo* aOriginalSizeInfo);
static void MaybePersistOriginalSize(nsIContent* aContent, const SizeInfo& aSizeInfo);
static void RestoreOriginalSize(nsIContent* aContent);
protected:
nsIntRect mMouseDownRect;
nsIntPoint mMouseDownPoint;

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

@ -41,10 +41,17 @@ function testResizer(resizerid, noShrink, hResize, vResize, testid)
" " + testid + " width moving " + mouseX + "," + mouseY + ",,," + hResize);
is(Math.round(newrect.height), Math.round(expectedHeight), "resize element " + resizerid +
" " + testid + " height moving " + mouseX + "," + mouseY);
// move it back before we release!
synthesizeMouse(document.documentElement, originalX + 5, originalY + 5, { type:"mousemove" });
synthesizeMouse(document.documentElement, originalX + 5, originalY + 5, { type:"mouseup" });
}
// release
synthesizeMouse(document.documentElement, originalX + 5 + mouseX * scale,
originalY + 5 + mouseY * scale, { type:"mouseup" }); }
// return to the original size
synthesizeMouse(document.documentElement, originalX + 5 + mouseX * scale,
originalY + 5 + mouseY * scale, { type:"dblclick" }); }
var newrect = document.getElementById(resizerid + "-container").getBoundingClientRect();
is(Math.round(newrect.width), Math.round(rect.width), "resize element " + resizerid +
" " + testid + " doubleclicking to restore original size");
is(Math.round(newrect.height), Math.round(rect.height), "resize element " + resizerid +
" " + testid + " doubleclicking to restore original size");
}
}

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

@ -1482,6 +1482,8 @@ pref("dom.ipc.plugins.enabled.602plugin.so", false);
#endif
#endif
pref("dom.ipc.processCount", 1);
pref("svg.smil.enabled", true);
pref("font.minimum-size.ar", 0);

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

@ -1 +1 @@
NSPR_4_8_9_RTM
NSPR_4_9_BETA1

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

@ -64,10 +64,10 @@
#
# ------------------------------------------------------------------
FROMTOP=/share/builds/components/nspr20/v4.8.9
TOTOP=./v4.8.9
NSPRDIR=nspr-4.8.9
SOURCETAG=NSPR_4_8_9_RTM
FROMTOP=/share/builds/components/nspr20/v4.9
TOTOP=./v4.9
NSPRDIR=nspr-4.9
SOURCETAG=NSPR_4_9_RTM
#
# enumerate Unix object directories on /s/b/c

297
nsprpub/configure поставляемый
Просмотреть файл

@ -730,8 +730,8 @@ test "$host_alias" != "$target_alias" &&
MOD_MAJOR_VERSION=4
MOD_MINOR_VERSION=8
MOD_PATCH_VERSION=9
MOD_MINOR_VERSION=9
MOD_PATCH_VERSION=0
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
USE_PTHREADS=
@ -878,11 +878,41 @@ case "$target" in
fi
if test -z "$android_toolchain" ; then
android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[:upper:]" "[:lower:]"`-x86/arm-eabi-4.4.0
echo $ac_n "checking for android toolchain directory""... $ac_c" 1>&6
echo "configure:883: checking for android toolchain directory" >&5
kernel_name=`uname -s | tr "[:upper:]" "[:lower:]"`
android_toolchain="$android_ndk"/build/prebuilt/$kernel_name-x86/arm-eabi-4.4.0
# With newer NDK, the toolchain path has changed.
if ! test -d "$android_toolchain" ; then
android_toolchain="$android_ndk"/toolchains/arm-$kernel_name-androideabi-4.4.3/prebuilt/$kernel_name-x86
fi
if test -d "$android_toolchain" ; then
echo "$ac_t""$android_toolchain" 1>&6
else
{ echo "configure: error: not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain." 1>&2; exit 1; }
fi
fi
if test -z "$android_platform" ; then
echo $ac_n "checking for android platform directory""... $ac_c" 1>&6
echo "configure:903: checking for android platform directory" >&5
android_platform="$android_ndk"/build/platforms/android-5/arch-arm
# With newer NDK, the platform path has changed.
if ! test -d "$android_platform" ; then
android_platform="$android_ndk"/platforms/android-5/arch-arm
fi
if test -d "$android_platform" ; then
echo "$ac_t""$android_platform" 1>&6
else
{ echo "configure: error: not found. You have to specify --with-android-platform=/path/to/ndk/platform." 1>&2; exit 1; }
fi
fi
AS="$android_toolchain"/bin/"$android_tool_prefix"-as
@ -1213,7 +1243,7 @@ if test -z "$SKIP_PATH_CHECKS"; then
# Extract the first word of "$WHOAMI whoami", so it can be a program name with args.
set dummy $WHOAMI whoami; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1217: checking for $ac_word" >&5
echo "configure:1247: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_WHOAMI'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1275,7 +1305,8 @@ EOF
fi
if test -z "$SKIP_COMPILER_CHECKS"; then
if test "$target" != "$host"; then
if test "$target" != "$host" -o -n "$CROSS_COMPILE"; then
echo "cross compiling from $host to $target"
cross_compiling=yes
@ -1284,13 +1315,13 @@ if test "$target" != "$host"; then
_SAVE_LDFLAGS="$LDFLAGS"
echo $ac_n "checking for $host compiler""... $ac_c" 1>&6
echo "configure:1288: checking for $host compiler" >&5
echo "configure:1319: checking for $host compiler" >&5
for ac_prog in $HOST_CC gcc cc /usr/ucb/cc
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1294: checking for $ac_word" >&5
echo "configure:1325: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_HOST_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1336,16 +1367,16 @@ test -n "$HOST_CC" || HOST_CC=""""
LDFLAGS="$HOST_LDFLAGS"
echo $ac_n "checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works""... $ac_c" 1>&6
echo "configure:1340: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
echo "configure:1371: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
cat > conftest.$ac_ext <<EOF
#line 1342 "configure"
#line 1373 "configure"
#include "confdefs.h"
int main() {
return(0);
; return 0; }
EOF
if { (eval echo configure:1349: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1380: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_prog_host_cc_works=1 echo "$ac_t""yes" 1>&6
else
@ -1363,10 +1394,16 @@ rm -f conftest*
case "$build:$target" in
powerpc-apple-darwin8*:i?86-apple-darwin*)
_SAVE_CFLAGS=$CFLAGS
_SAVE_CXXFLAGS=$CXXLAGS
_SAVE_CXXFLAGS=$CXXFLAGS
CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
;;
*:arm*-apple-darwin*)
_SAVE_CFLAGS=$CFLAGS
_SAVE_CXXFLAGS=$CXXFLAGS
CFLAGS="-isysroot $MACOS_SDK_DIR $CFLAGS"
CXXFLAGS="-isysroot $MACOS_SDK_DIR $CXXFLAGS"
;;
esac
for ac_prog in $CC "${target_alias}-gcc" "${target}-gcc"
@ -1374,7 +1411,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1378: checking for $ac_word" >&5
echo "configure:1415: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1408,7 +1445,7 @@ test -n "$CC" || CC="echo"
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1412: checking for $ac_word" >&5
echo "configure:1449: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1438,7 +1475,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1442: checking for $ac_word" >&5
echo "configure:1479: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1489,7 +1526,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1493: checking for $ac_word" >&5
echo "configure:1530: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1521,7 +1558,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:1525: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
echo "configure:1562: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -1532,12 +1569,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
#line 1536 "configure"
#line 1573 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
if { (eval echo configure:1541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@ -1563,12 +1600,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:1567: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:1604: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:1572: checking whether we are using GNU C" >&5
echo "configure:1609: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1577,7 +1614,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1581: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1618: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@ -1596,7 +1633,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:1600: checking whether ${CC-cc} accepts -g" >&5
echo "configure:1637: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1633,7 +1670,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1637: checking for $ac_word" >&5
echo "configure:1674: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1669,7 +1706,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1673: checking for $ac_word" >&5
echo "configure:1710: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1701,7 +1738,7 @@ test -n "$CXX" || CXX="gcc"
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:1705: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
echo "configure:1742: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -1712,12 +1749,12 @@ cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext << EOF
#line 1716 "configure"
#line 1753 "configure"
#include "confdefs.h"
int main(){return(0);}
EOF
if { (eval echo configure:1721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cxx_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@ -1743,12 +1780,12 @@ if test $ac_cv_prog_cxx_works = no; then
{ echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:1747: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:1784: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
echo "configure:1752: checking whether we are using GNU C++" >&5
echo "configure:1789: checking whether we are using GNU C++" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1757,7 +1794,7 @@ else
yes;
#endif
EOF
if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1761: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1798: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
@ -1776,7 +1813,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
echo "configure:1780: checking whether ${CXX-g++} accepts -g" >&5
echo "configure:1817: checking whether ${CXX-g++} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1810,7 +1847,7 @@ fi
fi
case "$build:$target" in
powerpc-apple-darwin8*:i?86-apple-darwin*)
powerpc-apple-darwin8*:i?86-apple-darwin*|*:arm*-apple-darwin*)
CFLAGS=$_SAVE_CFLAGS
CXXFLAGS=$_SAVE_CXXFLAGS
;;
@ -1821,7 +1858,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1825: checking for $ac_word" >&5
echo "configure:1862: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1856,7 +1893,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1860: checking for $ac_word" >&5
echo "configure:1897: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1891,7 +1928,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1895: checking for $ac_word" >&5
echo "configure:1932: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1926,7 +1963,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1930: checking for $ac_word" >&5
echo "configure:1967: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1961,7 +1998,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1965: checking for $ac_word" >&5
echo "configure:2002: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1996,7 +2033,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2000: checking for $ac_word" >&5
echo "configure:2037: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2031,7 +2068,7 @@ else
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2035: checking for $ac_word" >&5
echo "configure:2072: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2061,7 +2098,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2065: checking for $ac_word" >&5
echo "configure:2102: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2112,7 +2149,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2116: checking for $ac_word" >&5
echo "configure:2153: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2144,7 +2181,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:2148: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
echo "configure:2185: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -2155,12 +2192,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
#line 2159 "configure"
#line 2196 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
if { (eval echo configure:2164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@ -2186,12 +2223,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:2190: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:2227: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:2195: checking whether we are using GNU C" >&5
echo "configure:2232: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2200,7 +2237,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2241: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@ -2219,7 +2256,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:2223: checking whether ${CC-cc} accepts -g" >&5
echo "configure:2260: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2259,7 +2296,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2263: checking for $ac_word" >&5
echo "configure:2300: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2291,7 +2328,7 @@ test -n "$CXX" || CXX="gcc"
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:2295: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
echo "configure:2332: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -2302,12 +2339,12 @@ cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext << EOF
#line 2306 "configure"
#line 2343 "configure"
#include "confdefs.h"
int main(){return(0);}
EOF
if { (eval echo configure:2311: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cxx_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@ -2333,12 +2370,12 @@ if test $ac_cv_prog_cxx_works = no; then
{ echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:2337: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:2374: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
echo "configure:2342: checking whether we are using GNU C++" >&5
echo "configure:2379: checking whether we are using GNU C++" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2347,7 +2384,7 @@ else
yes;
#endif
EOF
if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2351: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2388: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
@ -2366,7 +2403,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
echo "configure:2370: checking whether ${CXX-g++} accepts -g" >&5
echo "configure:2407: checking whether ${CXX-g++} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2400,7 +2437,7 @@ fi
fi
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:2404: checking how to run the C preprocessor" >&5
echo "configure:2441: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -2415,13 +2452,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 2419 "configure"
#line 2456 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2425: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2462: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -2432,13 +2469,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 2436 "configure"
#line 2473 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2442: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2479: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -2449,13 +2486,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
#line 2453 "configure"
#line 2490 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2459: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2496: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -2482,7 +2519,7 @@ echo "$ac_t""$CPP" 1>&6
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2486: checking for $ac_word" >&5
echo "configure:2523: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2514,7 +2551,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2518: checking for $ac_word" >&5
echo "configure:2555: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_AS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2555,7 +2592,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2559: checking for $ac_word" >&5
echo "configure:2596: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2596,7 +2633,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2600: checking for $ac_word" >&5
echo "configure:2637: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2637,7 +2674,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2641: checking for $ac_word" >&5
echo "configure:2678: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2678,7 +2715,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2682: checking for $ac_word" >&5
echo "configure:2719: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_WINDRES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2746,7 +2783,7 @@ else
fi
echo $ac_n "checking for gcc -pipe support""... $ac_c" 1>&6
echo "configure:2750: checking for gcc -pipe support" >&5
echo "configure:2787: checking for gcc -pipe support" >&5
if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
echo '#include <stdio.h>' > dummy-hello.c
echo 'int main() { printf("Hello World\n"); return 0; }' >> dummy-hello.c
@ -2761,14 +2798,14 @@ if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
_SAVE_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -pipe"
cat > conftest.$ac_ext <<EOF
#line 2765 "configure"
#line 2802 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {
printf("Hello World\n");
; return 0; }
EOF
if { (eval echo configure:2772: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2809: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
_res_gcc_pipe="yes"
else
@ -2798,16 +2835,16 @@ _SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
echo $ac_n "checking whether C compiler supports -fprofile-generate""... $ac_c" 1>&6
echo "configure:2802: checking whether C compiler supports -fprofile-generate" >&5
echo "configure:2839: checking whether C compiler supports -fprofile-generate" >&5
cat > conftest.$ac_ext <<EOF
#line 2804 "configure"
#line 2841 "configure"
#include "confdefs.h"
int main() {
return 0;
; return 0; }
EOF
if { (eval echo configure:2811: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
PROFILE_GEN_CFLAGS="-fprofile-generate"
result="yes"
@ -2830,7 +2867,7 @@ CFLAGS="$_SAVE_CFLAGS"
if test "$GNU_CC"; then
echo $ac_n "checking for visibility(hidden) attribute""... $ac_c" 1>&6
echo "configure:2834: checking for visibility(hidden) attribute" >&5
echo "configure:2871: checking for visibility(hidden) attribute" >&5
if eval "test \"`echo '$''{'ac_cv_visibility_hidden'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2854,7 +2891,7 @@ echo "$ac_t""$ac_cv_visibility_hidden" 1>&6
EOF
echo $ac_n "checking for visibility pragma support""... $ac_c" 1>&6
echo "configure:2858: checking for visibility pragma support" >&5
echo "configure:2895: checking for visibility pragma support" >&5
if eval "test \"`echo '$''{'ac_cv_visibility_pragma'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -2907,7 +2944,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2911: checking for $ac_word" >&5
echo "configure:2948: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -3228,14 +3265,14 @@ no)
_SAVE_CFLAGS="$CFLAGS"
CFLAGS="$arch_flag"
cat > conftest.$ac_ext <<EOF
#line 3232 "configure"
#line 3269 "configure"
#include "confdefs.h"
int main() {
return sizeof(__thumb2__);
; return 0; }
EOF
if { (eval echo configure:3239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:3276: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
MOZ_THUMB2=1
else
@ -3297,16 +3334,16 @@ if test -n "$all_flags"; then
_SAVE_CFLAGS="$CFLAGS"
CFLAGS="$all_flags"
echo $ac_n "checking whether the chosen combination of compiler flags ($all_flags) works""... $ac_c" 1>&6
echo "configure:3301: checking whether the chosen combination of compiler flags ($all_flags) works" >&5
echo "configure:3338: checking whether the chosen combination of compiler flags ($all_flags) works" >&5
cat > conftest.$ac_ext <<EOF
#line 3303 "configure"
#line 3340 "configure"
#include "confdefs.h"
int main() {
return 0;
; return 0; }
EOF
if { (eval echo configure:3310: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:3347: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
else
@ -3363,17 +3400,17 @@ EOF
DSO_LDOPTS='-brtl -bnortllib -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib'
ac_safe=`echo "sys/atomic_op.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/atomic_op.h""... $ac_c" 1>&6
echo "configure:3367: checking for sys/atomic_op.h" >&5
echo "configure:3404: checking for sys/atomic_op.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3372 "configure"
#line 3409 "configure"
#include "confdefs.h"
#include <sys/atomic_op.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3377: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:3414: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -3569,7 +3606,7 @@ EOF
_DEBUG_FLAGS='-gdwarf-2 -O0'
MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
echo $ac_n "checking for gethostbyaddr in -lbind""... $ac_c" 1>&6
echo "configure:3573: checking for gethostbyaddr in -lbind" >&5
echo "configure:3610: checking for gethostbyaddr in -lbind" >&5
ac_lib_var=`echo bind'_'gethostbyaddr | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -3577,7 +3614,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lbind $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3581 "configure"
#line 3618 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -3588,7 +3625,7 @@ int main() {
gethostbyaddr()
; return 0; }
EOF
if { (eval echo configure:3592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3629: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -3775,6 +3812,9 @@ EOF
AS='$(CC) -x assembler-with-cpp'
CFLAGS="$CFLAGS -Wall -fno-common"
case "${target_cpu}" in
arm*)
CPU_ARCH=arm
;;
i*86*)
if test -n "$USE_64"; then
CPU_ARCH=x86_64
@ -3789,6 +3829,39 @@ EOF
if test "`echo $CC | grep -c '\-arch '`" = "0"; then
CC="$CC -arch $CPU_ARCH"
fi
ac_safe=`echo "crt_externs.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for crt_externs.h""... $ac_c" 1>&6
echo "configure:3835: checking for crt_externs.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3840 "configure"
#include "confdefs.h"
#include <crt_externs.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3845: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
:
else
echo "$ac_t""no" 1>&6
fi
DSO_CFLAGS=-fPIC
DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names'
_OPTIMIZE_FLAGS=-O2
@ -4942,17 +5015,17 @@ EOF
_OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
echo "configure:4946: checking for machine/builtins.h" >&5
echo "configure:5019: checking for machine/builtins.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4951 "configure"
#line 5024 "configure"
#include "confdefs.h"
#include <machine/builtins.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4956: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:5029: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -5601,7 +5674,7 @@ case $target in
;;
*)
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
echo "configure:5605: checking for dlopen in -ldl" >&5
echo "configure:5678: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -5609,7 +5682,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 5613 "configure"
#line 5686 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -5620,7 +5693,7 @@ int main() {
dlopen()
; return 0; }
EOF
if { (eval echo configure:5624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:5697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -5637,17 +5710,17 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
echo "configure:5641: checking for dlfcn.h" >&5
echo "configure:5714: checking for dlfcn.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5646 "configure"
#line 5719 "configure"
#include "confdefs.h"
#include <dlfcn.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:5651: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:5724: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -5680,13 +5753,13 @@ esac
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
echo "configure:5684: checking whether ${CC-cc} needs -traditional" >&5
echo "configure:5757: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
#line 5690 "configure"
#line 5763 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@ -5704,7 +5777,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
#line 5708 "configure"
#line 5781 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@ -5728,12 +5801,12 @@ fi
for ac_func in lchown strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:5732: checking for $ac_func" >&5
echo "configure:5805: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5737 "configure"
#line 5810 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -5756,7 +5829,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:5760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:5833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -5807,7 +5880,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:5811: checking for $ac_word" >&5
echo "configure:5884: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_CCACHE'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -5866,7 +5939,7 @@ hpux*)
if test -z "$GNU_CC"; then
echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
echo "configure:5870: checking for +Olit support" >&5
echo "configure:5943: checking for +Olit support" >&5
if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -5908,7 +5981,7 @@ wince*)
*)
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
echo "configure:5912: checking for pthread_create in -lpthreads" >&5
echo "configure:5985: checking for pthread_create in -lpthreads" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5930,7 +6003,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
echo "configure:5934: checking for pthread_create in -lpthread" >&5
echo "configure:6007: checking for pthread_create in -lpthread" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5952,7 +6025,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
echo "configure:5956: checking for pthread_create in -lc_r" >&5
echo "configure:6029: checking for pthread_create in -lc_r" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5974,7 +6047,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
echo "configure:5978: checking for pthread_create in -lc" >&5
echo "configure:6051: checking for pthread_create in -lc" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -6092,7 +6165,7 @@ if test -n "$USE_PTHREADS"; then
rm -f conftest*
ac_cv_have_dash_pthread=no
echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
echo "configure:6096: checking whether ${CC-cc} accepts -pthread" >&5
echo "configure:6169: checking whether ${CC-cc} accepts -pthread" >&5
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then
@ -6115,7 +6188,7 @@ echo "configure:6096: checking whether ${CC-cc} accepts -pthread" >&5
ac_cv_have_dash_pthreads=no
if test "$ac_cv_have_dash_pthread" = "no"; then
echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
echo "configure:6119: checking whether ${CC-cc} accepts -pthreads" >&5
echo "configure:6192: checking whether ${CC-cc} accepts -pthreads" >&5
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then

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

@ -49,8 +49,8 @@ dnl ========================================================
dnl = Defaults
dnl ========================================================
MOD_MAJOR_VERSION=4
MOD_MINOR_VERSION=8
MOD_PATCH_VERSION=9
MOD_MINOR_VERSION=9
MOD_PATCH_VERSION=0
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
USE_PTHREADS=
@ -170,11 +170,39 @@ case "$target" in
fi
if test -z "$android_toolchain" ; then
android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
AC_MSG_CHECKING([for android toolchain directory])
kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
android_toolchain="$android_ndk"/build/prebuilt/$kernel_name-x86/arm-eabi-4.4.0
# With newer NDK, the toolchain path has changed.
if ! test -d "$android_toolchain" ; then
android_toolchain="$android_ndk"/toolchains/arm-$kernel_name-androideabi-4.4.3/prebuilt/$kernel_name-x86
fi
if test -d "$android_toolchain" ; then
AC_MSG_RESULT([$android_toolchain])
else
AC_MSG_ERROR([not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain.])
fi
fi
if test -z "$android_platform" ; then
AC_MSG_CHECKING([for android platform directory])
android_platform="$android_ndk"/build/platforms/android-5/arch-arm
# With newer NDK, the platform path has changed.
if ! test -d "$android_platform" ; then
android_platform="$android_ndk"/platforms/android-5/arch-arm
fi
if test -d "$android_platform" ; then
AC_MSG_RESULT([$android_platform])
else
AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
fi
fi
dnl set up compilers
@ -499,7 +527,11 @@ if test -z "$SKIP_COMPILER_CHECKS"; then
dnl ========================================================
dnl Checks for compilers.
dnl ========================================================
if test "$target" != "$host"; then
dnl Explicitly honor $CROSS_COMPILE to allow cross-compiling
dnl between toolkits on the same architecture, as when
dnl targeting the iOS Simulator from OS X.
if test "$target" != "$host" -o -n "$CROSS_COMPILE"; then
echo "cross compiling from $host to $target"
cross_compiling=yes
@ -541,10 +573,19 @@ if test "$target" != "$host"; then
dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
dnl checks will fail. Fake a working SDK in that case.
_SAVE_CFLAGS=$CFLAGS
_SAVE_CXXFLAGS=$CXXLAGS
_SAVE_CXXFLAGS=$CXXFLAGS
CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
;;
*:arm*-apple-darwin*)
dnl The arm compiler doesn't appear to know about its root by default,
dnl so explicitly pass it one here. Later on we'll put this in CFLAGS
dnl anyway.
_SAVE_CFLAGS=$CFLAGS
_SAVE_CXXFLAGS=$CXXFLAGS
CFLAGS="-isysroot $MACOS_SDK_DIR $CFLAGS"
CXXFLAGS="-isysroot $MACOS_SDK_DIR $CXXFLAGS"
;;
esac
AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", echo)
@ -557,7 +598,7 @@ if test "$target" != "$host"; then
fi
case "$build:$target" in
powerpc-apple-darwin8*:i?86-apple-darwin*)
powerpc-apple-darwin8*:i?86-apple-darwin*|*:arm*-apple-darwin*)
dnl Revert the changes made above. From this point on, the target
dnl compiler will never be used without applying the SDK to CFLAGS
dnl (see --with-macos-sdk below).
@ -1306,6 +1347,9 @@ case "$target" in
AS='$(CC) -x assembler-with-cpp'
CFLAGS="$CFLAGS -Wall -fno-common"
case "${target_cpu}" in
arm*)
CPU_ARCH=arm
;;
i*86*)
if test -n "$USE_64"; then
CPU_ARCH=x86_64
@ -1320,6 +1364,7 @@ case "$target" in
if test "`echo $CC | grep -c '\-arch '`" = "0"; then
CC="$CC -arch $CPU_ARCH"
fi
AC_CHECK_HEADER(crt_externs.h)
DSO_CFLAGS=-fPIC
DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names'
_OPTIMIZE_FLAGS=-O2

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

@ -129,6 +129,14 @@ PR_IMPLEMENT(void) PL_InitArenaPool(
pool->first.base = pool->first.avail = pool->first.limit =
(PRUword)PL_ARENA_ALIGN(pool, &pool->first + 1);
pool->current = &pool->first;
/*
* Compute the net size so that each arena's gross size is |size|.
* sizeof(PLArena) + pool->mask is the header and alignment slop
* that PL_ArenaAllocate adds to the net size.
*/
if (size > sizeof(PLArena) + pool->mask)
pool->arenasize = size - (sizeof(PLArena) + pool->mask);
else
pool->arenasize = size;
#ifdef PL_ARENAMETER
memset(&pool->stats, 0, sizeof pool->stats);

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

@ -44,7 +44,12 @@ typedef struct PLArenaPool PLArenaPool;
/*
** Initialize an arena pool with the given name for debugging and metering,
** with a minimum size per arena of size bytes.
** with a minimum gross size per arena of size bytes. The net size per arena
** is smaller than the gross size by a header of four pointers plus any
** necessary padding for alignment.
**
** Note: choose a gross size that's a power of two to avoid the heap allocator
** rounding the size up.
**/
PR_EXTERN(void) PL_InitArenaPool(
PLArenaPool *pool, const char *name, PRUint32 size, PRUint32 align);

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

@ -1 +0,0 @@
Makefile

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

@ -1,52 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Netscape Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998-2000
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
MOD_DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(MOD_DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
DIRS = include src tests
include $(topsrcdir)/config/rules.mk
export:: $(TARGETS)

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

@ -1 +0,0 @@
Makefile

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

@ -1,57 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Netscape Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998-2000
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
#! gmake
MOD_DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(MOD_DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
EXPORT_HEADERS = prgc.h
HEADERS = $(EXPORT_HEADERS) gcint.h
RELEASE_HEADERS = $(EXPORT_HEADERS)
RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)
include $(topsrcdir)/config/rules.mk
export:: $(EXPORT_HEADERS)
$(INSTALL) -m 444 $(EXPORT_HEADERS) $(dist_includedir)

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

@ -1,129 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef gcint_h___
#define gcint_h___
#include "prmon.h"
#include "prgc.h"
extern PRLogModuleInfo *_pr_msgc_lm;
extern GCInfo _pr_gcData;
#if defined(_WIN32) && !defined(DEBUG)
#undef INLINE_LOCK
#endif
#ifdef INLINE_LOCK
#define LOCK_GC() EnterCriticalSection(&_pr_gcData.lock->mutexHandle)
#define UNLOCK_GC() LeaveCriticalSection(&_pr_gcData.lock->mutexHandle)
#else
#define LOCK_GC() PR_EnterMonitor(_pr_gcData.lock)
#define UNLOCK_GC() PR_ExitMonitor (_pr_gcData.lock)
#define GC_IS_LOCKED() (PR_GetMonitorEntryCount(_pr_gcData.lock)!=0)
#endif
#ifdef DEBUG
#define _GCTRACE(x, y) if (_pr_gcData.flags & x) GCTrace y
#else
#define _GCTRACE(x, y)
#endif
extern GCBeginGCHook *_pr_beginGCHook;
extern void *_pr_beginGCHookArg;
extern GCBeginGCHook *_pr_endGCHook;
extern void *_pr_endGCHookArg;
extern GCBeginFinalizeHook *_pr_beginFinalizeHook;
extern void *_pr_beginFinalizeHookArg;
extern GCBeginFinalizeHook *_pr_endFinalizeHook;
extern void *_pr_endFinalizeHookArg;
extern int _pr_do_a_dump;
extern FILE *_pr_dump_file;
extern PRLogModuleInfo *_pr_gc_lm;
/*
** Root finders. Root finders are used by the GC to find pointers into
** the GC heap that are not contained in the GC heap.
*/
typedef struct RootFinderStr RootFinder;
struct RootFinderStr {
RootFinder *next;
GCRootFinder *func;
char *name;
void *arg;
};
extern RootFinder *_pr_rootFinders;
typedef struct CollectorTypeStr {
GCType gctype;
PRUint32 flags;
} CollectorType;
#define GC_MAX_TYPES 256
extern CollectorType *_pr_collectorTypes;
#define _GC_TYPE_BUSY 0x1
#define _GC_TYPE_FINAL 0x2
#define _GC_TYPE_WEAK 0x4
/* Slot in _pr_gcTypes used for free memory */
#define FREE_MEMORY_TYPEIX 255
extern void _PR_InitGC(PRWord flags);
extern void _MD_InitGC(void);
extern void PR_CALLBACK _PR_ScanFinalQueue(void *notused);
/*
** Grow the GC Heap.
*/
extern void *_MD_GrowGCHeap(PRUint32 *sizep);
/*
** Extend the GC Heap.
*/
extern PRBool _MD_ExtendGCHeap(char *base, PRInt32 oldSize, PRInt32 newSize);
/*
** Free a GC segment.
*/
extern void _MD_FreeGCSegment(void *base, PRInt32 len);
#endif /* gcint_h___ */

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

@ -1,419 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef prgc_h___
#define prgc_h___
/*
** API to NSPR gc memory system.
*/
#include "prtypes.h"
#include "prmon.h"
#include "prthread.h"
#include <stdio.h>
#if defined(WIN16)
#define GCPTR __far
#else
#define GCPTR
#endif
PR_BEGIN_EXTERN_C
/*
** Initialize the garbage collector.
** "flags" is the trace flags (see below).
** "initialHeapSize" is the initial size of the heap and may be zero
** if the default is desired.
** "segmentSize" is the size of each segment of memory added to the
** heap when the heap is grown.
*/
PR_EXTERN(void) PR_InitGC(
PRWord flags, PRInt32 initialHeapSize, PRInt32 segmentSize, PRThreadScope scope);
/*
** Shuts down gc and frees up all memory associated with it.
*/
PR_EXTERN(void) PR_ShutdownGC(PRBool finalizeOnExit);
/*
** This walk function will be called for every gc object in the
** heap as it is walked. If it returns non-zero, the walk is terminated.
*/
typedef PRInt32 (*PRWalkFun)(void GCPTR* obj, void* data);
/*
** GC Type record. This defines all of the GC operations used on a
** particular object type. These structures are passed to
** PR_RegisterType.
*/
typedef struct GCType {
/*
** Scan an object that is in the GC heap and call GCInfo.livePointer
** on all of the pointers in it. If this slot is null then the object
** won't be scanned (i.e. it has no embedded pointers).
*/
void (PR_CALLBACK *scan)(void GCPTR *obj);
/*
** Finalize an object that has no references. This is called by the
** GC after it has determined where the object debris is but before
** it has moved the debris to the logical "free list". The object is
** marked alive for this call and removed from the list of objects
** that need finalization (finalization only happens once for an
** object). If this slot is null then the object doesn't need
** finalization.
*/
void (PR_CALLBACK *finalize)(void GCPTR *obj);
/*
** Dump out an object during a PR_DumpGCHeap(). This is used as a
** debugging tool.
*/
void (PR_CALLBACK *dump)(FILE *out, void GCPTR *obj, PRBool detailed, PRIntn indentLevel);
/*
** Add object to summary table.
*/
void (PR_CALLBACK *summarize)(void GCPTR *obj, PRUint32 bytes);
/*
** Free hook called by GC when the object is being freed.
*/
void (PR_CALLBACK *free)(void *obj);
/* Weak pointer support: If the object has a weak pointer (Note:
at most one), this function is used to get the weak link's
offset from the start of the body of a gc object */
PRUint32 (PR_CALLBACK *getWeakLinkOffset)(void *obj);
/* Descriptive character for dumping this GCType */
char kindChar;
/*
** Walker routine. This routine should apply fun(obj->ptr, data)
** for every gc pointer within the object.
*/
PRInt32 (PR_CALLBACK *walk)(void GCPTR *obj, PRWalkFun fun, void* data);
} GCType;
/*
** This data structure must be added as the hash table passed to
** the summarize method of GCType.
*/
typedef struct PRSummaryEntry {
void* clazz;
PRInt32 instancesCount;
PRInt32 totalSize;
} PRSummaryEntry;
/*
** This function pointer must be registered by users of nspr
** to produce the finally summary after all object in the
** heap have been visited.
*/
typedef void (PR_CALLBACK *PRSummaryPrinter)(FILE *out, void* closure);
PR_EXTERN(void) PR_CALLBACK PR_RegisterSummaryPrinter(PRSummaryPrinter fun, void* closure);
typedef void PR_CALLBACK GCRootFinder(void *arg);
typedef void PR_CALLBACK GCBeginFinalizeHook(void *arg);
typedef void PR_CALLBACK GCEndFinalizeHook(void *arg);
typedef void PR_CALLBACK GCBeginGCHook(void *arg);
typedef void PR_CALLBACK GCEndGCHook(void *arg);
typedef enum { PR_GCBEGIN, PR_GCEND } GCLockHookArg;
typedef void PR_CALLBACK GCLockHookFunc(GCLockHookArg arg1, void *arg2);
typedef struct GCLockHook GCLockHook;
struct GCLockHook {
GCLockHookFunc* func;
void* arg;
GCLockHook* next;
GCLockHook* prev;
};
/*
** Hooks which are called at the beginning and end of the GC process.
** The begin hooks are called before the root finding step. The hooks are
** called with threading disabled, so it is now allowed to re-enter the
** kernel. The end hooks are called after the gc has finished but before
** the finalizer has run.
*/
PR_EXTERN(void) PR_CALLBACK PR_SetBeginGCHook(GCBeginGCHook *hook, void *arg);
PR_EXTERN(void) PR_CALLBACK PR_GetBeginGCHook(GCBeginGCHook **hook, void **arg);
PR_EXTERN(void) PR_CALLBACK PR_SetEndGCHook(GCBeginGCHook *hook, void *arg);
PR_EXTERN(void) PR_CALLBACK PR_GetEndGCHook(GCEndGCHook **hook, void **arg);
/*
** Called before SuspendAll is called by dogc, so that GC thread can hold
** all the locks before hand to avoid any deadlocks
*/
/*
PR_EXTERN(void) PR_SetGCLockHook(GCLockHook *hook, void *arg);
PR_EXTERN(void) PR_GetGCLockHook(GCLockHook **hook, void **arg);
*/
PR_EXTERN(int) PR_RegisterGCLockHook(GCLockHookFunc *hook, void *arg);
/*
** Hooks which are called at the beginning and end of the GC finalization
** process. After the GC has identified all of the dead objects in the
** heap, it looks for objects that need finalization. Before it calls the
** first finalization proc (see the GCType structure above) it calls the
** begin hook. When it has finalized the last object it calls the end
** hook.
*/
PR_EXTERN(void) PR_SetBeginFinalizeHook(GCBeginFinalizeHook *hook, void *arg);
PR_EXTERN(void) PR_GetBeginFinalizeHook(GCBeginFinalizeHook **hook, void **arg);
PR_EXTERN(void) PR_SetEndFinalizeHook(GCBeginFinalizeHook *hook, void *arg);
PR_EXTERN(void) PR_GetEndFinalizeHook(GCEndFinalizeHook **hook, void **arg);
/*
** Register a GC type. Return's the index into the GC internal type
** table. The returned value is passed to PR_AllocMemory. After the call,
** the "type" memory belongs to the GC (the caller must not free it or
** change it).
*/
PR_EXTERN(PRInt32) PR_RegisterType(GCType *type);
/*
** Register a root finder with the collector. The collector will call
** these functions to identify all of the roots before collection
** proceeds. "arg" is passed to the function when it is called.
*/
PR_EXTERN(PRStatus) PR_RegisterRootFinder(GCRootFinder func, char *name, void *arg);
/*
** Allocate some GC'able memory. The object must be at least bytes in
** size. The type index function for the object is specified. "flags"
** specifies some control flags. If PR_ALLOC_CLEAN is set then the memory
** is zero'd before being returned. If PR_ALLOC_DOUBLE is set then the
** allocated memory is double aligned.
**
** Any memory cell that you store a pointer to something allocated by
** this call must be findable by the GC. Use the PR_RegisterRootFinder to
** register new places where the GC will look for pointers into the heap.
** The GC already knows how to scan any NSPR threads or monitors.
*/
PR_EXTERN(PRWord GCPTR *)PR_AllocMemory(
PRWord bytes, PRInt32 typeIndex, PRWord flags);
PR_EXTERN(PRWord GCPTR *)PR_AllocSimpleMemory(
PRWord bytes, PRInt32 typeIndex);
/*
** This function can be used to cause PR_AllocMemory to always return
** NULL. This may be useful in low memory situations when we're trying to
** shutdown applets.
*/
PR_EXTERN(void) PR_EnableAllocation(PRBool yesOrNo);
/* flags bits */
#define PR_ALLOC_CLEAN 0x1
#define PR_ALLOC_DOUBLE 0x2
#define PR_ALLOC_ZERO_HANDLE 0x4 /* XXX yes, it's a hack */
/*
** Force a garbage collection right now. Return when it completes.
*/
PR_EXTERN(void) PR_GC(void);
/*
** Force a finalization right now. Return when finalization has
** completed. Finalization completes when there are no more objects
** pending finalization. This does not mean there are no objects in the
** gc heap that will need finalization should a collection be done after
** this call.
*/
PR_EXTERN(void) PR_ForceFinalize(void);
/*
** Dump the GC heap out to the given file. This will stop the system dead
** in its tracks while it is occuring.
*/
PR_EXTERN(void) PR_DumpGCHeap(FILE *out, PRBool detailed);
/*
** Wrapper for PR_DumpGCHeap
*/
PR_EXTERN(void) PR_DumpMemory(PRBool detailed);
/*
** Dump summary of objects allocated.
*/
PR_EXTERN(void) PR_DumpMemorySummary(void);
/*
** Dump the application heaps.
*/
PR_EXTERN(void) PR_DumpApplicationHeaps(void);
/*
** Helper function used by dump routines to do the indentation in a
** consistent fashion.
*/
PR_EXTERN(void) PR_DumpIndent(FILE *out, PRIntn indent);
/*
** The GCInfo structure contains all of the GC state...
**
** busyMemory:
** The amount of GC heap memory that is busy at this instant. Busy
** doesn't mean alive, it just means that it has been
** allocated. Immediately after a collection busy means how much is
** alive.
**
** freeMemory:
** The amount of GC heap memory that is as yet unallocated.
**
** allocMemory:
** The sum of free and busy memory in the GC heap.
**
** maxMemory:
** The maximum size that the GC heap is allowed to grow.
**
** lowSeg:
** The lowest segment currently used in the GC heap.
**
** highSeg:
** The highest segment currently used in the GC heap.
** The lowSeg and highSeg members are used for a "quick test" of whether
** a pointer falls within the GC heap. [ see GC_IN_HEAP(...) ]
**
** lock:
** Monitor used for synchronization within the GC.
**
** finalizer:
** Thread in which the GC finalizer is running.
**
** liveBlock:
** Object scanning functions call through this function pointer to
** register a potential block of pointers with the collector. (This is
** currently not at all different than processRoot.)
**
** livePointer:
** Object scanning functions call through this function pointer to
** register a single pointer with the collector.
**
** processRootBlock:
** When a root finder identifies a root it should call through this
** function pointer so that the GC can process the root. The call takes
** a base address and count which the gc will examine for valid heap
** pointers.
**
** processRootPointer:
** When a root finder identifies a root it should call through this
** function pointer so that the GC can process the root. The call takes
** a single pointer value.
*/
typedef struct GCInfoStr {
PRWord flags; /* trace flags (see below) */
PRWord busyMemory; /* memory in use right now */
PRWord freeMemory; /* memory free right now */
PRWord allocMemory; /* sum of busy & free memory */
PRWord maxMemory; /* max memory we are allowed to allocate */
PRWord *lowSeg; /* lowest segment in the GC heap */
PRWord *highSeg; /* highest segment in the GC heap */
PRMonitor *lock;
PRThread *finalizer;
void (PR_CALLBACK *liveBlock)(void **base, PRInt32 count);
void (PR_CALLBACK *livePointer)(void *ptr);
void (PR_CALLBACK *processRootBlock)(void **base, PRInt32 count);
void (PR_CALLBACK *processRootPointer)(void *ptr);
FILE* dumpOutput;
#ifdef GCTIMINGHOOK
void (*gcTimingHook)(int32 gcTime);
#endif
} GCInfo;
PR_EXTERN(GCInfo *) PR_GetGCInfo(void);
PR_EXTERN(PRBool) PR_GC_In_Heap(void GCPTR *object);
/*
** Simple bounds check to see if a pointer is anywhere near the GC heap.
** Used to avoid calls to PR_ProcessRoot and GCInfo.livePointer by object
** scanning code.
*/
#if !defined(XP_PC) || defined(_WIN32)
#define GC_IN_HEAP(_info, _p) (((PRWord*)(_p) >= (_info)->lowSeg) && \
((PRWord*)(_p) < (_info)->highSeg))
#else
/*
** The simple bounds check, above, doesn't work in Win16, because we don't
** maintain: lowSeg == MIN(all segments) and highSeg == MAX(all segments).
** So we have to do a little better.
*/
#define GC_IN_HEAP(_info, _p) PR_GC_In_Heap(_p)
#endif
PR_EXTERN(PRWord) PR_GetObjectHeader(void *ptr);
PR_EXTERN(PRWord) PR_SetObjectHeader(void *ptr, PRWord newUserBits);
/************************************************************************/
/* Trace flags (passed to PR_InitGC or in environment GCLOG) */
#define GC_TRACE 0x0001
#define GC_ROOTS 0x0002
#define GC_LIVE 0x0004
#define GC_ALLOC 0x0008
#define GC_MARK 0x0010
#define GC_SWEEP 0x0020
#define GC_DEBUG 0x0040
#define GC_FINAL 0x0080
#if defined(DEBUG_kipp) || defined(DEBUG_warren)
#define GC_CHECK 0x0100
#endif
#ifdef DEBUG
#define GCTRACE(x, y) if (PR_GetGCInfo()->flags & x) GCTrace y
PR_EXTERN(void) GCTrace(char *fmt, ...);
#else
#define GCTRACE(x, y)
#endif
PR_END_EXTERN_C
#endif /* prgc_h___ */

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

@ -1 +0,0 @@
Makefile

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

@ -1,93 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Netscape Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998-2000
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
#! gmake
MOD_DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(MOD_DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
INCLUDES = -I$(dist_includedir) -I../include
CSRCS = prgcapi.c prmsgc.c
ifeq ($(OS_ARCH),WINNT)
CSRCS += win32gc.c
else
ifeq ($(OS_ARCH),OS2)
CSRCS += os2gc.c
else
CSRCS += unixgc.c
endif
endif
NSPR_VERSION = $(MOD_MAJOR_VERSION)
EXTRA_LIBS = $(LIBNSPR)
ifdef RESOLVE_LINK_SYMBOLS
EXTRA_LIBS += $(OS_LIBS)
endif
ifeq ($(OS_ARCH), WINNT)
#RES=$(OBJDIR)/ds.res
#RESNAME=$(MOD_DEPTH)/pr/src/nspr.rc
#OS_LIBS = user32.lib
endif # WINNT
LIBRARY_NAME = msgc
LIBRARY_VERSION = $(MOD_MAJOR_VERSION)
RELEASE_LIBS = $(TARGETS)
include $(topsrcdir)/config/rules.mk
#
# The Client build wants the shared libraries in $(dist_bindir),
# so we also install them there.
#
export:: $(TARGETS)
$(INSTALL) -m 444 $(TARGETS) $(dist_libdir)
ifdef SHARED_LIBRARY
$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
endif

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

@ -1,83 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* GC related routines
*
*/
#include "prlog.h"
#include <stdlib.h>
/* Leave a bit of room for any malloc header bytes... */
#define MAX_SEGMENT_SIZE (65536L - 4096L)
/************************************************************************/
/*
** Machine dependent GC Heap management routines:
** _MD_GrowGCHeap
*/
/************************************************************************/
void _MD_InitGC() {}
void *_MD_GrowGCHeap(PRUint32 *sizep)
{
void *addr;
if ( *sizep > MAX_SEGMENT_SIZE )
{
*sizep = MAX_SEGMENT_SIZE;
}
addr = malloc((size_t)*sizep);
return addr;
}
PRBool _MD_ExtendGCHeap(char *base, PRInt32 oldSize, PRInt32 newSize) {
/* Not sure about this. Todd? */
return PR_FALSE;
}
void _MD_FreeGCSegment(void *base, PRInt32 len)
{
if (base)
{
free(base);
}
}

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

@ -1,330 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include "prenv.h"
#include "prmem.h"
#include "prmon.h"
#include "prlog.h"
#include "prthread.h"
#include "private/pprthred.h"
#include "gcint.h"
/*
** Generic GC implementation independent code for the NSPR GC
*/
RootFinder *_pr_rootFinders;
CollectorType *_pr_collectorTypes;
/* GC State information */
GCInfo _pr_gcData;
GCBeginGCHook *_pr_beginGCHook;
void *_pr_beginGCHookArg;
GCBeginGCHook *_pr_endGCHook;
void *_pr_endGCHookArg;
GCBeginFinalizeHook *_pr_beginFinalizeHook;
void *_pr_beginFinalizeHookArg;
GCBeginFinalizeHook *_pr_endFinalizeHook;
void *_pr_endFinalizeHookArg;
FILE *_pr_dump_file;
int _pr_do_a_dump;
GCLockHook *_pr_GCLockHook;
extern PRLogModuleInfo *_pr_msgc_lm;
/************************************************************************/
static PRStatus PR_CALLBACK
pr_ScanOneThread(PRThread* t, void** addr, PRUword count, void* closure)
{
_pr_gcData.processRootBlock(addr, count);
return PR_SUCCESS;
}
/*
** Scan all of the threads C stack's and registers, looking for "root"
** pointers into the GC heap. These are the objects that the GC cannot
** move and are considered "live" by the GC. Caller has stopped all of
** the threads from running.
*/
static void PR_CALLBACK ScanThreads(void *arg)
{
PR_ScanStackPointers(pr_ScanOneThread, arg);
}
/************************************************************************/
PR_IMPLEMENT(GCInfo *) PR_GetGCInfo(void)
{
return &_pr_gcData;
}
PR_IMPLEMENT(PRInt32) PR_RegisterType(GCType *t)
{
CollectorType *ct, *ect;
int rv = -1;
LOCK_GC();
ct = &_pr_collectorTypes[0];
ect = &_pr_collectorTypes[FREE_MEMORY_TYPEIX];
for (; ct < ect; ct++) {
if (ct->flags == 0) {
ct->gctype = *t;
ct->flags = _GC_TYPE_BUSY;
if (0 != ct->gctype.finalize) {
ct->flags |= _GC_TYPE_FINAL;
}
if (0 != ct->gctype.getWeakLinkOffset) {
ct->flags |= _GC_TYPE_WEAK;
}
rv = ct - &_pr_collectorTypes[0];
break;
}
}
UNLOCK_GC();
return rv;
}
PR_IMPLEMENT(PRStatus) PR_RegisterRootFinder(
GCRootFinder f, char *name, void *arg)
{
RootFinder *rf = PR_NEWZAP(RootFinder);
if (rf) {
rf->func = f;
rf->name = name;
rf->arg = arg;
LOCK_GC();
rf->next = _pr_rootFinders;
_pr_rootFinders = rf;
UNLOCK_GC();
return PR_SUCCESS;
}
return PR_FAILURE;
}
PR_IMPLEMENT(int) PR_RegisterGCLockHook(GCLockHookFunc* f, void *arg)
{
GCLockHook *rf = 0;
rf = (GCLockHook*) calloc(1, sizeof(GCLockHook));
if (rf) {
rf->func = f;
rf->arg = arg;
LOCK_GC();
/* first dummy node */
if (! _pr_GCLockHook) {
_pr_GCLockHook = (GCLockHook*) calloc(1, sizeof(GCLockHook));
_pr_GCLockHook->next = _pr_GCLockHook;
_pr_GCLockHook->prev = _pr_GCLockHook;
}
rf->next = _pr_GCLockHook;
rf->prev = _pr_GCLockHook->prev;
_pr_GCLockHook->prev->next = rf;
_pr_GCLockHook->prev = rf;
UNLOCK_GC();
return 0;
}
return -1;
}
/*
PR_IMPLEMENT(void) PR_SetGCLockHook(GCLockHook *hook, void *arg)
{
LOCK_GC();
_pr_GCLockHook = hook;
_pr_GCLockHookArg2 = arg;
UNLOCK_GC();
}
PR_IMPLEMENT(void) PR_GetGCLockHook(GCLockHook **hook, void **arg)
{
LOCK_GC();
*hook = _pr_GCLockHook;
*arg = _pr_GCLockHookArg2;
UNLOCK_GC();
}
*/
PR_IMPLEMENT(void) PR_SetBeginGCHook(GCBeginGCHook *hook, void *arg)
{
LOCK_GC();
_pr_beginGCHook = hook;
_pr_beginGCHookArg = arg;
UNLOCK_GC();
}
PR_IMPLEMENT(void) PR_GetBeginGCHook(GCBeginGCHook **hook, void **arg)
{
LOCK_GC();
*hook = _pr_beginGCHook;
*arg = _pr_beginGCHookArg;
UNLOCK_GC();
}
PR_IMPLEMENT(void) PR_SetEndGCHook(GCEndGCHook *hook, void *arg)
{
LOCK_GC();
_pr_endGCHook = hook;
_pr_endGCHookArg = arg;
UNLOCK_GC();
}
PR_IMPLEMENT(void) PR_GetEndGCHook(GCEndGCHook **hook, void **arg)
{
LOCK_GC();
*hook = _pr_endGCHook;
*arg = _pr_endGCHookArg;
UNLOCK_GC();
}
PR_IMPLEMENT(void) PR_SetBeginFinalizeHook(GCBeginFinalizeHook *hook, void *arg)
{
LOCK_GC();
_pr_beginFinalizeHook = hook;
_pr_beginFinalizeHookArg = arg;
UNLOCK_GC();
}
PR_IMPLEMENT(void) PR_GetBeginFinalizeHook(GCBeginFinalizeHook **hook,
void **arg)
{
LOCK_GC();
*hook = _pr_beginFinalizeHook;
*arg = _pr_beginFinalizeHookArg;
UNLOCK_GC();
}
PR_IMPLEMENT(void) PR_SetEndFinalizeHook(GCEndFinalizeHook *hook, void *arg)
{
LOCK_GC();
_pr_endFinalizeHook = hook;
_pr_endFinalizeHookArg = arg;
UNLOCK_GC();
}
PR_IMPLEMENT(void) PR_GetEndFinalizeHook(GCEndFinalizeHook **hook, void **arg)
{
LOCK_GC();
*hook = _pr_endFinalizeHook;
*arg = _pr_endFinalizeHookArg;
UNLOCK_GC();
}
#ifdef DEBUG
#include "prprf.h"
PR_IMPLEMENT(void) GCTrace(char *fmt, ...)
{
va_list ap;
char buf[400];
va_start(ap, fmt);
PR_vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
PR_LOG(_pr_msgc_lm, PR_LOG_ALWAYS, ("%s", buf));
}
#endif
void _PR_InitGC(PRWord flags)
{
static char firstTime = 1;
if (!firstTime) return;
firstTime = 0;
_MD_InitGC();
if (flags == 0) {
char *ev = PR_GetEnv("GCLOG");
if (ev && ev[0]) {
flags = atoi(ev);
}
}
_pr_gcData.flags = flags;
_pr_gcData.lock = PR_NewMonitor();
_pr_collectorTypes = (CollectorType*) PR_CALLOC(256 * sizeof(CollectorType));
PR_RegisterRootFinder(ScanThreads, "scan threads", 0);
PR_RegisterRootFinder(_PR_ScanFinalQueue, "scan final queue", 0);
}
extern void pr_FinalizeOnExit(void);
#ifdef DEBUG
#ifdef GC_STATS
PR_PUBLIC_API(void) PR_PrintGCAllocStats(void);
#endif
#endif
PR_IMPLEMENT(void)
PR_ShutdownGC(PRBool finalizeOnExit)
{
/* first finalize all the objects in the heap */
if (finalizeOnExit) {
pr_FinalizeOnExit();
}
#ifdef DEBUG
#ifdef GC_STATS
PR_PrintGCAllocStats();
#endif /* GC_STATS */
#endif /* DEBUG */
/* then the chance for any future allocations */
/* finally delete the gc heap */
/* write me */
}
/******************************************************************************/

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,155 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "prlock.h"
#include "prlog.h"
#include "prmem.h"
#include "gcint.h"
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#define _PR_GC_VMBASE 0x40000000
#if defined(SOLARIS)
#define _MD_MMAP_FLAGS MAP_SHARED
#elif defined(RELIANTUNIX)
#define _MD_MMAP_FLAGS MAP_PRIVATE|MAP_FIXED
#else
#define _MD_MMAP_FLAGS MAP_PRIVATE
#endif
static PRInt32 zero_fd = -1;
static PRLock *zero_fd_lock = NULL;
void _MD_InitGC(void)
{
#ifdef DEBUG
/*
* Disable using mmap(2) if NSPR_NO_MMAP is set
*/
if (getenv("NSPR_NO_MMAP")) {
zero_fd = -2;
return;
}
#endif
zero_fd = open("/dev/zero",O_RDWR , 0);
zero_fd_lock = PR_NewLock();
}
/* This static variable is used by _MD_GrowGCHeap and _MD_ExtendGCHeap */
static void *lastaddr = (void*) _PR_GC_VMBASE;
void *_MD_GrowGCHeap(PRUint32 *sizep)
{
void *addr;
PRUint32 size;
size = *sizep;
PR_Lock(zero_fd_lock);
if (zero_fd < 0) {
goto mmap_loses;
}
/* Extend the mapping */
addr = mmap(lastaddr, size, PROT_READ|PROT_WRITE|PROT_EXEC,
_MD_MMAP_FLAGS,
zero_fd, 0);
if (addr == (void*)-1) {
zero_fd = -1;
goto mmap_loses;
}
lastaddr = ((char*)addr + size);
#ifdef DEBUG
PR_LOG(_pr_msgc_lm, PR_LOG_WARNING,
("GC: heap extends from %08x to %08x\n",
_PR_GC_VMBASE,
_PR_GC_VMBASE + (char*)lastaddr - (char*)_PR_GC_VMBASE));
#endif
PR_Unlock(zero_fd_lock);
return addr;
mmap_loses:
PR_Unlock(zero_fd_lock);
return PR_MALLOC(size);
}
/* XXX - This is disabled. MAP_FIXED just does not work. */
#if 0
PRBool _MD_ExtendGCHeap(char *base, PRInt32 oldSize, PRInt32 newSize) {
PRBool rv = PR_FALSE;
void* addr;
PRInt32 allocSize = newSize - oldSize;
PR_Lock(zero_fd_lock);
addr = mmap(base + oldSize, allocSize, PROT_READ|PROT_WRITE|PROT_EXEC,
_MD_MMAP_FLAGS | MAP_FIXED, zero_fd, 0);
if (addr == (void*)-1) {
goto loser;
}
if (addr != (void*) (base + oldSize)) {
munmap(base + oldSize, allocSize);
goto loser;
}
lastaddr = ((char*)base + newSize);
PR_LOG(_pr_msgc_lm, PR_LOG_ALWAYS,
("GC: heap now extends from %p to %p",
base, base + newSize));
rv = PR_TRUE;
loser:
PR_Unlock(zero_fd_lock);
return rv;
}
#else
PRBool _MD_ExtendGCHeap(char *base, PRInt32 oldSize, PRInt32 newSize) {
return PR_FALSE;
}
#endif
void _MD_FreeGCSegment(void *base, PRInt32 len)
{
if (zero_fd < 0) {
PR_DELETE(base);
} else {
(void) munmap(base, len);
}
}

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

@ -1,129 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* GC related routines
*
*/
#include <windows.h>
#include "prlog.h"
extern PRLogModuleInfo* _pr_msgc_lm;
#define GC_VMBASE 0x40000000
#define GC_VMLIMIT 0x00FFFFFF
/************************************************************************/
/*
** Machine dependent GC Heap management routines:
** _MD_GrowGCHeap
*/
/************************************************************************/
void *baseaddr = (void*) GC_VMBASE;
void *lastaddr = (void*) GC_VMBASE;
void _MD_InitGC() {}
void *_MD_GrowGCHeap(PRUint32 *sizep)
{
void *addr;
size_t size;
/* Reserve a block of memory for the GC */
if( lastaddr == baseaddr ) {
addr = VirtualAlloc( (void *)GC_VMBASE, GC_VMLIMIT, MEM_RESERVE, PAGE_READWRITE );
/*
** If the GC_VMBASE address is already mapped, then let the OS choose a
** base address that is available...
*/
if (addr == NULL) {
addr = VirtualAlloc( NULL, GC_VMLIMIT, MEM_RESERVE, PAGE_READWRITE );
baseaddr = lastaddr = addr;
if (addr == NULL) {
PR_LOG(_pr_msgc_lm, PR_LOG_ALWAYS, ("GC: unable to allocate heap: LastError=%ld",
GetLastError()));
return 0;
}
}
}
size = *sizep;
/* Extend the mapping */
addr = VirtualAlloc( lastaddr, size, MEM_COMMIT, PAGE_READWRITE );
if (addr == NULL) {
return 0;
}
lastaddr = ((char*)addr + size);
PR_LOG(_pr_msgc_lm, PR_LOG_ALWAYS,
("GC: heap extends from %08x to %08x",
baseaddr, (long)baseaddr + (char*)lastaddr - (char*)baseaddr));
return addr;
}
PRBool _MD_ExtendGCHeap(char *base, PRInt32 oldSize, PRInt32 newSize) {
void* addr;
addr = VirtualAlloc( base + oldSize, newSize - oldSize,
MEM_COMMIT, PAGE_READWRITE );
if (NULL == addr) {
PR_LOG(_pr_msgc_lm, PR_LOG_ALWAYS, ("GC: unable to extend heap: LastError=%ld",
GetLastError()));
return PR_FALSE;
}
if (base + oldSize != (char*)addr) {
PR_LOG(_pr_msgc_lm, PR_LOG_ALWAYS, ("GC: segment extension returned %x instead of %x",
addr, base + oldSize));
VirtualFree(addr, newSize - oldSize, MEM_DECOMMIT);
return PR_FALSE;
}
lastaddr = base + newSize;
PR_LOG(_pr_msgc_lm, PR_LOG_ALWAYS,
("GC: heap now extends from %p to %p",
base, base + newSize));
return PR_TRUE;
}
void _MD_FreeGCSegment(void *base, PRInt32 len)
{
(void)VirtualFree(base, 0, MEM_RELEASE);
}

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

@ -1 +0,0 @@
Makefile

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

@ -1,270 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Netscape Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998-2000
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
#! gmake
MOD_DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(MOD_DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
ifeq ($(OS_TARGET), OS2)
OS_CFLAGS = $(OS_EXE_CFLAGS)
endif
CSRCS = gc1.c thrashgc.c
ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
PROG_SUFFIX = .exe
else
PROG_SUFFIX =
endif
PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
TARGETS = $(PROGS) $(OBJS)
INCLUDES = -I$(dist_includedir)
# Setting the variables LDOPTS and LIBPR. We first initialize
# them to the default values, then adjust them for some platforms.
LDOPTS = -L$(dist_libdir)
NSPR_VERSION = $(MOD_MAJOR_VERSION)
GC_VERSION = $(MOD_MAJOR_VERSION)
LIBPR = -lnspr$(NSPR_VERSION)
LIBPLC = -lplc$(NSPR_VERSION)
LIBGC = -lmsgc$(GC_VERSION)
ifeq ($(OS_ARCH), WINNT)
LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO
LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
LIBGC= $(dist_libdir)/libmsgc$(GC_VERSION).$(LIB_SUFFIX)
endif
ifeq ($(OS_ARCH),OS2)
LDOPTS += -Zomf -Zlinker /PM:VIO
endif
ifneq ($(OS_ARCH), WINNT)
PWD = $(shell pwd)
endif
ifeq ($(OS_ARCH), IRIX)
LDOPTS += -rpath $(PWD)/$(dist_libdir) -rdata_shared
# For 6.x machines, include this flag
ifeq ($(basename $(OS_RELEASE)),6)
ifeq ($(USE_N32),1)
LDOPTS += -n32
else
LDOPTS += -32
endif
endif
endif
ifeq ($(OS_ARCH), OSF1)
# I haven't figured out how to pass -rpath to cc on OSF1 V3.2, so
# we do static linking.
ifeq ($(OS_RELEASE), V3.2)
LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).a
LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).a
LIBGC = $(dist_libdir)/libmsgc$(GC_VERSION).a
EXTRA_LIBS = -lc_r
else
LDOPTS += -rpath $(PWD)/$(dist_libdir)
endif
endif
ifeq ($(OS_ARCH), HP-UX)
LDOPTS += -z -Wl,+s,+b,$(PWD)/$(dist_libdir)
endif
# AIX
ifeq ($(OS_ARCH),AIX)
LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib
ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1)
LIBPR = -lnspr$(NSPR_VERSION)_shr
LIBPLC = -lplc$(NSPR_VERSION)_shr
LIBGC = -lmsgc$(GC_VERSION)_shr
else
LDOPTS += -brtl
EXTRA_LIBS = -ldl
endif
endif
# Solaris
ifeq ($(OS_ARCH), SunOS)
ifneq ($(OS_RELEASE), 4.1.3_U1)
ifdef NS_USE_GCC
LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
else
LDOPTS += -R $(PWD)/$(dist_libdir)
endif
endif
# SunOS 5.5 needs to link with -lpthread, even though we already
# linked with this system library when we built libnspr.so.
ifeq ($(OS_RELEASE), 5.5)
ifdef USE_PTHREADS
EXTRA_LIBS = -lpthread
endif
endif
endif # SunOS
ifeq ($(OS_ARCH),NEC)
EXTRA_LIBS = $(OS_LIBS)
# This hardcodes in the executable programs the directory to find
# libnspr.so etc. at program startup. Equivalent to the -R or -rpath
# option for ld on other platforms.
export LD_RUN_PATH = $(PWD)/$(dist_libdir)
endif
ifeq ($(OS_ARCH), NCR)
# XXX: We see some strange problems when we link with libnspr.so.
# So for now we use static libraries on NCR. The shared library
# stuff below is commented out.
LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).a
LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).a
LIBGC = $(dist_libdir)/libmsgc$(GC_VERSION).a
EXTRA_LIBS = -lsocket -lnsl -ldl
# NCR needs to link against -lsocket -lnsl (and -lc, which is linked
# implicitly by $(CC)) again even though we already linked with these
# system libraries when we built libnspr.so.
#EXTRA_LIBS = -lsocket -lnsl
# This hardcodes in the executable programs the directory to find
# libnspr.so etc. at program startup. Equivalent to the -R or -rpath
# option for ld on other platforms.
#export LD_RUN_PATH = $(PWD)/$(dist_libdir)
endif
ifeq ($(OS_ARCH), Linux)
ifeq ($(OS_RELEASE), 1.2)
EXTRA_LIBS = -ldl
endif
endif
ifeq ($(OS_ARCH), SCOOS)
# SCO Unix needs to link against -lsocket again even though we
# already linked with these system libraries when we built libnspr.so.
EXTRA_LIBS = -lsocket
# This hardcodes in the executable programs the directory to find
# libnspr.so etc. at program startup. Equivalent to the -R or -rpath
# option for ld on other platforms.
export LD_RUN_PATH = $(PWD)/$(dist_libdir)
endif
ifeq ($(OS_ARCH),SINIX)
EXTRA_LIBS = -lsocket -lnsl -lresolv -ldl
# This hardcodes in the executable programs the directory to find
# libnspr.so etc. at program startup. Equivalent to the -R or -rpath
# option for ld on other platforms.
export LD_RUN_PATH = $(PWD)/$(dist_libdir)
endif
ifeq ($(OS_ARCH), UNIXWARE)
export LD_RUN_PATH = $(PWD)/$(dist_libdir)
endif
ifeq ($(OS_ARCH),BSD_OS)
EXTRA_LIBS = -ldl
endif
ifeq ($(OS_ARCH),DGUX)
EXTRA_LIBS = -lsocket -lnsl -ldl
endif
#####################################################
#
# The rules
#
#####################################################
include $(topsrcdir)/config/rules.mk
AIX_PRE_4_2 = 0
ifeq ($(OS_ARCH),AIX)
ifneq ($(OS_RELEASE),4.2)
ifneq ($(USE_PTHREADS), 1)
#AIX_PRE_4_2 = 1
endif
endif
endif
ifeq ($(AIX_PRE_4_2),1)
# AIX releases prior to 4.2 need a special two-step linking hack
# in order to both override the system select() and be able to
# get at the original system select().
#
# We use a pattern rule in ns/nspr20/config/rules.mk to generate
# the .$(OBJ_SUFFIX) file from the .c source file, then do the
# two-step linking hack below.
$(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
@$(MAKE_OBJDIR)
rm -f $@ $(AIX_TMP)
$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(NSPR_VERSION).a
$(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
rm -f $(AIX_TMP)
else
# All platforms that are not AIX pre-4.2.
$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
@$(MAKE_OBJDIR)
ifeq ($(OS_ARCH), WINNT)
link $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) wsock32.lib -out:$@
else
ifeq ($(OS_ARCH),OS2)
$(LINK) $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) -o $@
else
$(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBGC) $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) -o $@
endif
endif
endif
export:: $(TARGETS)
clean::
rm -f $(TARGETS)

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

@ -1,242 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/***********************************************************************
** Includes
***********************************************************************/
/* Used to get the command line option */
#include "plgetopt.h"
#include "prgc.h"
#include "prinit.h"
#include "prmon.h"
#include "prinrval.h"
#include "private/pprthred.h"
#include <stdio.h>
#include <stdlib.h>
static PRMonitor *mon;
static PRInt32 threads, waiting, iterations;
static PRInt32 scanCount, finalizeCount, freeCount;
PRIntn failed_already=0;
PRIntn debug_mode;
typedef struct Array {
PRUintn size;
void *body[1];
} Array;
int arrayTypeIndex;
static void PR_CALLBACK ScanArray(void *a)
{
/* printf ("In ScanArray a = %X size = %d \n", a, a->size); */
scanCount++;
}
static void PR_CALLBACK FinalizeArray(void *a)
{
/* printf ("In FinalizeArray a = %X size = %d \n", a, a->size); */
finalizeCount++;
}
static void PR_CALLBACK FreeArray(void *a)
{
/* printf ("In FreeArray\n"); */
freeCount++;
}
static Array *NewArray(PRUintn size)
{
Array *a;
a = (Array *)PR_AllocMemory(sizeof(Array) + size*sizeof(void*) - 1*sizeof(void*),
arrayTypeIndex, PR_ALLOC_CLEAN);
/* printf ("In NewArray a = %X \n", a); */
if (a)
a->size = size;
return a;
}
GCType arrayType = {
ScanArray,
FinalizeArray,
0,
0,
FreeArray,
0
};
static void Initialize(void)
{
PR_InitGC(0, 0, 0, PR_GLOBAL_THREAD);
arrayTypeIndex = PR_RegisterType(&arrayType);
}
static void PR_CALLBACK AllocateLikeMad(void *arg)
{
Array *prev;
PRInt32 i;
PRInt32 count;
count = (PRInt32)arg;
prev = 0;
for (i = 0; i < count; i++) {
Array *leak = NewArray(i & 511);
if ((i & 1023) == 0) {
prev = 0; /* forget */
} else {
if (i & 1) {
prev = leak; /* remember */
}
}
}
PR_EnterMonitor(mon);
waiting++;
PR_Notify(mon);
PR_ExitMonitor(mon);
}
int main(int argc, char **argv)
{
PRIntervalTime start, stop, usec;
double d;
PRIntn i, totalIterations;
/* The command line argument: -d is used to determine if the test is being run
in debug mode. The regress tool requires only one line output:PASS or FAIL.
All of the printfs associated with this test has been handled with a if (debug_mode)
test.
Usage: test_name -d
*/
PLOptStatus os;
PLOptState *opt = PL_CreateOptState(argc, argv, "dt:c:");
threads = 10;
iterations = 100;
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
if (PL_OPT_BAD == os) {
fprintf(stderr, "Invalid command-line option\n");
exit(1);
}
switch (opt->option)
{
case 'd': /* debug mode */
debug_mode = 1;
break;
case 't': /* number of threads */
threads = atoi(opt->value);
break;
case 'c': /* iteration count */
iterations = atoi(opt->value);
break;
default:
break;
}
}
PL_DestroyOptState(opt);
fprintf(stderr, "t is %ld, i is %ld\n", (long) threads, (long) iterations);
/* main test */
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 5);
PR_STDIO_INIT();
Initialize();
/* Spin all of the allocator threads and then wait for them to exit */
start = PR_IntervalNow();
mon = PR_NewMonitor();
PR_EnterMonitor(mon);
waiting = 0;
for (i = 0; i < threads; i++) {
(void) PR_CreateThreadGCAble(PR_USER_THREAD,
AllocateLikeMad, (void*)iterations,
PR_PRIORITY_NORMAL,
PR_LOCAL_THREAD,
PR_UNJOINABLE_THREAD,
0);
}
while (waiting != threads) {
PR_Wait(mon, PR_INTERVAL_NO_TIMEOUT);
}
PR_ExitMonitor(mon);
PR_GC();
PR_ForceFinalize();
totalIterations = iterations * threads;
/*
if (scanCount != totalIterations)
printf ("scanCount discrepancy scanCount = %d totalIterations = %d \n",
scanCount, totalIterations);
if (freeCount != totalIterations)
printf ("freeCount discrepancy freeCount = %d totalIterations = %d \n",
freeCount, totalIterations);
if ((finalizeCount != totalIterations) && (finalizeCount != (totalIterations-1)))
printf ("finalizeCount discrepancy finalizeCount = %d totalIterations = %d \n",
finalizeCount,totalIterations);
*/
stop = PR_IntervalNow();
usec = stop = stop - start;
d = (double)usec;
if (debug_mode) printf("%40s: %6.2f usec\n", "GC allocation", d / (iterations * threads));
else {
if (d == 0.0) failed_already = PR_TRUE;
}
PR_Cleanup();
if(failed_already)
{
printf("FAIL\n");
return 1;
}
else
{
printf("PASS\n");
return 0;
}
}

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

@ -1,242 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/***********************************************************************
** Name: thrashgc
**
** Description: test garbace collection functions.
**
** Modification History:
** 19-May-97 AGarcia- Converted the test to accomodate the debug_mode flag.
** The debug mode will print all of the printfs associated with this test.
** The regress mode will be the default mode. Since the regress tool limits
** the output to a one line status:PASS or FAIL,all of the printf statements
** have been handled with an if (debug_mode) statement.
** 04-June-97 AGarcia removed the Test_Result function. Regress tool has been updated to
** recognize the return code from tha main program.
***********************************************************************/
/***********************************************************************
** Includes
***********************************************************************/
#include "prthread.h"
#include "prgc.h"
#include "prprf.h"
#include "prinrval.h"
#include "prlock.h"
#include "prinit.h"
#include "prcvar.h"
#include "private/pprthred.h"
#include <stdio.h>
#include <memory.h>
#include <string.h>
PRIntn failed_already=0;
PRIntn debug_mode;
static char* progname;
static PRInt32 loops = 1000;
static int tix1, tix2, tix3;
static GCInfo* gcInfo;
static PRLock* stderrLock;
typedef struct Type1 Type1;
typedef struct Type2 Type2;
struct Type1 {
Type2* atwo;
Type1* next;
};
struct Type2 {
void* buf;
};
static void PR_CALLBACK ScanType1(void *obj) {
gcInfo->livePointer(((Type1 *)obj)->atwo);
gcInfo->livePointer(((Type1 *)obj)->next);
}
static void PR_CALLBACK ScanType2(void *obj) {
gcInfo->livePointer(((Type2 *)obj)->buf);
}
static GCType type1 = {
ScanType1
};
static GCType type2 = {
ScanType2
/* (void (*)(void*)) ScanType2 */
};
static GCType type3 = {
0
};
Type1* NewType1(void) {
Type1* p = (Type1*) PR_AllocMemory(sizeof(Type1), tix1, PR_ALLOC_DOUBLE);
PR_ASSERT(p != NULL);
return p;
}
Type2* NewType2(void) {
Type2* p = (Type2*) PR_AllocMemory(sizeof(Type2), tix2, PR_ALLOC_DOUBLE);
PR_ASSERT(p != NULL);
return p;
}
void* NewBuffer(PRInt32 size) {
void* p = PR_AllocMemory(size, tix3, PR_ALLOC_DOUBLE);
PR_ASSERT(p != NULL);
return p;
}
/* Allocate alot of garbage */
static void PR_CALLBACK AllocStuff(void *unused) {
PRInt32 i;
void* danglingRefs[50];
PRIntervalTime start, end;
char msg[100];
start = PR_IntervalNow();
for (i = 0; i < loops; i++) {
void* p;
if (i & 1) {
Type1* t1 = NewType1();
t1->atwo = NewType2();
t1->next = NewType1();
t1->atwo->buf = NewBuffer(100);
p = t1;
} else {
Type2* t2 = NewType2();
t2->buf = NewBuffer(i & 16383);
p = t2;
}
if ((i % 10) == 0) {
memmove(&danglingRefs[0], &danglingRefs[1], 49*sizeof(void*));
danglingRefs[49] = p;
}
}
end = PR_IntervalNow();
if (debug_mode) PR_snprintf(msg, sizeof(msg), "Thread %p: %ld allocations took %ld ms",
PR_GetCurrentThread(), loops,
PR_IntervalToMilliseconds((PRIntervalTime) (end - start)));
PR_Lock(stderrLock);
fprintf(stderr, "%s\n", msg);
PR_Unlock(stderrLock);
}
static void usage(char *progname) {
fprintf(stderr, "Usage: %s [-t threads] [-l loops]\n", progname);
exit(-1);
}
static int realMain(int argc, char **argv, char *notused) {
int i;
int threads = 0;
progname = strrchr(argv[0], '/');
if (progname == 0) progname = argv[0];
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-t") == 0) {
if (i == argc - 1) {
usage(progname);
}
threads = atoi(argv[++i]);
if (threads < 0) threads = 0;
if (threads > 10000) threads = 10000;
continue;
}
if (strcmp(argv[i], "-l") == 0) {
if (i == argc - 1) {
usage(progname);
}
loops = atoi(argv[++i]);
continue;
}
usage(progname);
}
for (i = 0; i < threads; i++) {
PRThread* thread;
/* XXXXX */
thread = PR_CreateThreadGCAble(PR_USER_THREAD, /* thread type */
AllocStuff, /* start function */
NULL, /* arg */
PR_PRIORITY_NORMAL, /* priority */
PR_LOCAL_THREAD, /* thread scope */
PR_UNJOINABLE_THREAD, /* thread state */
0); /* stack size */
if (thread == 0) {
fprintf(stderr, "%s: no more threads (only %d were created)\n",
progname, i);
break;
}
}
AllocStuff(NULL);
return 0;
}
static int padMain(int argc, char **argv) {
char pad[512];
return realMain(argc, argv, pad);
}
int main(int argc, char **argv) {
int rv;
debug_mode = 1;
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_SetThreadGCAble();
PR_InitGC(0, 0, 0, PR_GLOBAL_THREAD);
PR_STDIO_INIT();
stderrLock = PR_NewLock();
tix1 = PR_RegisterType(&type1);
tix2 = PR_RegisterType(&type2);
tix3 = PR_RegisterType(&type3);
gcInfo = PR_GetGCInfo();
rv = padMain(argc, argv);
printf("PASS\n");
PR_Cleanup();
return rv;
}

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

@ -42,8 +42,9 @@
#include <sys/syscall.h>
#ifdef XP_MACOSX
#ifdef __APPLE__
#include <AvailabilityMacros.h>
#include <TargetConditionals.h>
#endif
#define PR_LINKER_ARCH "darwin"
@ -54,6 +55,8 @@
#define _PR_SI_ARCHITECTURE "x86-64"
#elif defined(__ppc__)
#define _PR_SI_ARCHITECTURE "ppc"
#elif defined(__arm__)
#define _PR_SI_ARCHITECTURE "arm"
#endif
#define PR_DLL_SUFFIX ".dylib"
@ -64,7 +67,7 @@
#undef HAVE_STACK_GROWING_UP
#define HAVE_DLL
#ifdef __x86_64__
#if defined(__x86_64__) || TARGET_OS_IPHONE
#define USE_DLFCN
#else
#define USE_MACH_DYLD

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

@ -63,11 +63,11 @@ PR_BEGIN_EXTERN_C
** The format of the version string is
** "<major version>.<minor version>[.<patch level>] [<Beta>]"
*/
#define PR_VERSION "4.8.9"
#define PR_VERSION "4.9 Beta"
#define PR_VMAJOR 4
#define PR_VMINOR 8
#define PR_VPATCH 9
#define PR_BETA PR_FALSE
#define PR_VMINOR 9
#define PR_VPATCH 0
#define PR_BETA PR_TRUE
/*
** PRVersionCheck

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

@ -343,6 +343,17 @@ typedef long PRInt32;
** architectures and even different compilers have varying support for
** 64 bit values. The only guaranteed portability requires the use of
** the LL_ macros (see prlong.h).
**
** MACROS: PR_INT64
** PR_UINT64
** DESCRIPTION:
** The PR_INT64 and PR_UINT64 macros provide a portable way for
** specifying 64-bit integer constants. They can only be used if
** PRInt64 and PRUint64 are defined as compiler-supported 64-bit
** integer types (i.e., if HAVE_LONG_LONG is defined, which is true
** for all the supported compilers topday). If PRInt64 and PRUint64
** are defined as structs, the LL_INIT macro defined in prlong.h has
** to be used.
************************************************************************/
#ifdef HAVE_LONG_LONG
/* Keep this in sync with prlong.h. */
@ -354,12 +365,18 @@ typedef long PRInt32;
#if PR_BYTES_PER_LONG == 8 && !defined(__APPLE__)
typedef long PRInt64;
typedef unsigned long PRUint64;
#define PR_INT64(x) x ## L
#define PR_UINT64(x) x ## UL
#elif defined(WIN32) && !defined(__GNUC__)
typedef __int64 PRInt64;
typedef unsigned __int64 PRUint64;
#define PR_INT64(x) x ## i64
#define PR_UINT64(x) x ## ui64
#else
typedef long long PRInt64;
typedef unsigned long long PRUint64;
#define PR_INT64(x) x ## LL
#define PR_UINT64(x) x ## ULL
#endif /* PR_BYTES_PER_LONG == 8 */
#else /* !HAVE_LONG_LONG */
typedef struct {

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

@ -48,7 +48,9 @@
#endif
#if defined(DARWIN)
#if defined(HAVE_CRT_EXTERNS_H)
#include <crt_externs.h>
#endif
#else
PR_IMPORT_DATA(char **) environ;
#endif
@ -185,11 +187,18 @@ ForkAndExec(
if (NULL == childEnvp) {
#ifdef DARWIN
#ifdef HAVE_CRT_EXTERNS_H
childEnvp = *(_NSGetEnviron());
#else
PR_DELETE(process);
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return NULL;
#endif
#else
childEnvp = environ;
#endif
}
for (nEnv = 0; childEnvp[nEnv]; nEnv++) {
}
newEnvp = (char **) PR_MALLOC((nEnv + 2) * sizeof(char *));

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

@ -52,10 +52,9 @@
#include <stdlib.h>
/*
* This release (4.8.9) is backward compatible with the
* This release (4.9) is backward compatible with the
* 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, 4.7.x,
* 4.8, 4.8.1, 4.8.2, 4.8.3, 4.8.4, 4.8.5, 4.8.6, 4.8.7, and
* 4.8.8 releases. It, of course, is compatible with itself.
* and 4.8.x releases. It, of course, is compatible with itself.
*/
static char *compatible_version[] = {
"4.0", "4.0.1", "4.1", "4.1.1", "4.1.2", "4.1.3",
@ -66,7 +65,8 @@ static char *compatible_version[] = {
"4.7", "4.7.1", "4.7.2", "4.7.3", "4.7.4", "4.7.5",
"4.7.6",
"4.8", "4.8.1", "4.8.2", "4.8.3", "4.8.4", "4.8.5",
"4.8.6", "4.8.7", "4.8.8", PR_VERSION
"4.8.6", "4.8.7", "4.8.8", "4.8.9",
PR_VERSION
};
/*
@ -81,8 +81,8 @@ static char *incompatible_version[] = {
"3.0", "3.0.1",
"3.1", "3.1.1", "3.1.2", "3.1.3",
"3.5", "3.5.1",
"4.8.10",
"4.9", "4.9.1",
"4.9.1",
"4.10", "4.10.1",
"10.0", "11.1", "12.14.20"
};

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

@ -56,6 +56,7 @@
#include "nsThreadUtils.h"
#include "nsNetUtil.h"
#include "nsIXPConnect.h"
#include "mozilla/unused.h"
#include "mozilla/Util.h"
#include "nsContentUtils.h"
@ -66,6 +67,7 @@
#define TOPIC_UPDATEPLACES_COMPLETE "places-updatePlaces-complete"
using namespace mozilla::dom;
using mozilla::unused;
namespace mozilla {
namespace places {
@ -1288,10 +1290,11 @@ History::NotifyVisited(nsIURI* aURI)
nsAutoScriptBlocker scriptBlocker;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
mozilla::dom::ContentParent* cpp =
mozilla::dom::ContentParent::GetSingleton(PR_FALSE);
if (cpp)
(void)cpp->SendNotifyVisited(aURI);
nsTArray<ContentParent*> cplist;
ContentParent::GetAll(cplist);
for (PRUint32 i = 0; i < cplist.Length(); ++i) {
unused << cplist[i]->SendNotifyVisited(aURI);
}
}
// If the hash table has not been initialized, then we have nothing to notify

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

@ -114,6 +114,9 @@ static void glxtest()
typedef GLXFBConfig* (* PFNGLXQUERYEXTENSION) (Display *, int *, int *);
PFNGLXQUERYEXTENSION glXQueryExtension = cast<PFNGLXQUERYEXTENSION>(dlsym(libgl, "glXQueryExtension"));
typedef GLXFBConfig* (* PFNGLXQUERYVERSION) (Display *, int *, int *);
PFNGLXQUERYVERSION glXQueryVersion = cast<PFNGLXQUERYVERSION>(dlsym(libgl, "glXQueryVersion"));
typedef GLXFBConfig* (* PFNGLXCHOOSEFBCONFIG) (Display *, int, const int *, int *);
PFNGLXCHOOSEFBCONFIG glXChooseFBConfig = cast<PFNGLXCHOOSEFBCONFIG>(dlsym(libgl, "glXChooseFBConfig"));
@ -142,6 +145,7 @@ static void glxtest()
PFNGLXGETPROCADDRESS glXGetProcAddress = cast<PFNGLXGETPROCADDRESS>(dlsym(libgl, "glXGetProcAddress"));
if (!glXQueryExtension ||
!glXQueryVersion ||
!glXChooseFBConfig ||
!glXGetVisualFromFBConfig ||
!glXCreatePixmap ||
@ -163,6 +167,14 @@ static void glxtest()
if (!glXQueryExtension(dpy, NULL, NULL))
fatal_error("GLX extension missing");
///// Check that the GLX version is >= 1.3, needed for glXCreatePixmap, bug 659932 /////
int majorVersion, minorVersion;
if (!glXQueryVersion(dpy, &majorVersion, &minorVersion))
fatal_error("Unable to query GLX version");
if (majorVersion < 1 || (majorVersion == 1 && minorVersion < 3))
fatal_error("GLX version older than the required 1.3");
XSetErrorHandler(x_error_handler);
///// Get a FBConfig and a visual /////

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

@ -121,6 +121,9 @@
#include "nsAppShellCID.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/unused.h"
using mozilla::unused;
#ifdef XP_WIN
#include "nsIWinAppHelper.h"
@ -751,9 +754,7 @@ nsXULAppInfo::EnsureContentProcess()
if (XRE_GetProcessType() != GeckoProcessType_Default)
return NS_ERROR_NOT_AVAILABLE;
ContentParent* c = ContentParent::GetSingleton();
if (!c)
return NS_ERROR_NOT_AVAILABLE;
unused << ContentParent::GetNewOrUsed();
return NS_OK;
}

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

@ -712,7 +712,7 @@ TestShellParent* gTestShellParent = nsnull;
TestShellParent* GetOrCreateTestShellParent()
{
if (!gTestShellParent) {
ContentParent* parent = ContentParent::GetSingleton();
ContentParent* parent = ContentParent::GetNewOrUsed();
NS_ENSURE_TRUE(parent, nsnull);
gTestShellParent = parent->CreateTestShell();
NS_ENSURE_TRUE(gTestShellParent, nsnull);
@ -758,7 +758,8 @@ XRE_ShutdownTestShell()
{
if (!gTestShellParent)
return true;
return ContentParent::GetSingleton()->DestroyTestShell(gTestShellParent);
return static_cast<ContentParent*>(gTestShellParent->Manager())->
DestroyTestShell(gTestShellParent);
}
#ifdef MOZ_X11

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

@ -95,8 +95,8 @@ class ContentCreationNotifier : public nsIObserver
const PRUnichar* aData)
{
if (!strcmp(aTopic, "ipc:content-created")) {
ContentParent *cp = ContentParent::GetSingleton(PR_FALSE);
NS_ABORT_IF_FALSE(cp, "Must have content process if notified of its creation");
nsCOMPtr<nsIObserver> cpo = do_QueryInterface(aSubject);
ContentParent* cp = static_cast<ContentParent*>(cpo.get());
unused << cp->SendScreenSizeChanged(gAndroidScreenBounds);
} else if (!strcmp(aTopic, "xpcom-shutdown")) {
nsCOMPtr<nsIObserverService>
@ -774,9 +774,10 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
break;
// Tell the content process the new screen size.
ContentParent *cp = ContentParent::GetSingleton(PR_FALSE);
if (cp)
unused << cp->SendScreenSizeChanged(gAndroidScreenBounds);
nsTArray<ContentParent*> cplist;
ContentParent::GetAll(cplist);
for (PRUint32 i = 0; i < cplist.Length(); ++i)
unused << cplist[i]->SendScreenSizeChanged(gAndroidScreenBounds);
if (gContentCreationNotifier)
break;

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

@ -306,6 +306,15 @@ nsresult nsChildView::Create(nsIWidget *aParent,
if (!gChildViewMethodsSwizzled) {
nsToolkit::SwizzleMethods([NSView class], @selector(mouseDownCanMoveWindow),
@selector(nsChildView_NSView_mouseDownCanMoveWindow));
#ifdef __LP64__
if (nsToolkit::OnLionOrLater()) {
nsToolkit::SwizzleMethods([NSEvent class], @selector(addLocalMonitorForEventsMatchingMask:handler:),
@selector(nsChildView_NSEvent_addLocalMonitorForEventsMatchingMask:handler:),
PR_TRUE);
nsToolkit::SwizzleMethods([NSEvent class], @selector(removeMonitor:),
@selector(nsChildView_NSEvent_removeMonitor:), PR_TRUE);
}
#endif
#ifndef NP_NO_CARBON
TextInputHandler::SwizzleMethods();
#endif
@ -5092,3 +5101,48 @@ ChildViewMouseTracker::WindowAcceptsEvent(NSWindow* aWindow, NSEvent* aEvent,
}
@end
#ifdef __LP64__
// When using blocks, at least on OS X 10.7, the OS sometimes calls
// +[NSEvent removeMonitor:] more than once on a single event monitor, which
// causes crashes. See bug 678607. We hook these methods to work around
// the problem.
@interface NSEvent (MethodSwizzling)
+ (id)nsChildView_NSEvent_addLocalMonitorForEventsMatchingMask:(unsigned long long)mask handler:(id)block;
+ (void)nsChildView_NSEvent_removeMonitor:(id)eventMonitor;
@end
// This is a local copy of the AppKit frameworks sEventObservers hashtable.
// It only stores "local monitors". We use it to ensure that +[NSEvent
// removeMonitor:] is never called more than once on the same local monitor.
static NSHashTable *sLocalEventObservers = nil;
@implementation NSEvent (MethodSwizzling)
+ (id)nsChildView_NSEvent_addLocalMonitorForEventsMatchingMask:(unsigned long long)mask handler:(id)block
{
if (!sLocalEventObservers) {
sLocalEventObservers = [[NSHashTable hashTableWithOptions:
NSHashTableStrongMemory | NSHashTableObjectPointerPersonality] retain];
}
id retval =
[self nsChildView_NSEvent_addLocalMonitorForEventsMatchingMask:mask handler:block];
if (sLocalEventObservers && retval && ![sLocalEventObservers containsObject:retval]) {
[sLocalEventObservers addObject:retval];
}
return retval;
}
+ (void)nsChildView_NSEvent_removeMonitor:(id)eventMonitor
{
if (sLocalEventObservers && [eventMonitor isKindOfClass: ::NSClassFromString(@"_NSLocalEventObserver")]) {
if (![sLocalEventObservers containsObject:eventMonitor]) {
return;
}
[sLocalEventObservers removeObject:eventMonitor];
}
[self nsChildView_NSEvent_removeMonitor:eventMonitor];
}
@end
#endif // #ifdef __LP64__

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

@ -828,22 +828,30 @@ nsBaseWidget::GetShouldAccelerate()
if (xr)
xr->GetInSafeMode(&safeMode);
bool whitelisted = false;
// bug 655578: on X11 at least, we must always call GetFeatureStatus (even if we don't need that information)
// as that's what causes GfxInfo initialization which kills the zombie 'glxtest' process.
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
if (gfxInfo) {
PRInt32 status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_OPENGL_LAYERS, &status))) {
if (status == nsIGfxInfo::FEATURE_NO_INFO) {
whitelisted = true;
}
}
}
if (disableAcceleration || safeMode)
return PR_FALSE;
if (forceAcceleration)
return PR_TRUE;
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
if (gfxInfo) {
PRInt32 status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_OPENGL_LAYERS, &status))) {
if (status != nsIGfxInfo::FEATURE_NO_INFO) {
if (!whitelisted) {
NS_WARNING("OpenGL-accelerated layers are not supported on this system.");
return PR_FALSE;
}
}
}
if (accelerateByDefault)
return PR_TRUE;