зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1455676 part 12. Remove use of nsIDOMNode from xpcom/. r=qdot
This commit is contained in:
Родитель
5fa76e716f
Коммит
1d8f39e16f
|
@ -1,10 +1,10 @@
|
||||||
// Test01.cpp
|
// Test01.cpp
|
||||||
|
|
||||||
#include "nsIDOMNode.h"
|
#include "nsINode.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
NS_DEF_PTR(nsIDOMNode);
|
NS_DEF_PTR(nsINode);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This test file compares the generated code size of similar functions between raw
|
This test file compares the generated code size of similar functions between raw
|
||||||
|
@ -40,7 +40,7 @@ NS_DEF_PTR(nsIDOMNode);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
Test01_raw( nsIDOMNode* aDOMNode, nsString* aResult )
|
Test01_raw( nsINode* aDOMNode, nsString* aResult )
|
||||||
// m140, w34
|
// m140, w34
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -49,7 +49,7 @@ Test01_raw( nsIDOMNode* aDOMNode, nsString* aResult )
|
||||||
one of them is |nullptr|. Similarly: |Test01_nsCOMPtr00|, and |Test01_nsIPtr00|.
|
one of them is |nullptr|. Similarly: |Test01_nsCOMPtr00|, and |Test01_nsIPtr00|.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nsIDOMNode* node = aDOMNode;
|
nsINode* node = aDOMNode;
|
||||||
NS_IF_ADDREF(node);
|
NS_IF_ADDREF(node);
|
||||||
|
|
||||||
if ( node )
|
if ( node )
|
||||||
|
@ -59,7 +59,7 @@ Test01_raw( nsIDOMNode* aDOMNode, nsString* aResult )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Test01_raw_optimized( nsIDOMNode* aDOMNode, nsString* aResult )
|
Test01_raw_optimized( nsINode* aDOMNode, nsString* aResult )
|
||||||
// m112, w31
|
// m112, w31
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -79,29 +79,29 @@ Test01_raw_optimized( nsIDOMNode* aDOMNode, nsString* aResult )
|
||||||
// if ( !aDOMNode )
|
// if ( !aDOMNode )
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
nsIDOMNode* node = aDOMNode;
|
nsINode* node = aDOMNode;
|
||||||
NS_ADDREF(node);
|
NS_ADDREF(node);
|
||||||
node->GetNodeName(*aResult);
|
node->GetNodeName(*aResult);
|
||||||
NS_RELEASE(node);
|
NS_RELEASE(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Test01_nsCOMPtr( nsIDOMNode* aDOMNode, nsString* aResult )
|
Test01_nsCOMPtr( nsINode* aDOMNode, nsString* aResult )
|
||||||
// m120, w46/34
|
// m120, w46/34
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMNode> node = aDOMNode;
|
nsCOMPtr<nsINode> node = aDOMNode;
|
||||||
|
|
||||||
if ( node )
|
if ( node )
|
||||||
node->GetNodeName(*aResult);
|
node->GetNodeName(*aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Test01_nsCOMPtr_optimized( nsIDOMNode* aDOMNode, nsString* aResult )
|
Test01_nsCOMPtr_optimized( nsINode* aDOMNode, nsString* aResult )
|
||||||
// m112, w42/38
|
// m112, w42/38
|
||||||
{
|
{
|
||||||
// if ( !aDOMNode )
|
// if ( !aDOMNode )
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> node = aDOMNode;
|
nsCOMPtr<nsINode> node = aDOMNode;
|
||||||
node->GetNodeName(*aResult);
|
node->GetNodeName(*aResult);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// Test02.cpp
|
// Test02.cpp
|
||||||
|
|
||||||
#include "nsIDOMNode.h"
|
#include "nsINode.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
NS_DEF_PTR(nsIDOMNode);
|
NS_DEF_PTR(nsINode);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This test file compares the generated code size of similar functions between raw
|
This test file compares the generated code size of similar functions between raw
|
||||||
|
@ -44,8 +44,8 @@ Test02_Raw00( nsISupports* aDOMNode, nsString* aResult )
|
||||||
// if ( !aDOMNode )
|
// if ( !aDOMNode )
|
||||||
// return NS_ERROR_NULL_POINTER;
|
// return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
nsIDOMNode* node = 0;
|
nsINode* node = 0;
|
||||||
nsresult status = aDOMNode->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)&node);
|
nsresult status = aDOMNode->QueryInterface(NS_GET_IID(nsINode), (void**)&node);
|
||||||
if ( NS_SUCCEEDED(status) )
|
if ( NS_SUCCEEDED(status) )
|
||||||
{
|
{
|
||||||
node->GetNodeName(*aResult);
|
node->GetNodeName(*aResult);
|
||||||
|
@ -63,8 +63,8 @@ Test02_Raw01( nsISupports* aDOMNode, nsString* aResult )
|
||||||
// if ( !aDOMNode )
|
// if ( !aDOMNode )
|
||||||
// return NS_ERROR_NULL_POINTER;
|
// return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
nsIDOMNode* node;
|
nsINode* node;
|
||||||
nsresult status = aDOMNode->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)&node);
|
nsresult status = aDOMNode->QueryInterface(NS_GET_IID(nsINode), (void**)&node);
|
||||||
if ( NS_SUCCEEDED(status) )
|
if ( NS_SUCCEEDED(status) )
|
||||||
{
|
{
|
||||||
node->GetNodeName(*aResult);
|
node->GetNodeName(*aResult);
|
||||||
|
@ -79,7 +79,7 @@ Test02_nsCOMPtr( nsISupports* aDOMNode, nsString* aResult )
|
||||||
// m120, w63/68
|
// m120, w63/68
|
||||||
{
|
{
|
||||||
nsresult status;
|
nsresult status;
|
||||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aDOMNode, &status);
|
nsCOMPtr<nsINode> node = do_QueryInterface(aDOMNode, &status);
|
||||||
|
|
||||||
if ( node )
|
if ( node )
|
||||||
node->GetNodeName(*aResult);
|
node->GetNodeName(*aResult);
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// Test03.cpp
|
// Test03.cpp
|
||||||
|
|
||||||
#include "nsIDOMNode.h"
|
#include "nsINode.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
NS_DEF_PTR(nsIDOMNode);
|
NS_DEF_PTR(nsINode);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Windows:
|
Windows:
|
||||||
|
@ -22,7 +22,7 @@ NS_DEF_PTR(nsIDOMNode);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void // nsresult
|
void // nsresult
|
||||||
Test03_raw( nsIDOMNode* aDOMNode, nsString* aResult )
|
Test03_raw( nsINode* aDOMNode, nsString* aResult )
|
||||||
// m140, w62
|
// m140, w62
|
||||||
{
|
{
|
||||||
// -- the following code is assumed, but is commented out so we compare only
|
// -- the following code is assumed, but is commented out so we compare only
|
||||||
|
@ -31,7 +31,7 @@ Test03_raw( nsIDOMNode* aDOMNode, nsString* aResult )
|
||||||
// if ( !aDOMNode || !aResult )
|
// if ( !aDOMNode || !aResult )
|
||||||
// return NS_ERROR_NULL_POINTER;
|
// return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
nsIDOMNode* parent = 0;
|
nsINode* parent = 0;
|
||||||
nsresult status = aDOMNode->GetParentNode(&parent);
|
nsresult status = aDOMNode->GetParentNode(&parent);
|
||||||
|
|
||||||
if ( NS_SUCCEEDED(status) )
|
if ( NS_SUCCEEDED(status) )
|
||||||
|
@ -46,13 +46,13 @@ Test03_raw( nsIDOMNode* aDOMNode, nsString* aResult )
|
||||||
|
|
||||||
|
|
||||||
void // nsresult
|
void // nsresult
|
||||||
Test03_raw_optimized( nsIDOMNode* aDOMNode, nsString* aResult )
|
Test03_raw_optimized( nsINode* aDOMNode, nsString* aResult )
|
||||||
// m124, w48
|
// m124, w48
|
||||||
{
|
{
|
||||||
// if ( !aDOMNode || !aResult )
|
// if ( !aDOMNode || !aResult )
|
||||||
// return NS_ERROR_NULL_POINTER;
|
// return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
nsIDOMNode* parent;
|
nsINode* parent;
|
||||||
nsresult status = aDOMNode->GetParentNode(&parent);
|
nsresult status = aDOMNode->GetParentNode(&parent);
|
||||||
|
|
||||||
if ( NS_SUCCEEDED(status) )
|
if ( NS_SUCCEEDED(status) )
|
||||||
|
@ -66,13 +66,13 @@ Test03_raw_optimized( nsIDOMNode* aDOMNode, nsString* aResult )
|
||||||
|
|
||||||
|
|
||||||
void // nsresult
|
void // nsresult
|
||||||
Test03_nsCOMPtr( nsIDOMNode* aDOMNode, nsString* aResult )
|
Test03_nsCOMPtr( nsINode* aDOMNode, nsString* aResult )
|
||||||
// m144, w54/59
|
// m144, w54/59
|
||||||
{
|
{
|
||||||
// if ( !aDOMNode || !aResult )
|
// if ( !aDOMNode || !aResult )
|
||||||
// return NS_ERROR_NULL_POINTER;
|
// return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> parent;
|
nsCOMPtr<nsINode> parent;
|
||||||
nsresult status = aDOMNode->GetParentNode( getter_AddRefs(parent) );
|
nsresult status = aDOMNode->GetParentNode( getter_AddRefs(parent) );
|
||||||
if ( parent )
|
if ( parent )
|
||||||
parent->GetNodeName(*aResult);
|
parent->GetNodeName(*aResult);
|
||||||
|
@ -81,15 +81,15 @@ Test03_nsCOMPtr( nsIDOMNode* aDOMNode, nsString* aResult )
|
||||||
}
|
}
|
||||||
|
|
||||||
void // nsresult
|
void // nsresult
|
||||||
Test03_nsCOMPtr_optimized( nsIDOMNode* aDOMNode, nsString* aResult )
|
Test03_nsCOMPtr_optimized( nsINode* aDOMNode, nsString* aResult )
|
||||||
// m112, w50/45
|
// m112, w50/45
|
||||||
{
|
{
|
||||||
// if ( !aDOMNode || !aResult )
|
// if ( !aDOMNode || !aResult )
|
||||||
// return NS_ERROR_NULL_POINTER;
|
// return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
nsIDOMNode* temp;
|
nsINode* temp;
|
||||||
nsresult status = aDOMNode->GetParentNode(&temp);
|
nsresult status = aDOMNode->GetParentNode(&temp);
|
||||||
nsCOMPtr<nsIDOMNode> parent( dont_AddRef(temp) );
|
nsCOMPtr<nsINode> parent( dont_AddRef(temp) );
|
||||||
if ( parent )
|
if ( parent )
|
||||||
parent->GetNodeName(*aResult);
|
parent->GetNodeName(*aResult);
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// Test04.cpp
|
// Test04.cpp
|
||||||
|
|
||||||
#include "nsIDOMNode.h"
|
#include "nsINode.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
|
||||||
NS_DEF_PTR(nsIDOMNode);
|
NS_DEF_PTR(nsINode);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Windows:
|
Windows:
|
||||||
|
@ -21,10 +21,10 @@ class Test04_Raw
|
||||||
Test04_Raw();
|
Test04_Raw();
|
||||||
~Test04_Raw();
|
~Test04_Raw();
|
||||||
|
|
||||||
void /*nsresult*/ SetNode( nsIDOMNode* newNode );
|
void /*nsresult*/ SetNode( nsINode* newNode );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsIDOMNode* mNode;
|
nsINode* mNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
Test04_Raw::Test04_Raw()
|
Test04_Raw::Test04_Raw()
|
||||||
|
@ -39,7 +39,7 @@ Test04_Raw::~Test04_Raw()
|
||||||
}
|
}
|
||||||
|
|
||||||
void // nsresult
|
void // nsresult
|
||||||
Test04_Raw::SetNode( nsIDOMNode* newNode )
|
Test04_Raw::SetNode( nsINode* newNode )
|
||||||
// m120, w36
|
// m120, w36
|
||||||
{
|
{
|
||||||
NS_IF_ADDREF(newNode);
|
NS_IF_ADDREF(newNode);
|
||||||
|
@ -54,14 +54,14 @@ Test04_Raw::SetNode( nsIDOMNode* newNode )
|
||||||
class Test04_nsCOMPtr
|
class Test04_nsCOMPtr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void /*nsresult*/ SetNode( nsIDOMNode* newNode );
|
void /*nsresult*/ SetNode( nsINode* newNode );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsCOMPtr<nsIDOMNode> mNode;
|
nsCOMPtr<nsINode> mNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
void // nsresult
|
void // nsresult
|
||||||
Test04_nsCOMPtr::SetNode( nsIDOMNode* newNode )
|
Test04_nsCOMPtr::SetNode( nsINode* newNode )
|
||||||
// m36, w13/13
|
// m36, w13/13
|
||||||
{
|
{
|
||||||
mNode = newNode;
|
mNode = newNode;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// Test05.cpp
|
// Test05.cpp
|
||||||
|
|
||||||
#include "nsIDOMNode.h"
|
#include "nsINode.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
|
||||||
NS_DEF_PTR(nsIDOMNode);
|
NS_DEF_PTR(nsINode);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Windows:
|
Windows:
|
||||||
|
@ -19,10 +19,10 @@ class Test05_Raw
|
||||||
Test05_Raw();
|
Test05_Raw();
|
||||||
~Test05_Raw();
|
~Test05_Raw();
|
||||||
|
|
||||||
void /*nsresult*/ GetNode( nsIDOMNode** aNode );
|
void /*nsresult*/ GetNode( nsINode** aNode );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsIDOMNode* mNode;
|
nsINode* mNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
Test05_Raw::Test05_Raw()
|
Test05_Raw::Test05_Raw()
|
||||||
|
@ -37,7 +37,7 @@ Test05_Raw::~Test05_Raw()
|
||||||
}
|
}
|
||||||
|
|
||||||
void // nsresult
|
void // nsresult
|
||||||
Test05_Raw::GetNode( nsIDOMNode** aNode )
|
Test05_Raw::GetNode( nsINode** aNode )
|
||||||
// m64, w21
|
// m64, w21
|
||||||
{
|
{
|
||||||
// if ( !aNode )
|
// if ( !aNode )
|
||||||
|
@ -54,14 +54,14 @@ Test05_Raw::GetNode( nsIDOMNode** aNode )
|
||||||
class Test05_nsCOMPtr
|
class Test05_nsCOMPtr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void /*nsresult*/ GetNode( nsIDOMNode** aNode );
|
void /*nsresult*/ GetNode( nsINode** aNode );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsCOMPtr<nsIDOMNode> mNode;
|
nsCOMPtr<nsINode> mNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
void // nsresult
|
void // nsresult
|
||||||
Test05_nsCOMPtr::GetNode( nsIDOMNode** aNode )
|
Test05_nsCOMPtr::GetNode( nsINode** aNode )
|
||||||
// m64, w21
|
// m64, w21
|
||||||
{
|
{
|
||||||
// if ( !aNode )
|
// if ( !aNode )
|
||||||
|
|
Загрузка…
Ссылка в новой задаче