// 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_
// TODO(rvargas): remove this with the rest of the verifier. #ifdefined(COMPILER_MSVC) #include <intrin.h> #define BASE_WIN_GET_CALLER _ReturnAddress() #elifdefined(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;
_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());
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
¤ Dauer der Verarbeitung: 0.24 Sekunden
(vorverarbeitet)
¤
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.