зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1095098 - move do_QueryObject templates into their own header; r=froydnj
This commit is contained in:
Родитель
b5286dc77d
Коммит
32e981896d
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "Role.h"
|
||||
#include "States.h"
|
||||
#include "XULTreeGridAccessible.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "Relation.h"
|
||||
#include "Role.h"
|
||||
#include "States.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "nsIBoxObject.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "nsEscape.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsString.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "mozilla/CSSStyleSheet.h"
|
||||
#include "mozilla/dom/URL.h"
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "nsIDOMWindow.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsError.h"
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "nsContentPolicyUtils.h" // NS_CheckContentLoadPolicy(...)
|
||||
#include "nsISeekableStream.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsIWritablePropertyBag2.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "nsFrame.h"
|
||||
#include "mozilla/layers/ShadowLayers.h"
|
||||
#include "ClientLayerManager.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "nsIScrollableFrame.h"
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "nsDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef ANDROID
|
||||
|
|
|
@ -120,6 +120,7 @@
|
|||
#include "nsIControllerContext.h"
|
||||
#include "nsGlobalWindowCommands.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsIDOMFileList.h"
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "nsUnicharInputStream.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "nsContentUtils.h"
|
||||
#include "nsIParserUtils.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "nsITelephonyService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "nsITelephonyService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "nsIAsyncInputStream.h"
|
||||
#include "nsIAsyncOutputStream.h"
|
||||
#include "nsIIPCSerializableInputStream.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsStreamUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsURLParsers.h"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "CameraPreviewMediaStream.h"
|
||||
#include "mozilla/dom/CameraManagerBinding.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "CameraPreferences.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "nsIRunnable.h"
|
||||
#include "nsISeekableStream.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "nsXULAppAPI.h"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "mozilla/dom/HTMLFieldSetElement.h"
|
||||
#include "mozilla/dom/HTMLFieldSetElementBinding.h"
|
||||
#include "nsContentList.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(FieldSet)
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "nsIMutableArray.h"
|
||||
#include "nsIFormAutofillContentService.h"
|
||||
#include "mozilla/BinarySearch.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
// form submission
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/dom/HTMLLabelElementBinding.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
// construction, destruction
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "nsIThreadInternal.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIRequest.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIXPConnect.h"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "nsAttrValueInlines.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsIContentInlines.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "nsThreadUtils.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
// Include this last to avoid path problems on Windows.
|
||||
#include "ActorsChild.h"
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "nsIStringEnumerator.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsTArray.h"
|
||||
#include "GetUserMediaRequest.h"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "nsGlobalWindow.h"
|
||||
#include "mozilla/MediaManager.h"
|
||||
#include "prlog.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#undef LOG
|
||||
#if defined(PR_LOGGING)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "mozilla/dom/SpeechRecognitionEvent.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
#include "prprf.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIInputStreamTee.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "nsError.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsSVGAttrTearoffTable.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include <algorithm>
|
||||
|
||||
// See the architecture comment in this file's header.
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "SVGAnimatedPathSegList.h"
|
||||
#include "SVGContentUtils.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include <stdarg.h>
|
||||
#include "nsSMILMappedAttribute.h"
|
||||
#include "SVGMotionSMILAttr.h"
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "nsStreamUtils.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsSerializationHelper.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "mozilla/dom/FetchEventBinding.h"
|
||||
#include "mozilla/dom/PromiseNativeHandler.h"
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "nsGlobalWindow.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#include "RuntimeService.h"
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "prthread.h"
|
||||
#include "xpcpublic.h"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "mozilla/ArrayUtils.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsXBLPrototypeHandler.h"
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
|
|
@ -93,6 +93,7 @@
|
|||
#include "nsAttrValueInlines.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsIController.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include <algorithm>
|
||||
|
||||
// The XUL doc interface
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "nsError.h" // for NS_SUCCEEDED, NS_FAILED, etc
|
||||
#include "nsIPresShell.h" // nsISelectionController constants
|
||||
#include "nsRange.h" // local var
|
||||
#include "nsQueryObject.h" // for do_QueryObject
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "nsDebug.h" // for NS_ASSERTION, etc
|
||||
#include "nsEditor.h" // mEditor
|
||||
#include "nsError.h" // for NS_OK, etc
|
||||
#include "nsQueryObject.h" // for do_QueryObject
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "IMETextTxn.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "mozilla/dom/Selection.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "nsRange.h"
|
||||
#include "nsServiceManagerUtils.h" // for do_GetService
|
||||
#include "nsString.h" // for nsAutoString
|
||||
#include "nsQueryObject.h" // for do_QueryObject
|
||||
#ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
|
||||
#include "nsContentUtils.h" // for nsContentUtils, etc
|
||||
#include "nsIBidiKeyboard.h" // for nsIBidiKeyboard
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "nsIHTMLObjectResizer.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsLiteralString.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsRange.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
|
|
@ -176,6 +176,7 @@
|
|||
#include "nsIFrameInlines.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "nsSubDocumentFrame.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "nsColor.h"
|
||||
#include "nsStyleSet.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::css;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIDOMCSSStyleSheet.h"
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "nsIURI.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "nsRuleNode.h"
|
||||
#include "nsIStyleRule.h"
|
||||
#include "StyleRule.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
class nsRuleWalker {
|
||||
public:
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "nsPrintfCString.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "RestyleManager.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "prtime.h"
|
||||
|
||||
#include "AudioConduit.h"
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIDNSService.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nricectx.h"
|
||||
#include "rlogringbuffer.h"
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "nsICachingChannel.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
#include "nsIHttpHeaderVisitor.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::ipc;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "nsHttpRequestHead.h"
|
||||
#include "nsIHttpActivityObserver.h"
|
||||
#include "NullHttpChannel.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "nsError.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "nsProfileStringTypes.h"
|
||||
#include "nsProfileLock.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
#include "mozilla/ProfileUnlockerWin.h"
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "nsError.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/CondVar.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsJSUtils.h"
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "nsUnicharUtils.h"
|
||||
#include "prtime.h"
|
||||
#include "prprf.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "nscore.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#include "nsIDOMWindow.h"
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIPrintOptions.h"
|
||||
#include "nsPrintSettingsX.h"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMXULCommandEvent.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "nsIPrintSettings.h"
|
||||
#include "nsPrintSettingsX.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsPrintOptionsX.h"
|
||||
#include "nsPrintSettingsX.h"
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "nsISupportsImpl.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include <windows.h>
|
||||
#include <ws2spi.h>
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ EXPORTS += [
|
|||
'nsISizeOf.h',
|
||||
'nsISupportsBase.h',
|
||||
'nsObjCExceptions.h',
|
||||
'nsQueryObject.h',
|
||||
'nsRefPtr.h',
|
||||
'nsStackWalk.h',
|
||||
'nsTraceRefcnt.h',
|
||||
|
|
|
@ -759,94 +759,6 @@ operator!=(NSCAP_Zero* aLhs, const nsAutoArrayPtr<T>& aRhs)
|
|||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
template<class T>
|
||||
class MOZ_STACK_CLASS nsQueryObject : public nsCOMPtr_helper
|
||||
{
|
||||
public:
|
||||
explicit nsQueryObject(T* aRawPtr)
|
||||
: mRawPtr(aRawPtr)
|
||||
{
|
||||
}
|
||||
|
||||
virtual nsresult NS_FASTCALL operator()(const nsIID& aIID,
|
||||
void** aResult) const override
|
||||
{
|
||||
nsresult status = mRawPtr ? mRawPtr->QueryInterface(aIID, aResult)
|
||||
: NS_ERROR_NULL_POINTER;
|
||||
return status;
|
||||
}
|
||||
private:
|
||||
T* MOZ_NON_OWNING_REF mRawPtr;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class MOZ_STACK_CLASS nsQueryObjectWithError : public nsCOMPtr_helper
|
||||
{
|
||||
public:
|
||||
nsQueryObjectWithError(T* aRawPtr, nsresult* aErrorPtr)
|
||||
: mRawPtr(aRawPtr), mErrorPtr(aErrorPtr)
|
||||
{
|
||||
}
|
||||
|
||||
virtual nsresult NS_FASTCALL operator()(const nsIID& aIID,
|
||||
void** aResult) const
|
||||
{
|
||||
nsresult status = mRawPtr ? mRawPtr->QueryInterface(aIID, aResult)
|
||||
: NS_ERROR_NULL_POINTER;
|
||||
if (mErrorPtr) {
|
||||
*mErrorPtr = status;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
private:
|
||||
T* MOZ_NON_OWNING_REF mRawPtr;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
inline nsQueryObject<T>
|
||||
do_QueryObject(T* aRawPtr)
|
||||
{
|
||||
return nsQueryObject<T>(aRawPtr);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline nsQueryObject<T>
|
||||
do_QueryObject(nsCOMPtr<T>& aRawPtr)
|
||||
{
|
||||
return nsQueryObject<T>(aRawPtr);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline nsQueryObject<T>
|
||||
do_QueryObject(nsRefPtr<T>& aRawPtr)
|
||||
{
|
||||
return nsQueryObject<T>(aRawPtr);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline nsQueryObjectWithError<T>
|
||||
do_QueryObject(T* aRawPtr, nsresult* aErrorPtr)
|
||||
{
|
||||
return nsQueryObjectWithError<T>(aRawPtr, aErrorPtr);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline nsQueryObjectWithError<T>
|
||||
do_QueryObject(nsCOMPtr<T>& aRawPtr, nsresult* aErrorPtr)
|
||||
{
|
||||
return nsQueryObjectWithError<T>(aRawPtr, aErrorPtr);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline nsQueryObjectWithError<T>
|
||||
do_QueryObject(nsRefPtr<T>& aRawPtr, nsresult* aErrorPtr)
|
||||
{
|
||||
return nsQueryObjectWithError<T>(aRawPtr, aErrorPtr);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif // !defined(nsAutoPtr_h)
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsQueryObject_h
|
||||
#define nsQueryObject_h
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsRefPtr.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
template<class T>
|
||||
class nsQueryObject : public nsCOMPtr_helper
|
||||
{
|
||||
public:
|
||||
explicit nsQueryObject(T* aRawPtr)
|
||||
: mRawPtr(aRawPtr)
|
||||
{
|
||||
}
|
||||
|
||||
virtual nsresult NS_FASTCALL operator()(const nsIID& aIID,
|
||||
void** aResult) const
|
||||
{
|
||||
nsresult status = mRawPtr ? mRawPtr->QueryInterface(aIID, aResult)
|
||||
: NS_ERROR_NULL_POINTER;
|
||||
return status;
|
||||
}
|
||||
private:
|
||||
T* mRawPtr;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class nsQueryObjectWithError : public nsCOMPtr_helper
|
||||
{
|
||||
public:
|
||||
nsQueryObjectWithError(T* aRawPtr, nsresult* aErrorPtr)
|
||||
: mRawPtr(aRawPtr), mErrorPtr(aErrorPtr)
|
||||
{
|
||||
}
|
||||
|
||||
virtual nsresult NS_FASTCALL operator()(const nsIID& aIID,
|
||||
void** aResult) const
|
||||
{
|
||||
nsresult status = mRawPtr ? mRawPtr->QueryInterface(aIID, aResult)
|
||||
: NS_ERROR_NULL_POINTER;
|
||||
if (mErrorPtr) {
|
||||
*mErrorPtr = status;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
private:
|
||||
T* mRawPtr;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
template<class T>
|
||||
inline nsQueryObject<T>
|
||||
do_QueryObject(T* aRawPtr)
|
||||
{
|
||||
return nsQueryObject<T>(aRawPtr);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline nsQueryObject<T>
|
||||
do_QueryObject(nsCOMPtr<T>& aRawPtr)
|
||||
{
|
||||
return nsQueryObject<T>(aRawPtr);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline nsQueryObject<T>
|
||||
do_QueryObject(nsRefPtr<T>& aRawPtr)
|
||||
{
|
||||
return nsQueryObject<T>(aRawPtr);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline nsQueryObjectWithError<T>
|
||||
do_QueryObject(T* aRawPtr, nsresult* aErrorPtr)
|
||||
{
|
||||
return nsQueryObjectWithError<T>(aRawPtr, aErrorPtr);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline nsQueryObjectWithError<T>
|
||||
do_QueryObject(nsCOMPtr<T>& aRawPtr, nsresult* aErrorPtr)
|
||||
{
|
||||
return nsQueryObjectWithError<T>(aRawPtr, aErrorPtr);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline nsQueryObjectWithError<T>
|
||||
do_QueryObject(nsRefPtr<T>& aRawPtr, nsresult* aErrorPtr)
|
||||
{
|
||||
return nsQueryObjectWithError<T>(aRawPtr, aErrorPtr);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif // !defined(nsQueryObject_h)
|
|
@ -8,6 +8,7 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
#define NS_FOO_IID \
|
||||
{ 0x6f7652e0, 0xee43, 0x11d1, \
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "prprf.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
||||
//Interfaces needed to be included
|
||||
#include "nsIAppShell.h"
|
||||
|
|
Загрузка…
Ссылка в новой задаче