Bug 1484118 - Remove the XPCOM component registration for nsTransactionManager; r=masayuki

This commit is contained in:
Ehsan Akhgari 2018-08-23 09:36:59 -04:00
parent e9a81c688d
commit 68af33dddb
4 changed files with 9 additions and 69 deletions

View File

@ -1,41 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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 <stddef.h>
#include "mozilla/Module.h"
#include "mozilla/ModuleUtils.h"
#include "mozilla/TransactionManager.h"
#include "nsID.h"
#include "nsITransactionManager.h"
using mozilla::TransactionManager;
////////////////////////////////////////////////////////////////////////
// Define the contructor function for the objects
//
// NOTE: This creates an instance of objects by using the default constructor
//
NS_GENERIC_FACTORY_CONSTRUCTOR(TransactionManager)
NS_DEFINE_NAMED_CID(NS_TRANSACTIONMANAGER_CID);
static const mozilla::Module::CIDEntry kTxMgrCIDs[] = {
{ &kNS_TRANSACTIONMANAGER_CID, false, nullptr,
TransactionManagerConstructor },
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kTxMgrContracts[] = {
{ NS_TRANSACTIONMANAGER_CONTRACTID, &kNS_TRANSACTIONMANAGER_CID },
{ nullptr }
};
static const mozilla::Module kTxMgrModule = {
mozilla::Module::kVersion,
kTxMgrCIDs,
kTxMgrContracts
};
NSMODULE_DEFN(nsTransactionManagerModule) = &kTxMgrModule;

View File

@ -26,7 +26,6 @@ EXPORTS.mozilla += [
UNIFIED_SOURCES += [
'TransactionItem.cpp',
'TransactionManager.cpp',
'TransactionManagerFactory.cpp',
'TransactionStack.cpp',
]

View File

@ -160,14 +160,3 @@ interface nsITransactionManager : nsISupports
inline mozilla::TransactionManager* AsTransactionManager();
%}
};
%{ C++
#define NS_TRANSACTIONMANAGER_CONTRACTID "@mozilla.org/transactionmanager;1"
// 9C8F9601-801A-11d2-98BA-00805F297D89
#define NS_TRANSACTIONMANAGER_CID \
{ 0x9c8f9601, 0x801a, 0x11d2, \
{ 0x98, 0xba, 0x0, 0x80, 0x5f, 0x29, 0x7d, 0x89 } }
%} C++

View File

@ -8,6 +8,9 @@
#include "nsITransactionManager.h"
#include "nsComponentManagerUtils.h"
#include "mozilla/Likely.h"
#include "mozilla/TransactionManager.h"
using mozilla::TransactionManager;
static int32_t sConstructorCount = 0;
static int32_t sDoCount = 0;
@ -533,10 +536,7 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
nsresult rv;
nsCOMPtr<nsITransactionManager> mgr =
do_CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, &rv);
ASSERT_TRUE(NS_SUCCEEDED(rv));
nsCOMPtr<nsITransactionManager> mgr = new TransactionManager();
/*******************************************************************
*
@ -544,7 +544,7 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
rv = mgr->DoTransaction(0);
nsresult rv = mgr->DoTransaction(0);
EXPECT_EQ(rv, NS_ERROR_NULL_POINTER);
/*******************************************************************
@ -1285,11 +1285,7 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
nsresult rv;
nsCOMPtr<nsITransactionManager> mgr =
do_CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, &rv);
ASSERT_TRUE(mgr);
ASSERT_TRUE(NS_SUCCEEDED(rv));
nsCOMPtr<nsITransactionManager> mgr = new TransactionManager();
int32_t numitems;
@ -1300,7 +1296,7 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
rv = mgr->GetNumberOfUndoItems(&numitems);
nsresult rv = mgr->GetNumberOfUndoItems(&numitems);
EXPECT_TRUE(NS_SUCCEEDED(rv));
EXPECT_EQ(numitems, 0);
@ -1920,12 +1916,9 @@ stress_test(TestTransactionFactory *factory, int32_t iterations)
*
*******************************************************************/
nsresult rv;
nsCOMPtr<nsITransactionManager> mgr =
do_CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, &rv);
ASSERT_TRUE(NS_SUCCEEDED(rv));
ASSERT_TRUE(mgr);
nsCOMPtr<nsITransactionManager> mgr = new TransactionManager();
nsresult rv;
int32_t i, j;
for (i = 1; i <= iterations; i++) {