LCOV - code coverage report
Current view: top level - ipc/chromium/src/base - thread_local_storage_posix.cc (source / functions) Hit Total Coverage
Test: output.info Lines: 0 28 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 5 0.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             : // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
       4             : // Use of this source code is governed by a BSD-style license that can be
       5             : // found in the LICENSE file.
       6             : 
       7             : #include "base/thread_local_storage.h"
       8             : 
       9             : #include "base/logging.h"
      10             : 
      11           0 : ThreadLocalStorage::Slot::Slot(TLSDestructorFunc destructor)
      12           0 :     : initialized_(false) {
      13           0 :   Initialize(destructor);
      14           0 : }
      15             : 
      16           0 : bool ThreadLocalStorage::Slot::Initialize(TLSDestructorFunc destructor) {
      17           0 :   DCHECK(!initialized_);
      18           0 :   int error = pthread_key_create(&key_, destructor);
      19           0 :   if (error) {
      20           0 :     NOTREACHED();
      21           0 :     return false;
      22             :   }
      23             : 
      24           0 :   initialized_ = true;
      25           0 :   return true;
      26             : }
      27             : 
      28           0 : void ThreadLocalStorage::Slot::Free() {
      29           0 :   DCHECK(initialized_);
      30           0 :   int error = pthread_key_delete(key_);
      31           0 :   if (error)
      32           0 :     NOTREACHED();
      33           0 :   initialized_ = false;
      34           0 : }
      35             : 
      36           0 : void* ThreadLocalStorage::Slot::Get() const {
      37           0 :   DCHECK(initialized_);
      38           0 :   return pthread_getspecific(key_);
      39             : }
      40             : 
      41           0 : void ThreadLocalStorage::Slot::Set(void* value) {
      42           0 :   DCHECK(initialized_);
      43           0 :   int error = pthread_setspecific(key_, value);
      44           0 :   if (error)
      45           0 :     NOTREACHED();
      46           0 : }

Generated by: LCOV version 1.13