mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 14:30:43 +00:00

It's not clear to me why specializing nsCOMPtr<nsISupports> is particularly useful, and this removes a lot of code, bringing us closer to unifying nsCOMPtr and RefPtr. The changes in other places are needed because we used to allow nsCOMPtr<nsISupports> to implicitly coerce to nsISupports even for rvalue references. 0:47.88 /home/emilio/src/moz/gecko-4/netwerk/protocol/http/nsHttpActivityDistributor.cpp:121:11: error: conversion function from 'nsCOMPtr<nsISupports>' to 'nsISupports *' invokes a deleted function 0:47.88 nsCOMPtr<nsISupports>(do_QueryObject(channel)), aActivityType, 0:47.88 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0:47.88 /home/emilio/src/moz/gecko-4/obj-debug/dist/include/nsCOMPtr.h:764:3: note: 'operator nsISupports *' has been explicitly marked deleted here 0:47.88 operator T*() const&& = delete; 0:47.88 ^ 0:47.88 /home/emilio/src/moz/gecko-4/netwerk/protocol/http/nsHttpActivityDistributor.cpp:29:57: note: passing argument to parameter 'aHttpChannel' here 0:47.88 nsHttpActivityDistributor::ObserveActivity(nsISupports* aHttpChannel, 0:47.88 ^ Which is not allowed for a good reason, generally. Differential Revision: https://phabricator.services.mozilla.com/D179124
35 lines
1011 B
C++
35 lines
1011 B
C++
/* -*- 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/. */
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
nsresult nsQueryInterfaceISupports::operator()(const nsIID& aIID,
|
|
void** aAnswer) const {
|
|
nsresult status;
|
|
if (mRawPtr) {
|
|
status = mRawPtr->QueryInterface(aIID, aAnswer);
|
|
} else {
|
|
status = NS_ERROR_NULL_POINTER;
|
|
}
|
|
|
|
return status;
|
|
}
|
|
|
|
nsresult nsQueryInterfaceISupportsWithError::operator()(const nsIID& aIID,
|
|
void** aAnswer) const {
|
|
nsresult status;
|
|
if (mRawPtr) {
|
|
status = mRawPtr->QueryInterface(aIID, aAnswer);
|
|
} else {
|
|
status = NS_ERROR_NULL_POINTER;
|
|
}
|
|
|
|
if (mErrorPtr) {
|
|
*mErrorPtr = status;
|
|
}
|
|
return status;
|
|
}
|