Removal of calls to PR_MumbleMonitor, which were way too heavy-handed for the job. Replaced with PR_AtomicInc/Decrement. part of module sweep, r=morse, pavlov
git-svn-id: svn://10.0.0.236/trunk@51362 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
* Reserved.
|
* Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "pratom.h"
|
||||||
|
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
|
|
||||||
#include "nsIDOMDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
@@ -155,9 +157,8 @@ nsEditor::nsEditor()
|
|||||||
{
|
{
|
||||||
//initialize member variables here
|
//initialize member variables here
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
PR_EnterMonitor(GetEditorMonitor());
|
|
||||||
gInstanceCount++;
|
PR_AtomicIncrement(&gInstanceCount);
|
||||||
PR_ExitMonitor(GetEditorMonitor());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsEditor::~nsEditor()
|
nsEditor::~nsEditor()
|
||||||
@@ -184,6 +185,8 @@ nsEditor::~nsEditor()
|
|||||||
InsertTextTxn::ClassShutdown();
|
InsertTextTxn::ClassShutdown();
|
||||||
IMETextTxn::ClassShutdown();
|
IMETextTxn::ClassShutdown();
|
||||||
IMECommitTxn::ClassShutdown();
|
IMECommitTxn::ClassShutdown();
|
||||||
|
|
||||||
|
PR_AtomicDecrement(&gInstanceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsWeakPtr.h"
|
#include "nsWeakPtr.h"
|
||||||
#include "prmon.h"
|
|
||||||
|
|
||||||
#include "nsIEditor.h"
|
#include "nsIEditor.h"
|
||||||
#include "nsIEditorIMESupport.h"
|
#include "nsIEditorIMESupport.h"
|
||||||
@@ -66,9 +65,6 @@ class AddStyleSheetTxn;
|
|||||||
class RemoveStyleSheetTxn;
|
class RemoveStyleSheetTxn;
|
||||||
class nsFileSpec;
|
class nsFileSpec;
|
||||||
|
|
||||||
//This is the monitor for the editor.
|
|
||||||
PRMonitor *GetEditorMonitor();
|
|
||||||
|
|
||||||
|
|
||||||
/** implementation of an editor object. it will be the controler/focal point
|
/** implementation of an editor object. it will be the controler/focal point
|
||||||
* for the main editor services. i.e. the GUIManager, publishing, transaction
|
* for the main editor services. i.e. the GUIManager, publishing, transaction
|
||||||
|
|||||||
@@ -304,6 +304,8 @@ nsEditorModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload)
|
|||||||
if (!okToUnload) {
|
if (!okToUnload) {
|
||||||
return NS_ERROR_INVALID_POINTER;
|
return NS_ERROR_INVALID_POINTER;
|
||||||
}
|
}
|
||||||
|
// we might want to check nsEditor::gInstanceCount == 0 and count
|
||||||
|
// factory locks here one day.
|
||||||
*okToUnload = PR_FALSE;
|
*okToUnload = PR_FALSE;
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
@@ -336,20 +338,3 @@ extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *servMgr,
|
|||||||
gModule = m; // WARNING: Weak Reference
|
gModule = m; // WARNING: Weak Reference
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!!!!!! This is obsolete is needs to be removed. It should be removed after the calls to
|
|
||||||
//!!!!!! it are removed.
|
|
||||||
|
|
||||||
//if more than one person asks for the monitor at the same time for the FIRST time, we are screwed
|
|
||||||
PRMonitor *GetEditorMonitor()
|
|
||||||
{
|
|
||||||
static PRMonitor *ns_editlock = nsnull;
|
|
||||||
if (nsnull == ns_editlock)
|
|
||||||
{
|
|
||||||
ns_editlock = (PRMonitor *)1; //how long will the next line take? lets cut down on the chance of reentrancy
|
|
||||||
ns_editlock = PR_NewMonitor();
|
|
||||||
}
|
|
||||||
else if ((PRMonitor *)1 == ns_editlock)
|
|
||||||
return GetEditorMonitor();
|
|
||||||
return ns_editlock;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
* Reserved.
|
* Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "pratom.h"
|
||||||
|
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
|
|
||||||
#include "nsIDOMDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
@@ -155,9 +157,8 @@ nsEditor::nsEditor()
|
|||||||
{
|
{
|
||||||
//initialize member variables here
|
//initialize member variables here
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
PR_EnterMonitor(GetEditorMonitor());
|
|
||||||
gInstanceCount++;
|
PR_AtomicIncrement(&gInstanceCount);
|
||||||
PR_ExitMonitor(GetEditorMonitor());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsEditor::~nsEditor()
|
nsEditor::~nsEditor()
|
||||||
@@ -184,6 +185,8 @@ nsEditor::~nsEditor()
|
|||||||
InsertTextTxn::ClassShutdown();
|
InsertTextTxn::ClassShutdown();
|
||||||
IMETextTxn::ClassShutdown();
|
IMETextTxn::ClassShutdown();
|
||||||
IMECommitTxn::ClassShutdown();
|
IMECommitTxn::ClassShutdown();
|
||||||
|
|
||||||
|
PR_AtomicDecrement(&gInstanceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsWeakPtr.h"
|
#include "nsWeakPtr.h"
|
||||||
#include "prmon.h"
|
|
||||||
|
|
||||||
#include "nsIEditor.h"
|
#include "nsIEditor.h"
|
||||||
#include "nsIEditorIMESupport.h"
|
#include "nsIEditorIMESupport.h"
|
||||||
@@ -66,9 +65,6 @@ class AddStyleSheetTxn;
|
|||||||
class RemoveStyleSheetTxn;
|
class RemoveStyleSheetTxn;
|
||||||
class nsFileSpec;
|
class nsFileSpec;
|
||||||
|
|
||||||
//This is the monitor for the editor.
|
|
||||||
PRMonitor *GetEditorMonitor();
|
|
||||||
|
|
||||||
|
|
||||||
/** implementation of an editor object. it will be the controler/focal point
|
/** implementation of an editor object. it will be the controler/focal point
|
||||||
* for the main editor services. i.e. the GUIManager, publishing, transaction
|
* for the main editor services. i.e. the GUIManager, publishing, transaction
|
||||||
|
|||||||
@@ -304,6 +304,8 @@ nsEditorModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload)
|
|||||||
if (!okToUnload) {
|
if (!okToUnload) {
|
||||||
return NS_ERROR_INVALID_POINTER;
|
return NS_ERROR_INVALID_POINTER;
|
||||||
}
|
}
|
||||||
|
// we might want to check nsEditor::gInstanceCount == 0 and count
|
||||||
|
// factory locks here one day.
|
||||||
*okToUnload = PR_FALSE;
|
*okToUnload = PR_FALSE;
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
@@ -336,20 +338,3 @@ extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *servMgr,
|
|||||||
gModule = m; // WARNING: Weak Reference
|
gModule = m; // WARNING: Weak Reference
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!!!!!! This is obsolete is needs to be removed. It should be removed after the calls to
|
|
||||||
//!!!!!! it are removed.
|
|
||||||
|
|
||||||
//if more than one person asks for the monitor at the same time for the FIRST time, we are screwed
|
|
||||||
PRMonitor *GetEditorMonitor()
|
|
||||||
{
|
|
||||||
static PRMonitor *ns_editlock = nsnull;
|
|
||||||
if (nsnull == ns_editlock)
|
|
||||||
{
|
|
||||||
ns_editlock = (PRMonitor *)1; //how long will the next line take? lets cut down on the chance of reentrancy
|
|
||||||
ns_editlock = PR_NewMonitor();
|
|
||||||
}
|
|
||||||
else if ((PRMonitor *)1 == ns_editlock)
|
|
||||||
return GetEditorMonitor();
|
|
||||||
return ns_editlock;
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user