LCOV - code coverage report
Current view: top level - dom/time - DateCacheCleaner.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 10 17 58.8 %
Date: 2017-07-14 16:53:18 Functions: 2 5 40.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
       5             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "DateCacheCleaner.h"
       8             : 
       9             : #include "js/Date.h"
      10             : #include "mozilla/dom/ScriptSettings.h"
      11             : #include "mozilla/ClearOnShutdown.h"
      12             : #include "mozilla/Hal.h"
      13             : #include "mozilla/StaticPtr.h"
      14             : 
      15             : using namespace mozilla::hal;
      16             : 
      17             : namespace mozilla {
      18             : namespace dom {
      19             : namespace time {
      20             : 
      21             : class DateCacheCleaner : public SystemTimezoneChangeObserver
      22             : {
      23             : public:
      24           3 :   DateCacheCleaner()
      25           3 :   {
      26           3 :     RegisterSystemTimezoneChangeObserver(this);
      27           3 :   }
      28             : 
      29           0 :   ~DateCacheCleaner()
      30           0 :   {
      31           0 :     UnregisterSystemTimezoneChangeObserver(this);
      32           0 :   }
      33           0 :   void Notify(const SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo)
      34             :   {
      35           0 :     JS::ResetTimeZone();
      36           0 :   }
      37             : 
      38             : };
      39             : 
      40           3 : StaticAutoPtr<DateCacheCleaner> sDateCacheCleaner;
      41             : 
      42             : void
      43           3 : InitializeDateCacheCleaner()
      44             : {
      45           3 :   if (!sDateCacheCleaner) {
      46           3 :     sDateCacheCleaner = new DateCacheCleaner();
      47           3 :     ClearOnShutdown(&sDateCacheCleaner);
      48             :   }
      49           3 : }
      50             : 
      51             : } // namespace time
      52             : } // namespace dom
      53             : } // namespace mozilla

Generated by: LCOV version 1.13