LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/store/source - object.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 18 20 90.0 %
Date: 2013-07-09 Functions: 6 8 75.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include "object.hxx"
      22             : 
      23             : #include "sal/types.h"
      24             : #include "rtl/alloc.h"
      25             : #include "rtl/ref.hxx"
      26             : #include "osl/diagnose.h"
      27             : #include "osl/interlck.h"
      28             : 
      29             : namespace store
      30             : {
      31             : 
      32             : /*========================================================================
      33             :  *
      34             :  * OStoreObject implementation.
      35             :  *
      36             :  *======================================================================*/
      37             : const sal_uInt32 OStoreObject::m_nTypeId = sal_uInt32(0x58190322);
      38             : 
      39             : /*
      40             :  * OStoreObject.
      41             :  */
      42      389560 : OStoreObject::OStoreObject (void)
      43      389560 :     : m_nRefCount (0)
      44             : {
      45      389560 : }
      46             : 
      47             : /*
      48             :  * ~OStoreObject.
      49             :  */
      50      389560 : OStoreObject::~OStoreObject (void)
      51             : {
      52             :     OSL_ASSERT(m_nRefCount == 0);
      53      389560 : }
      54             : 
      55             : /*
      56             :  * operator new.
      57             :  */
      58      389560 : void* OStoreObject::operator new (size_t n)
      59             : {
      60      389560 :     return rtl_allocateMemory (n);
      61             : }
      62             : 
      63             : /*
      64             :  * operator delete.
      65             :  */
      66      389560 : void OStoreObject::operator delete (void *p)
      67             : {
      68      389560 :     rtl_freeMemory (p);
      69      389560 : }
      70             : 
      71             : /*
      72             :  * isKindOf.
      73             :  */
      74           0 : sal_Bool SAL_CALL OStoreObject::isKindOf (sal_uInt32 nTypeId)
      75             : {
      76           0 :     return (nTypeId == m_nTypeId);
      77             : }
      78             : 
      79             : /*
      80             :  * acquire.
      81             :  */
      82    12609197 : oslInterlockedCount SAL_CALL OStoreObject::acquire (void)
      83             : {
      84    12609197 :     oslInterlockedCount result = osl_atomic_increment (&m_nRefCount);
      85    12609197 :     return (result);
      86             : }
      87             : 
      88             : /*
      89             :  * release.
      90             :  */
      91    12609197 : oslInterlockedCount SAL_CALL OStoreObject::release (void)
      92             : {
      93    12609197 :     oslInterlockedCount result = osl_atomic_decrement (&m_nRefCount);
      94    12609197 :     if (result == 0)
      95             :     {
      96             :         // Last reference released.
      97      389560 :         delete this;
      98             :     }
      99    12609197 :     return (result);
     100             : }
     101             : 
     102             : } // namespace store
     103             : 
     104             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10