LCOV - code coverage report
Current view: top level - include/canvas/base - basemutexhelper.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 7 7 100.0 %
Date: 2014-11-03 Functions: 4 25 16.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             : #ifndef INCLUDED_CANVAS_BASE_BASEMUTEXHELPER_HXX
      21             : #define INCLUDED_CANVAS_BASE_BASEMUTEXHELPER_HXX
      22             : 
      23             : #include <sal/config.h>
      24             : 
      25             : #include <osl/mutex.hxx>
      26             : 
      27             : /* Definition of the BaseMutexHelper class */
      28             : 
      29             : namespace canvas
      30             : {
      31             :     /** Base class, initializing its own baseclass with m_aMutex.
      32             : 
      33             :         This is necessary to make the CanvasBase, GraphicDeviceBase,
      34             :         etc. classes freely combinable - letting them perform this
      35             :         initialization would prohibit deriving e.g. CanvasBase from
      36             :         GraphicDeviceBase.
      37             :      */
      38           2 :     template< class Base > class BaseMutexHelper : public Base
      39             :     {
      40             :     protected:
      41             :         /** Construct BaseMutexHelper
      42             : 
      43             :             This method is the whole purpose of this template:
      44             :             initializing a base class with the provided m_aMutex
      45             :             member (the WeakComponentImplHelper templates need that,
      46             :             as they require the lifetime of the mutex to extend
      47             :             theirs).
      48             :          */
      49           2 :         BaseMutexHelper() :
      50           2 :             Base( m_aMutex )
      51             :         {
      52           2 :         }
      53             : 
      54           2 :         virtual void disposeThis() {}
      55             : 
      56             :         mutable osl::Mutex m_aMutex;
      57             : 
      58             :     private:
      59           2 :         virtual void SAL_CALL disposing() SAL_OVERRIDE
      60           2 :         { disposeThis(); }
      61             :     };
      62             : }
      63             : 
      64             : #endif
      65             : 
      66             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10