xpcom/tests/SizeTest04.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 // Test04.cpp
     3 #include "nsIDOMNode.h"
     4 #include "nsCOMPtr.h"
     6 NS_DEF_PTR(nsIDOMNode);
     8 	/*
     9 		Windows:
    10 			nsCOMPtr							 13
    11 			raw										 36
    13 		Macintosh:
    14 			nsCOMPtr							 36 bytes		(1.0000)
    15 			raw										120					(3.3333)	i.e., 333.33% bigger than nsCOMPtr
    16 	*/
    18 class Test04_Raw
    19 	{
    20 		public:
    21 			Test04_Raw();
    22 		 ~Test04_Raw();
    24 			void /*nsresult*/ SetNode( nsIDOMNode* newNode );
    26 		private:
    27 			nsIDOMNode* mNode;
    28 	};
    30 Test04_Raw::Test04_Raw()
    31 		: mNode(0)
    32 	{
    33 		// nothing else to do here
    34 	}
    36 Test04_Raw::~Test04_Raw()
    37 	{
    38 		NS_IF_RELEASE(mNode);
    39 	}
    41 void // nsresult
    42 Test04_Raw::SetNode( nsIDOMNode* newNode )
    43 		// m120, w36
    44 	{
    45 		NS_IF_ADDREF(newNode);
    46 		NS_IF_RELEASE(mNode);
    47 		mNode = newNode;
    49 //		return NS_OK;
    50 	}
    54 class Test04_nsCOMPtr
    55 	{
    56 		public:
    57 			void /*nsresult*/ SetNode( nsIDOMNode* newNode );
    59 		private:
    60 			nsCOMPtr<nsIDOMNode> mNode;
    61 	};
    63 void // nsresult
    64 Test04_nsCOMPtr::SetNode( nsIDOMNode* newNode )
    65 		// m36, w13/13
    66 	{
    67 		mNode = newNode;
    68 	}

mercurial