Bug 1484118 - Remove the XPCOM component registration for nsTransactionManager; r=masayuki
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 23 Aug 2018 09:36:59 -0400
changeset 488162 ae7dc05bee296f01c98e9b6d166ab308ea286690
parent 488161 59e3301c5ab8c40ca18db964d9ad5d4a5f026f80
child 488163 c420e3bec25bbdc2980353017f775acae3e12ff3
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1484118
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1484118 - Remove the XPCOM component registration for nsTransactionManager; r=masayuki
editor/txmgr/TransactionManagerFactory.cpp
editor/txmgr/moz.build
editor/txmgr/nsITransactionManager.idl
editor/txmgr/tests/TestTXMgr.cpp
deleted file mode 100644
--- a/editor/txmgr/TransactionManagerFactory.cpp
+++ /dev/null
@@ -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;
--- a/editor/txmgr/moz.build
+++ b/editor/txmgr/moz.build
@@ -21,13 +21,12 @@ EXPORTS += [
 EXPORTS.mozilla += [
     'TransactionManager.h',
     'TransactionStack.h',
 ]
 
 UNIFIED_SOURCES += [
     'TransactionItem.cpp',
     'TransactionManager.cpp',
-    'TransactionManagerFactory.cpp',
     'TransactionStack.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
--- a/editor/txmgr/nsITransactionManager.idl
+++ b/editor/txmgr/nsITransactionManager.idl
@@ -155,19 +155,8 @@ interface nsITransactionManager : nsISup
    * AsTransactionManager() returns a pointer to TransactionManager class.
    *
    * In order to avoid circular dependency issues, this method is defined
    * in mozilla/TransactionManager.h.  Consumers need to #include that header.
    */
   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++
--- a/editor/txmgr/tests/TestTXMgr.cpp
+++ b/editor/txmgr/tests/TestTXMgr.cpp
@@ -3,16 +3,19 @@
  * 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 "gtest/gtest.h"
 
 #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;
 static int32_t *sDoOrderArr          = 0;
 static int32_t sUndoCount            = 0;
 static int32_t *sUndoOrderArr        = 0;
 static int32_t sRedoCount            = 0;
 static int32_t *sRedoOrderArr        = 0;
@@ -528,28 +531,25 @@ void
 quick_test(TestTransactionFactory *factory)
 {
   /*******************************************************************
    *
    * Create a transaction manager implementation:
    *
    *******************************************************************/
 
-  nsresult rv;
-  nsCOMPtr<nsITransactionManager> mgr =
-    do_CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, &rv);
-  ASSERT_TRUE(NS_SUCCEEDED(rv));
+  nsCOMPtr<nsITransactionManager> mgr = new TransactionManager();
 
   /*******************************************************************
    *
    * Call DoTransaction() with a null transaction:
    *
    *******************************************************************/
 
-  rv = mgr->DoTransaction(0);
+  nsresult rv = mgr->DoTransaction(0);
   EXPECT_EQ(rv, NS_ERROR_NULL_POINTER);
 
   /*******************************************************************
    *
    * Call UndoTransaction() with an empty undo stack:
    *
    *******************************************************************/
 
@@ -1280,32 +1280,28 @@ void
 quick_batch_test(TestTransactionFactory *factory)
 {
   /*******************************************************************
    *
    * Create a transaction manager implementation:
    *
    *******************************************************************/
 
-  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;
 
   /*******************************************************************
    *
    * Make sure an unbalanced call to EndBatch(false) with empty undo stack
    * throws an error!
    *
    *******************************************************************/
 
-  rv = mgr->GetNumberOfUndoItems(&numitems);
+  nsresult rv = mgr->GetNumberOfUndoItems(&numitems);
   EXPECT_TRUE(NS_SUCCEEDED(rv));
   EXPECT_EQ(numitems, 0);
 
   rv = mgr->EndBatch(false);
   EXPECT_EQ(rv, NS_ERROR_FAILURE);
 
   rv = mgr->GetNumberOfUndoItems(&numitems);
   EXPECT_TRUE(NS_SUCCEEDED(rv));
@@ -1915,22 +1911,19 @@ void
 stress_test(TestTransactionFactory *factory, int32_t iterations)
 {
   /*******************************************************************
    *
    * Create a transaction manager:
    *
    *******************************************************************/
 
+  nsCOMPtr<nsITransactionManager> mgr = new TransactionManager();
+
   nsresult rv;
-  nsCOMPtr<nsITransactionManager> mgr =
-    do_CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, &rv);
-  ASSERT_TRUE(NS_SUCCEEDED(rv));
-  ASSERT_TRUE(mgr);
-
   int32_t i, j;
 
   for (i = 1; i <= iterations; i++) {
     /*******************************************************************
      *
      * Create and execute a bunch of transactions:
      *
      *******************************************************************/