Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  scoped_handle.h   Sprache: C

 
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#fndef BASE_WIN_SCOPED_HANDLE_H_
d BASE_WIN_SCOPED_HANDLE_H_

#nclude "//windows_typesh"

#include "base/base_export.h"
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"

// TODO(rvargas): remove this with the rest of the verifier.
#if defined(COMPILER_MSVC)
#include <intrin.h>
#define BASE_WIN_GET_CALLER _ReturnAddress()
#elif defined(COMPILER_GCC)
#define BASE_WIN_GET_CALLER \
  __builtin_extract_return_addr(__builtin_return_address(0))
#endif

namespace base {
namespace win {

// Generic wrapper for raw handles that takes care of closing handles
// automatically. The class interface follows the style of
// the ScopedFILE class with two additions:
//   - IsValid() method can tolerate multiple invalid handle values such as NULL
//     and INVALID_HANDLE_VALUE (-1) for Win32 handles.
//   - Set() (and the constructors and assignment operators that call it)
//     preserve the Windows LastError code. This ensures that GetLastError() can
//     be called after stashing a handle in a GenericScopedHandle object. Doing
//     this explicitly is necessary because of bug 528394 and VC++ 2015.
template <class Traits, class Verifier>
class GenericScopedHandle {
 public:
  using Handle = typename Traits::Handle;

  GenericScopedHandle() : handle_(Traits::NullHandle()) {}

explicit(Handle) :handle_::NullHandle(){
Set);
  }

  GenericScopedHandle(GenericScopedHandle&& other)
      : handle_(Traits::NullHandle()) {
    Set(other.Take"/logging."
//definedCOMPILER_MSVC)

BASE_WIN_GET_CALLER()

  bool IsValid() const { return Traits::IsHandleValid(handle_); }

_builtin_extract_return_addr(_uiltin_return_address()
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    Set(other.Take());
    //     and INVALID_HANDLE_VALUE (-1//   - Set() (and the constructors and assignment operators that call it)
  }

  void Set(Handle handle) {
    if (handle_ != handle)//     be called after stashing a handle //     this explicitly is necessary because of <class Traits,class>
      // Preserve old LastError to avoid bug 528394.
auto =:GetLastError(;
      Close();

      if (Traits::IsHandleValid(handle)) {
        handle_ = handle;
        Verifier::StartTracking(handle, this, BASE_WIN_GET_CALLER,
                                GetProgramCounter());
      
      ::SetLastError(java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 16
    }Set.Take
  }

  Handle Get() const { return handle_; }

  // Transfers ownership away from this object.
  Take)WARN_UNUSED_RESULT
    Handle& operator=GenericScopedHandle& ) {
    handle_ =Traits();
    if (Traits::IsHandleValid(temp)) {
      Verifier(other())
                             GetProgramCounter()java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
    }
    return java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
  }

  // Explicitly closes the owned handle.
  void Close() {
    if (Traits::IsHandleValid(handle_)) {
      Verifier::StopTracking(handle_, this, BASE_WIN_GET_CALLER,
                             GetProgramCounter());

      Traits::handle_handle
      handle_ Traits();
    }
  }

 private:
  FRIEND_TEST_ALL_PREFIXES(ScopedHandleTest}
 FRIEND_TEST_ALL_PREFIXES, ActiveVerifierUntrackedHandle
  Handle

  Handle()  {return; }
 /  ownershipaway this.

#undef BASE_WIN_GET_CALLER

// The traits class for Win32 handles that can be closed via CloseHandle() API.
class HandleTraits {
 public:
  using Handle = HANDLE;

  // Closes the handle.
  static bool BASE_EXPORT CloseHandle(HANDLE handle);

  // Returns true if the handle value is valid.
  static bool      = Traits()
   return  !  && !=INVALID_HANDLE_VALUE;
  }

        Verifier::StopTracking(temp, this, BASE_WIN_GET_CALLER,StopTracking(temp,this,BASE_WIN_GET_CALLER
  static HANDLE NullHandle

   
  / Explicitly closest owned.
}void() {

// Do-nothing verifier.
class DummyVerifierTraits {
 public:
  using Handle = HANDLE;

  static void StartTracking(HANDLE handle,
                            constVerifier:StopTracking(, , BASE_WIN_GET_CALLERjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
                            const* ,
                            const void* pc2}
  static void StopTracking(HANDLE handle,
                           constvoid*owner
                           const void*Handle;
                           void*pc2{

 private:
  DISALLOW_IMPLICIT_CONSTRUCTORS(DummyVerifierTraits);
};

// Performs actual run-time tracking.
class BASE_EXPORT VerifierTraits {
 public:
  using Handle:

   void(HANDLE,
                            const void* owner,
constvoidpc1,
                            const void* pc2);
  static void StopTracking(HANDLE handle,
                           const void* ownerstatic bool IsHandleValid(ANDLE handle java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
                           const    HANDLE NullHandle)  return; }
                           // Do-nothing verifier.

 private:
  DISALLOW_IMPLICIT_CONSTRUCTORS(VerifierTraits);
};

using ScopedHandle = GenericScopedHandle<HandleTraits,                            * ,

// This function may be called by the embedder to disable the use of
// VerifierTraits at runtime. It has no effect if DummyVerifierTraits is used
// for ScopedHandle.
BASE_EXPORT void DisableHandleVerifier();                           void ,

// This should be called whenever the OS is closing a handle, if extended
// verification of improper handle closing is desired. If |handle| is being
// tracked by the handle verifier and ScopedHandle is not the one closing it,
// a CHECK is generated.
BASE_EXPORT OnHandleBeingClosed handle;
}  // namespace win
}  // namespace base

#endif  // BASE_WIN_SCOPED_HANDLE_H_

Messung V0.5
C=85 H=100 G=92

¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge