LCOV - code coverage report
Current view: top level - slideshow/source/engine - wakeupevent.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 25 4.0 %
Date: 2014-11-03 Functions: 2 10 20.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             : // must be first
      22             : #include <canvas/debug.hxx>
      23             : #include <canvas/verbosetrace.hxx>
      24             : 
      25             : #include <wakeupevent.hxx>
      26             : 
      27             : 
      28             : namespace slideshow
      29             : {
      30             :     namespace internal
      31             :     {
      32           0 :         WakeupEvent::WakeupEvent(
      33             :             boost::shared_ptr<canvas::tools::ElapsedTime> const & pTimeBase,
      34             :             ActivitiesQueue& rActivityQueue ) :
      35             :             Event("WakeupEvent"),
      36             :             maTimer(pTimeBase),
      37             :             mnNextTime(0.0),
      38             :             mpActivity(),
      39           0 :             mrActivityQueue( rActivityQueue )
      40             :         {
      41           0 :         }
      42             : 
      43           0 :         void WakeupEvent::dispose()
      44             :         {
      45           0 :             mpActivity.reset();
      46           0 :         }
      47             : 
      48           0 :         bool WakeupEvent::fire()
      49             :         {
      50           0 :             if( !mpActivity )
      51           0 :                 return false;
      52             : 
      53           0 :             return mrActivityQueue.addActivity( mpActivity );
      54             :         }
      55             : 
      56           0 :         bool WakeupEvent::isCharged() const
      57             :         {
      58             :             // this event won't expire, we fire every time we're
      59             :             // re-inserted into the event queue.
      60           0 :             return true;
      61             :         }
      62             : 
      63           0 :         double WakeupEvent::getActivationTime( double nCurrentTime ) const
      64             :         {
      65           0 :             const double nElapsedTime( maTimer.getElapsedTime() );
      66             : 
      67             :             return ::std::max( nCurrentTime,
      68           0 :                                nCurrentTime - nElapsedTime + mnNextTime );
      69             :         }
      70             : 
      71           0 :         void WakeupEvent::start()
      72             :         {
      73             :             // start timer
      74           0 :             maTimer.reset();
      75           0 :         }
      76             : 
      77           0 :         void WakeupEvent::setNextTimeout( double rNextTime )
      78             :         {
      79           0 :             mnNextTime = rNextTime;
      80           0 :         }
      81             : 
      82           0 :         void WakeupEvent::setActivity( const ActivitySharedPtr& rActivity )
      83             :         {
      84           0 :             mpActivity = rActivity;
      85           0 :         }
      86             :     }
      87           6 : }
      88             : 
      89             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10