LCOV - code coverage report
Current view: directory - ipc/chromium/src/base - thread_local_storage_posix.cc (source / functions) Found Hit Coverage
Test: app.info Lines: 28 0 0.0 %
Date: 2012-06-02 Functions: 5 0 0.0 %

       1                 : // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
       2                 : // Use of this source code is governed by a BSD-style license that can be
       3                 : // found in the LICENSE file.
       4                 : 
       5                 : #include "base/thread_local_storage.h"
       6                 : 
       7                 : #include "base/logging.h"
       8                 : 
       9               0 : ThreadLocalStorage::Slot::Slot(TLSDestructorFunc destructor)
      10               0 :     : initialized_(false) {
      11               0 :   Initialize(destructor);
      12               0 : }
      13                 : 
      14               0 : bool ThreadLocalStorage::Slot::Initialize(TLSDestructorFunc destructor) {
      15               0 :   DCHECK(!initialized_);
      16               0 :   int error = pthread_key_create(&key_, destructor);
      17               0 :   if (error) {
      18               0 :     NOTREACHED();
      19               0 :     return false;
      20                 :   }
      21                 : 
      22               0 :   initialized_ = true;
      23               0 :   return true;
      24                 : }
      25                 : 
      26               0 : void ThreadLocalStorage::Slot::Free() {
      27               0 :   DCHECK(initialized_);
      28               0 :   int error = pthread_key_delete(key_);
      29               0 :   if (error)
      30               0 :     NOTREACHED();
      31               0 :   initialized_ = false;
      32               0 : }
      33                 : 
      34               0 : void* ThreadLocalStorage::Slot::Get() const {
      35               0 :   DCHECK(initialized_);
      36               0 :   return pthread_getspecific(key_);
      37                 : }
      38                 : 
      39               0 : void ThreadLocalStorage::Slot::Set(void* value) {
      40               0 :   DCHECK(initialized_);
      41               0 :   int error = pthread_setspecific(key_, value);
      42               0 :   if (error)
      43               0 :     NOTREACHED();
      44               0 : }

Generated by: LCOV version 1.7