LCOV - code coverage report
Current view: directory - content/events/src - nsDOMDataContainerEvent.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 37 2 5.4 %
Date: 2012-06-02 Functions: 13 2 15.4 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is mozilla.org code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Mozilla Foundation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 2007
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Alexander Surkov <surkov.alexander@gmail.com> (original author)
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      27                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #include "nsDOMDataContainerEvent.h"
      40                 : 
      41                 : #include "nsContentUtils.h"
      42                 : 
      43               0 : nsDOMDataContainerEvent::nsDOMDataContainerEvent(nsPresContext *aPresContext,
      44                 :                                                  nsEvent *aEvent)
      45               0 :   : nsDOMEvent(aPresContext, aEvent)
      46                 : {
      47               0 :   mData.Init();
      48               0 : }
      49                 : 
      50            1464 : NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMDataContainerEvent)
      51                 : 
      52               0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMDataContainerEvent,
      53                 :                                                 nsDOMEvent)
      54               0 :   if (tmp->mData.IsInitialized())
      55               0 :     tmp->mData.Clear();
      56               0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_END
      57                 : 
      58               0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMDataContainerEvent,
      59                 :                                                   nsDOMEvent)
      60               0 :   tmp->mData.EnumerateRead(TraverseEntry, &cb);
      61               0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
      62                 : 
      63               0 : NS_IMPL_ADDREF_INHERITED(nsDOMDataContainerEvent, nsDOMEvent)
      64               0 : NS_IMPL_RELEASE_INHERITED(nsDOMDataContainerEvent, nsDOMEvent)
      65                 : 
      66                 : DOMCI_DATA(DataContainerEvent, nsDOMDataContainerEvent)
      67                 : 
      68               0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMDataContainerEvent)
      69               0 :   NS_INTERFACE_MAP_ENTRY(nsIDOMDataContainerEvent)
      70               0 :   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DataContainerEvent)
      71               0 : NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
      72                 : 
      73                 : NS_IMETHODIMP
      74               0 : nsDOMDataContainerEvent::GetData(const nsAString& aKey, nsIVariant **aData)
      75                 : {
      76               0 :   NS_ENSURE_ARG_POINTER(aData);
      77                 : 
      78               0 :   NS_ENSURE_STATE(mData.IsInitialized());
      79                 : 
      80               0 :   mData.Get(aKey, aData);
      81               0 :   return NS_OK;
      82                 : }
      83                 : 
      84                 : NS_IMETHODIMP
      85               0 : nsDOMDataContainerEvent::SetData(const nsAString& aKey, nsIVariant *aData)
      86                 : {
      87               0 :   NS_ENSURE_ARG(aData);
      88                 : 
      89                 :   // Make sure this event isn't already being dispatched.
      90               0 :   NS_ENSURE_STATE(!(NS_IS_EVENT_IN_DISPATCH(mEvent)));
      91               0 :   NS_ENSURE_STATE(mData.IsInitialized());
      92               0 :   return mData.Put(aKey, aData) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
      93                 : }
      94                 : 
      95                 : nsresult
      96               0 : NS_NewDOMDataContainerEvent(nsIDOMEvent** aInstancePtrResult,
      97                 :                    nsPresContext* aPresContext,
      98                 :                    nsEvent* aEvent)
      99                 : {
     100                 :   nsDOMDataContainerEvent* it =
     101               0 :     new nsDOMDataContainerEvent(aPresContext, aEvent);
     102               0 :   NS_ENSURE_TRUE(it, NS_ERROR_OUT_OF_MEMORY);
     103                 : 
     104               0 :   return CallQueryInterface(it, aInstancePtrResult);
     105                 : }
     106                 : 
     107                 : PLDHashOperator
     108               0 : nsDOMDataContainerEvent::TraverseEntry(const nsAString& aKey,
     109                 :                                        nsIVariant *aDataItem,
     110                 :                                        void* aUserArg)
     111                 : {
     112                 :   nsCycleCollectionTraversalCallback *cb =
     113               0 :     static_cast<nsCycleCollectionTraversalCallback*>(aUserArg);
     114               0 :   cb->NoteXPCOMChild(aDataItem);
     115                 : 
     116               0 :   return PL_DHASH_NEXT;
     117            4392 : }
     118                 : 

Generated by: LCOV version 1.7