本文整理汇总了C++中nsTArray::RemoveElement方法的典型用法代码示例。如果您正苦于以下问题:C++ nsTArray::RemoveElement方法的具体用法?C++ nsTArray::RemoveElement怎么用?C++ nsTArray::RemoveElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsTArray
的用法示例。
在下文中一共展示了nsTArray::RemoveElement方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartGonkBluetooth
nsresult
BluetoothServiceBluedroid::StartInternal(BluetoothReplyRunnable* aRunnable)
{
MOZ_ASSERT(NS_IsMainThread());
// aRunnable will be a nullptr while startup
if(aRunnable) {
sChangeAdapterStateRunnableArray.AppendElement(aRunnable);
}
nsresult ret = StartGonkBluetooth();
if (NS_FAILED(ret)) {
BluetoothService::AcknowledgeToggleBt(false);
// Reject Promise
if(aRunnable) {
DispatchReplyError(aRunnable, NS_LITERAL_STRING("StartBluetoothError"));
sChangeAdapterStateRunnableArray.RemoveElement(aRunnable);
}
BT_LOGR("Error");
}
return ret;
}
示例2: StopGonkBluetooth
nsresult
BluetoothServiceBluedroid::StopInternal(BluetoothReplyRunnable* aRunnable)
{
MOZ_ASSERT(NS_IsMainThread());
BluetoothProfileManagerBase* profile;
profile = BluetoothHfpManager::Get();
NS_ENSURE_TRUE(profile, NS_ERROR_FAILURE);
if (profile->IsConnected()) {
profile->Disconnect(nullptr);
} else {
profile->Reset();
}
profile = BluetoothOppManager::Get();
NS_ENSURE_TRUE(profile, NS_ERROR_FAILURE);
if (profile->IsConnected()) {
profile->Disconnect(nullptr);
}
profile = BluetoothA2dpManager::Get();
NS_ENSURE_TRUE(profile, NS_ERROR_FAILURE);
if (profile->IsConnected()) {
profile->Disconnect(nullptr);
} else {
profile->Reset();
}
profile = BluetoothHidManager::Get();
NS_ENSURE_TRUE(profile, NS_ERROR_FAILURE);
if (profile->IsConnected()) {
profile->Disconnect(nullptr);
} else {
profile->Reset();
}
// aRunnable will be a nullptr during starup and shutdown
if(aRunnable) {
sChangeAdapterStateRunnableArray.AppendElement(aRunnable);
}
nsresult ret = StopGonkBluetooth();
if (NS_FAILED(ret)) {
BluetoothService::AcknowledgeToggleBt(true);
// Reject Promise
if(aRunnable) {
DispatchReplyError(aRunnable, NS_LITERAL_STRING("StopBluetoothError"));
sChangeAdapterStateRunnableArray.RemoveElement(aRunnable);
}
BT_LOGR("Error");
}
return ret;
}
示例3:
NS_IMETHODIMP
nsWindow::Destroy(void)
{
sTopWindows.RemoveElement(this);
if (this == gWindowToRedraw)
gWindowToRedraw = nullptr;
if (this == gFocusedWindow)
gFocusedWindow = nullptr;
return NS_OK;
}
示例4:
NS_IMETHODIMP
nsWindow::Destroy(void)
{
mOnDestroyCalled = true;
sTopWindows.RemoveElement(this);
if (this == gFocusedWindow)
gFocusedWindow = nullptr;
nsBaseWidget::OnDestroy();
return NS_OK;
}
示例5: event
void
nsWindow::BringToTop()
{
if (!sTopWindows.IsEmpty()) {
nsGUIEvent event(true, NS_DEACTIVATE, sTopWindows[0]);
(*mEventCallback)(&event);
}
sTopWindows.RemoveElement(this);
sTopWindows.InsertElementAt(0, this);
nsGUIEvent event(true, NS_ACTIVATE, this);
(*mEventCallback)(&event);
}
示例6: Invalidate
void
nsWindow::BringToTop()
{
if (!sTopWindows.IsEmpty()) {
if (nsIWidgetListener* listener = sTopWindows[0]->GetWidgetListener())
listener->WindowDeactivated();
}
sTopWindows.RemoveElement(this);
sTopWindows.InsertElementAt(0, this);
if (mWidgetListener)
mWidgetListener->WindowActivated();
Invalidate(sVirtualBounds);
}
示例7:
void
nsFontCache::FontMetricsDeleted(const nsFontMetrics* aFontMetrics)
{
mFontMetrics.RemoveElement(aFontMetrics);
}
示例8: OnError
void OnError(BluetoothStatus aStatus) override
{
sUnbondingRunnableArray.RemoveElement(mRunnable);
DispatchReplyError(mRunnable, aStatus);
}
示例9: while
uint32_t
GridLines::AppendRemovedAutoFits(const ComputedGridTrackInfo* aTrackInfo,
const ComputedGridLineInfo* aLineInfo,
nscoord aLastTrackEdge,
uint32_t& aRepeatIndex,
uint32_t aNumRepeatTracks,
nsTArray<nsString>& aLineNames)
{
// Check to see if lineNames contains ALL of the before line names.
bool alreadyHasBeforeLineNames = true;
for (const auto& beforeName : aLineInfo->mNamesBefore) {
if (!aLineNames.Contains(beforeName)) {
alreadyHasBeforeLineNames = false;
break;
}
}
bool extractedExplicitLineNames = false;
nsTArray<nsString> explicitLineNames;
uint32_t linesAdded = 0;
while (aRepeatIndex < aNumRepeatTracks &&
aTrackInfo->mRemovedRepeatTracks[aRepeatIndex]) {
// If this is not the very first call to this function, and if we
// haven't already added a line this call, pull all the explicit
// names to pass along to the next line that will be added after
// this function completes.
if (aRepeatIndex > 0 &&
linesAdded == 0) {
// Find the names that didn't match the before or after names,
// and extract them.
for (const auto& name : aLineNames) {
if (!aLineInfo->mNamesBefore.Contains(name) &&
!aLineInfo->mNamesAfter.Contains(name)) {
explicitLineNames.AppendElement(name);
}
}
for (const auto& extractedName : explicitLineNames) {
aLineNames.RemoveElement(extractedName);
}
extractedExplicitLineNames = true;
}
// If this is the second or later time through, or didn't already
// have before names, add them.
if (linesAdded > 0 || !alreadyHasBeforeLineNames) {
aLineNames.AppendElements(aLineInfo->mNamesBefore);
}
RefPtr<GridLine> line = new GridLine(this);
mLines.AppendElement(line);
line->SetLineValues(
aLineNames,
nsPresContext::AppUnitsToDoubleCSSPixels(aLastTrackEdge),
nsPresContext::AppUnitsToDoubleCSSPixels(0),
aTrackInfo->mRepeatFirstTrack + aRepeatIndex + 1,
GridDeclaration::Explicit
);
// No matter what, the next line should have the after names associated
// with it. If we go through the loop again, the before names will also
// be added.
aLineNames = aLineInfo->mNamesAfter;
aRepeatIndex++;
linesAdded++;
}
aRepeatIndex++;
if (extractedExplicitLineNames) {
// Pass on the explicit names we saved to the next explicit line.
aLineNames.AppendElements(explicitLineNames);
}
if (alreadyHasBeforeLineNames && linesAdded > 0) {
// If we started with before names, pass them on to the next explicit
// line.
aLineNames.AppendElements(aLineInfo->mNamesBefore);
}
return linesAdded;
}
示例10: FontMetricsDeleted
nsresult nsFontCache::FontMetricsDeleted(const nsIFontMetrics* aFontMetrics)
{
mFontMetrics.RemoveElement(aFontMetrics);
return NS_OK;
}