本文整理汇总了C++中CallQueryInterface函数的典型用法代码示例。如果您正苦于以下问题:C++ CallQueryInterface函数的具体用法?C++ CallQueryInterface怎么用?C++ CallQueryInterface使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CallQueryInterface函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: NS_NewDOMNotifyPaintEvent
nsresult NS_NewDOMNotifyPaintEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsEvent *aEvent,
uint32_t aEventType,
nsInvalidateRequestList* aInvalidateRequests)
{
nsDOMNotifyPaintEvent* it =
new nsDOMNotifyPaintEvent(aOwner, aPresContext, aEvent, aEventType,
aInvalidateRequests);
if (nullptr == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return CallQueryInterface(it, aInstancePtrResult);
}
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:16,代码来源:nsDOMNotifyPaintEvent.cpp
示例2: CheckExpandoObject
static inline void CheckExpandoObject(JSObject* proxy,
const JS::Value& expando) {
#ifdef DEBUG
JSObject* obj = &expando.toObject();
MOZ_ASSERT(!js::gc::EdgeNeedsSweepUnbarriered(&obj));
MOZ_ASSERT(js::GetObjectCompartment(proxy) == js::GetObjectCompartment(obj));
// When we create an expando object in EnsureExpandoObject below, we preserve
// the wrapper. The wrapper is released when the object is unlinked, but we
// should never call these functions after that point.
nsISupports* native = UnwrapDOMObject<nsISupports>(proxy);
nsWrapperCache* cache;
CallQueryInterface(native, &cache);
MOZ_ASSERT(cache->PreservingWrapper());
#endif
}
开发者ID:Noctem,项目名称:gecko-dev,代码行数:16,代码来源:DOMJSProxyHandler.cpp
示例3: NS_NewCSSImportRule
nsresult
NS_NewCSSImportRule(nsICSSImportRule** aInstancePtrResult,
const nsString& aURLSpec,
nsMediaList* aMedia)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
CSSImportRuleImpl* it = new CSSImportRuleImpl(aMedia);
if (! it) {
return NS_ERROR_OUT_OF_MEMORY;
}
it->SetURLSpec(aURLSpec);
return CallQueryInterface(it, aInstancePtrResult);
}
开发者ID:ahadzi,项目名称:celtx,代码行数:16,代码来源:nsCSSRules.cpp
示例4: NS_ASSERTION
nsresult
nsXMLDocument::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
{
NS_ASSERTION(aNodeInfo->NodeInfoManager() == mNodeInfoManager,
"Can't import this document into another document!");
nsRefPtr<nsXMLDocument> clone = new nsXMLDocument();
NS_ENSURE_TRUE(clone, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = CloneDocHelper(clone);
NS_ENSURE_SUCCESS(rv, rv);
// State from nsXMLDocument
clone->mAsync = mAsync;
return CallQueryInterface(clone.get(), aResult);
}
开发者ID:Web5design,项目名称:mozilla-central,代码行数:16,代码来源:nsXMLDocument.cpp
示例5: GetFrame
/* void openMenu (in boolean openFlag); */
NS_IMETHODIMP nsMenuBoxObject::OpenMenu(PRBool aOpenFlag)
{
nsIFrame* frame = GetFrame();
if (!frame)
return NS_OK;
if (!nsPopupSetFrame::MayOpenPopup(frame))
return NS_OK;
nsIMenuFrame* menuFrame;
CallQueryInterface(frame, &menuFrame);
if (!menuFrame)
return NS_OK;
return menuFrame->OpenMenu(aOpenFlag);
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:17,代码来源:nsMenuBoxObject.cpp
示例6: NS_ENSURE_ARG
nsresult nsMailboxService::CopyMessages(PRUint32 aNumKeys,
nsMsgKey* aMsgKeys,
nsIMsgFolder *srcFolder,
nsIStreamListener * aMailboxCopyHandler,
bool moveMessage,
nsIUrlListener * aUrlListener,
nsIMsgWindow *aMsgWindow,
nsIURI **aURL)
{
nsresult rv = NS_OK;
NS_ENSURE_ARG(srcFolder);
NS_ENSURE_ARG(aMsgKeys);
nsCOMPtr<nsIMailboxUrl> mailboxurl;
nsMailboxAction actionToUse = nsIMailboxUrl::ActionMoveMessage;
if (!moveMessage)
actionToUse = nsIMailboxUrl::ActionCopyMessage;
nsCOMPtr <nsIMsgDBHdr> msgHdr;
nsCOMPtr <nsIMsgDatabase> db;
srcFolder->GetMsgDatabase(getter_AddRefs(db));
if (db)
{
db->GetMsgHdrForKey(aMsgKeys[0], getter_AddRefs(msgHdr));
if (msgHdr)
{
nsCString uri;
srcFolder->GetUriForMsg(msgHdr, uri);
rv = PrepareMessageUrl(uri.get(), aUrlListener, actionToUse , getter_AddRefs(mailboxurl), aMsgWindow);
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIURI> url = do_QueryInterface(mailboxurl);
nsCOMPtr<nsIMsgMailNewsUrl> msgUrl (do_QueryInterface(url));
nsCOMPtr<nsIMailboxUrl> mailboxUrl (do_QueryInterface(url));
msgUrl->SetMsgWindow(aMsgWindow);
mailboxUrl->SetMoveCopyMsgKeys(aMsgKeys, aNumKeys);
rv = RunMailboxUrl(url, aMailboxCopyHandler);
}
}
}
if (aURL && mailboxurl)
CallQueryInterface(mailboxurl, aURL);
return rv;
}
开发者ID:mikeconley,项目名称:comm-central,代码行数:47,代码来源:nsMailboxService.cpp
示例7: CreateContext
already_AddRefed<nsISupports>
CanvasRenderingContextHelper::GetContext(JSContext* aCx,
const nsAString& aContextId,
JS::Handle<JS::Value> aContextOptions,
ErrorResult& aRv)
{
CanvasContextType contextType;
if (!CanvasUtils::GetCanvasContextType(aContextId, &contextType))
return nullptr;
if (!mCurrentContext) {
// This canvas doesn't have a context yet.
RefPtr<nsICanvasRenderingContextInternal> context;
context = CreateContext(contextType);
if (!context) {
return nullptr;
}
// Ensure that the context participates in CC. Note that returning a
// CC participant from QI doesn't addref.
nsXPCOMCycleCollectionParticipant* cp = nullptr;
CallQueryInterface(context, &cp);
if (!cp) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
mCurrentContext = context.forget();
mCurrentContextType = contextType;
nsresult rv = UpdateContext(aCx, aContextOptions, aRv);
if (NS_FAILED(rv)) {
// See bug 645792 and bug 1215072.
// We want to throw only if dictionary initialization fails,
// so only in case aRv has been set to some error value.
return nullptr;
}
} else {
// We already have a context of some type.
if (contextType != mCurrentContextType)
return nullptr;
}
nsCOMPtr<nsICanvasRenderingContextInternal> context = mCurrentContext;
return context.forget();
}
开发者ID:kitcambridge,项目名称:gecko-dev,代码行数:46,代码来源:CanvasRenderingContextHelper.cpp
示例8: NS_WARNING
already_AddRefed<nsIModelElementPrivate>
nsXFormsInstanceElement::GetModel()
{
if (!mElement)
{
NS_WARNING("The XTF wrapper element has been destroyed");
return nsnull;
}
nsCOMPtr<nsIDOMNode> parentNode;
mElement->GetParentNode(getter_AddRefs(parentNode));
nsIModelElementPrivate *model = nsnull;
if (parentNode)
CallQueryInterface(parentNode, &model);
return model;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:17,代码来源:nsXFormsInstanceElement.cpp
示例9: NS_ASSERTION
already_AddRefed<nsIDocShellTreeItem>
nsCoreUtils::GetDocShellTreeItemFor(nsINode *aNode)
{
if (!aNode)
return nsnull;
nsIDocument *doc = aNode->GetOwnerDoc();
NS_ASSERTION(doc, "No document for node passed in");
NS_ENSURE_TRUE(doc, nsnull);
nsCOMPtr<nsISupports> container = doc->GetContainer();
nsIDocShellTreeItem *docShellTreeItem = nsnull;
if (container)
CallQueryInterface(container, &docShellTreeItem);
return docShellTreeItem;
}
开发者ID:gorakhargosh,项目名称:mozilla-central,代码行数:17,代码来源:nsCoreUtils.cpp
示例10: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP
nsFileProtocolHandler::NewFileURI(nsIFile *file, nsIURI **result)
{
NS_ENSURE_ARG_POINTER(file);
nsresult rv;
nsCOMPtr<nsIFileURL> url = new nsStandardURL(true);
if (!url)
return NS_ERROR_OUT_OF_MEMORY;
// NOTE: the origin charset is assigned the value of the platform
// charset by the SetFile method.
rv = url->SetFile(file);
if (NS_FAILED(rv)) return rv;
return CallQueryInterface(url, result);
}
开发者ID:hibrium,项目名称:Pale-Moon,代码行数:17,代码来源:nsFileProtocolHandler.cpp
示例11: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP
nsSHEnumerator::GetNext(nsISupports **aItem)
{
NS_ENSURE_ARG_POINTER(aItem);
PRInt32 cnt= 0;
nsresult result = NS_ERROR_FAILURE;
mSHistory->GetCount(&cnt);
if (mIndex < (cnt-1)) {
mIndex++;
nsCOMPtr<nsIHistoryEntry> hEntry;
result = mSHistory->GetEntryAtIndex(mIndex, PR_FALSE, getter_AddRefs(hEntry));
if (hEntry)
result = CallQueryInterface(hEntry, aItem);
}
return result;
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:17,代码来源:nsSHistory.cpp
示例12: CallQueryInterface
NS_IMETHODIMP
nsSVGPatternFrame::DidModifySVGObservable(nsISVGValue* observable,
nsISVGValue::modificationType aModType)
{
nsIFrame *pattern = nsnull;
CallQueryInterface(observable, &pattern);
// Is this a pattern we are observing that is going away?
if (mNextPattern && aModType == nsISVGValue::mod_die && pattern) {
// Yes, we need to handle this differently
if (mNextPattern == pattern) {
mNextPattern = nsnull;
}
}
// Something we depend on was modified -- pass it on!
DidModify(aModType);
return NS_OK;
}
开发者ID:ahadzi,项目名称:celtx,代码行数:17,代码来源:nsSVGPatternFrame.cpp
示例13: NS_ASSERTION
// static
JSObject*
DOMProxyHandler::EnsureExpandoObject(JSContext* cx, JS::Handle<JSObject*> obj)
{
NS_ASSERTION(IsDOMProxy(obj), "expected a DOM proxy object");
JS::Value v = js::GetProxyExtra(obj, JSPROXYSLOT_EXPANDO);
if (v.isObject()) {
return &v.toObject();
}
js::ExpandoAndGeneration* expandoAndGeneration;
if (!v.isUndefined()) {
expandoAndGeneration = static_cast<js::ExpandoAndGeneration*>(v.toPrivate());
if (expandoAndGeneration->expando.isObject()) {
return &expandoAndGeneration->expando.toObject();
}
} else {
expandoAndGeneration = nullptr;
}
JS::Rooted<JSObject*> expando(cx,
JS_NewObjectWithGivenProto(cx, nullptr, nullptr, js::GetObjectParent(obj)));
if (!expando) {
return nullptr;
}
nsISupports* native = UnwrapDOMObject<nsISupports>(obj);
nsWrapperCache* cache;
CallQueryInterface(native, &cache);
if (expandoAndGeneration) {
cache->PreserveWrapper(native);
expandoAndGeneration->expando.setObject(*expando);
return expando;
}
XPCWrappedNativeScope* scope = xpc::GetObjectScope(obj);
if (!scope->RegisterDOMExpandoObject(obj)) {
return nullptr;
}
cache->SetPreservingWrapper(true);
js::SetProxyExtra(obj, JSPROXYSLOT_EXPANDO, ObjectValue(*expando));
return expando;
}
开发者ID:smacgregor,项目名称:mozilla-central,代码行数:46,代码来源:DOMJSProxyHandler.cpp
示例14: weakFrame
NS_IMETHODIMP
nsPopupSetFrame::DestroyPopup(nsIFrame* aPopup, PRBool aDestroyEntireChain)
{
if (!mPopupList)
return NS_OK; // No active popups
nsPopupFrameList* entry = mPopupList->GetEntryByFrame(aPopup);
if (entry && entry->mCreateHandlerSucceeded) { // ensure the popup was created before we try to destroy it
nsWeakFrame weakFrame(this);
OpenPopup(entry, PR_FALSE);
nsCOMPtr<nsIContent> popupContent = entry->mPopupContent;
if (weakFrame.IsAlive()) {
if (aDestroyEntireChain && entry->mElementContent && entry->mPopupType.EqualsLiteral("context")) {
// If we are a context menu, and if we are attached to a
// menupopup, then destroying us should also dismiss the parent
// menu popup.
if (entry->mElementContent->Tag() == nsXULAtoms::menupopup) {
nsIFrame* popupFrame = nsnull;
mPresContext->PresShell()->GetPrimaryFrameFor(entry->mElementContent,
&popupFrame);
if (popupFrame) {
nsIMenuParent *menuParent;
if (NS_SUCCEEDED(CallQueryInterface(popupFrame, &menuParent))) {
menuParent->DismissChain();
}
}
}
}
// clear things out for next time
entry->mPopupType.Truncate();
entry->mCreateHandlerSucceeded = PR_FALSE;
entry->mElementContent = nsnull;
entry->mXPos = entry->mYPos = 0;
entry->mLastPref.width = -1;
entry->mLastPref.height = -1;
}
// ungenerate the popup.
popupContent->UnsetAttr(kNameSpaceID_None, nsXULAtoms::menugenerated, PR_TRUE);
}
return NS_OK;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:45,代码来源:nsPopupSetFrame.cpp
示例15: NS_ENSURE_ARG
NS_IMETHODIMP
sbDirectoryProvider::GetFile(const char *aProp,
PRBool *aPersistent,
nsIFile **_retval)
{
NS_ENSURE_ARG(aProp);
NS_ENSURE_ARG_POINTER(aPersistent);
NS_ENSURE_ARG_POINTER(_retval);
nsCOMPtr<nsILocalFile> localFile;
nsresult rv = NS_ERROR_FAILURE;
*_retval = nsnull;
*aPersistent = PR_TRUE;
#if defined (XP_WIN)
if (strcmp(aProp, NS_WIN_COMMON_DOCUMENTS) == 0)
rv = GetWindowsFolder(CSIDL_COMMON_DOCUMENTS, getter_AddRefs(localFile));
else if (strcmp(aProp, NS_WIN_COMMON_PICTURES) == 0)
rv = GetWindowsFolder(CSIDL_COMMON_PICTURES, getter_AddRefs(localFile));
else if (strcmp(aProp, NS_WIN_COMMON_MUSIC) == 0)
rv = GetWindowsFolder(CSIDL_COMMON_MUSIC, getter_AddRefs(localFile));
else if (strcmp(aProp, NS_WIN_COMMON_VIDEO) == 0)
rv = GetWindowsFolder(CSIDL_COMMON_VIDEO, getter_AddRefs(localFile));
else if (strcmp(aProp, NS_WIN_DOCUMENTS) == 0)
rv = GetWindowsFolder(CSIDL_MYDOCUMENTS, getter_AddRefs(localFile));
else if (strcmp(aProp, NS_WIN_PICTURES) == 0)
rv = GetWindowsFolder(CSIDL_MYPICTURES, getter_AddRefs(localFile));
else if (strcmp(aProp, NS_WIN_MUSIC) == 0)
rv = GetWindowsFolder(CSIDL_MYMUSIC, getter_AddRefs(localFile));
else if (strcmp(aProp, NS_WIN_VIDEO) == 0)
rv = GetWindowsFolder(CSIDL_MYVIDEO, getter_AddRefs(localFile));
else if (strcmp(aProp, NS_WIN_DISCBURNING) == 0)
rv = GetWindowsFolder(CSIDL_CDBURN_AREA, getter_AddRefs(localFile));
#endif // XP_WIN
if (NS_SUCCEEDED(rv)) {
if (localFile)
rv = CallQueryInterface(localFile, _retval);
else
rv = NS_ERROR_FAILURE;
}
return rv;
}
开发者ID:AntoineTurmel,项目名称:nightingale-hacking,代码行数:45,代码来源:sbDirectoryProvider.cpp
示例16: do_CreateInstance
nsresult
WSPProxy::WrapInPropertyBag(nsISupports* aInstance,
nsIInterfaceInfo* aInterfaceInfo,
nsIPropertyBag** aPropertyBag)
{
*aPropertyBag = nsnull;
nsresult rv;
nsCOMPtr<nsIWebServiceComplexTypeWrapper> wrapper =
do_CreateInstance(NS_WEBSERVICECOMPLEXTYPEWRAPPER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
return rv;
}
rv = wrapper->Init(aInstance, aInterfaceInfo);
if (NS_FAILED(rv)) {
return rv;
}
return CallQueryInterface(wrapper, aPropertyBag);
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:18,代码来源:wspproxy.cpp
示例17: NS_NewCSSNameSpaceRule
nsresult
NS_NewCSSNameSpaceRule(nsICSSNameSpaceRule** aInstancePtrResult,
nsIAtom* aPrefix, const nsString& aURLSpec)
{
if (! aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
CSSNameSpaceRuleImpl* it = new CSSNameSpaceRuleImpl();
if (! it) {
return NS_ERROR_OUT_OF_MEMORY;
}
it->SetPrefix(aPrefix);
it->SetURLSpec(aURLSpec);
return CallQueryInterface(it, aInstancePtrResult);
}
开发者ID:ahadzi,项目名称:celtx,代码行数:18,代码来源:nsCSSRules.cpp
示例18: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP
sbLocalDatabaseMediaListViewSelection::GetSelectedMediaItems(nsISimpleEnumerator * *aSelectedMediaItems)
{
NS_ENSURE_ARG_POINTER(aSelectedMediaItems);
nsresult rv;
// just create an indexed enumerator and wrap it; this makes sure we reuse
// the code and the two enumerator implementations are kept in sync.
nsCOMPtr<nsISimpleEnumerator> indexedEnumerator;
rv = GetSelectedIndexedMediaItems(getter_AddRefs(indexedEnumerator));
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<sbIndexedToUnindexedMediaItemEnumerator> unwrapper =
new sbIndexedToUnindexedMediaItemEnumerator(indexedEnumerator);
NS_ENSURE_TRUE(unwrapper, NS_ERROR_OUT_OF_MEMORY);
return CallQueryInterface(unwrapper.get(), aSelectedMediaItems);
}
开发者ID:freaktechnik,项目名称:nightingale-hacking,代码行数:18,代码来源:sbLocalDatabaseMediaListViewSelection.cpp
示例19: NS_NewXBLContentSink
nsresult
NS_NewXBLContentSink(nsIXMLContentSink** aResult,
nsIDocument* aDoc,
nsIURI* aURI,
nsISupports* aContainer)
{
NS_ENSURE_ARG_POINTER(aResult);
nsXBLContentSink* it;
NS_NEWXPCOM(it, nsXBLContentSink);
NS_ENSURE_TRUE(it, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsIXMLContentSink> kungFuDeathGrip = it;
nsresult rv = it->Init(aDoc, aURI, aContainer);
NS_ENSURE_SUCCESS(rv, rv);
return CallQueryInterface(it, aResult);
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:18,代码来源:nsXBLContentSink.cpp
示例20: nsDependentString
/*static*/ nsresult
ImageEncoder::GetInputStream(int32_t aWidth,
int32_t aHeight,
uint8_t* aImageBuffer,
int32_t aFormat,
imgIEncoder* aEncoder,
const char16_t* aEncoderOptions,
nsIInputStream** aStream)
{
nsresult rv =
aEncoder->InitFromData(aImageBuffer,
aWidth * aHeight * 4, aWidth, aHeight, aWidth * 4,
aFormat,
nsDependentString(aEncoderOptions));
NS_ENSURE_SUCCESS(rv, rv);
return CallQueryInterface(aEncoder, aStream);
}
开发者ID:Lootyhoof,项目名称:Tycho,代码行数:18,代码来源:ImageEncoder.cpp
注:本文中的CallQueryInterface函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论