зеркало из https://github.com/mozilla/gecko-dev.git
Expose the number of assertions since process start from XPCOM. (Bug 472557) r=bsmedberg
This commit is contained in:
Родитель
b96454a8a4
Коммит
b1dbc0710a
|
@ -122,6 +122,7 @@ XPIDLSRCS = \
|
|||
nsIConsoleListener.idl \
|
||||
nsIConsoleMessage.idl \
|
||||
nsIConsoleService.idl \
|
||||
nsIDebug2.idl \
|
||||
nsIErrorService.idl \
|
||||
nsIException.idl \
|
||||
nsIExceptionService.idl \
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "prerror.h"
|
||||
#include "prerr.h"
|
||||
#include "prenv.h"
|
||||
#include "pratom.h"
|
||||
|
||||
#if defined(XP_BEOS)
|
||||
/* For DEBUGGER macros */
|
||||
|
@ -91,7 +92,9 @@ Break(const char *aMsg);
|
|||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
NS_IMPL_QUERY_INTERFACE1(nsDebugImpl, nsIDebug)
|
||||
static PRInt32 gAssertionCount = 0;
|
||||
|
||||
NS_IMPL_QUERY_INTERFACE2(nsDebugImpl, nsIDebug, nsIDebug2)
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
nsDebugImpl::AddRef()
|
||||
|
@ -134,6 +137,13 @@ nsDebugImpl::Abort(const char *aFile, PRInt32 aLine)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDebugImpl::GetAssertionCount(PRInt32* aResult)
|
||||
{
|
||||
*aResult = gAssertionCount;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of the nsDebug methods. Note that this code is
|
||||
* always compiled in, in case some other module that uses it is
|
||||
|
@ -302,6 +312,7 @@ NS_DebugBreak(PRUint32 aSeverity, const char *aStr, const char *aExpr,
|
|||
}
|
||||
|
||||
// Now we deal with assertions
|
||||
PR_AtomicIncrement(&gAssertionCount);
|
||||
|
||||
switch (GetAssertBehavior()) {
|
||||
case NS_ASSERT_WARN:
|
||||
|
|
|
@ -35,12 +35,14 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDebug.h"
|
||||
#include "nsIDebug2.h"
|
||||
|
||||
class nsDebugImpl : public nsIDebug
|
||||
class nsDebugImpl : public nsIDebug2
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDEBUG
|
||||
NS_DECL_NSIDEBUG2
|
||||
|
||||
static NS_METHOD Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
|
||||
};
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/* vim: set shiftwidth=4 tabstop=8 autoindent cindent expandtab: */
|
||||
/* ***** 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 nsIDebugInfoService.
|
||||
*
|
||||
* The Initial Developer of the Original Code is the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* L. David Baron <dbaron@dbaron.org>, Mozilla Corporation (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
/* interface to expose information about calls to NS_DebugBreak */
|
||||
|
||||
#include "nsIDebug.idl"
|
||||
|
||||
[scriptable, uuid(15c0b474-fedb-4789-878b-def834b84735)]
|
||||
interface nsIDebug2 : nsIDebug
|
||||
{
|
||||
/**
|
||||
* The number of assertions since process start.
|
||||
*/
|
||||
readonly attribute long assertionCount;
|
||||
};
|
Загрузка…
Ссылка в новой задаче