| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef BASE_SCOPED_NATIVE_LIBRARY_H_ | 5 #ifndef BASE_SCOPED_NATIVE_LIBRARY_H_ | 
| 6 #define BASE_SCOPED_NATIVE_LIBRARY_H_ | 6 #define BASE_SCOPED_NATIVE_LIBRARY_H_ | 
| 7 | 7 | 
| 8 #include "base/base_export.h" | 8 #include "base/base_export.h" | 
| 9 #include "base/native_library.h" | 9 #include "base/native_library.h" | 
| 10 | 10 | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 24   explicit ScopedNativeLibrary(NativeLibrary library); | 24   explicit ScopedNativeLibrary(NativeLibrary library); | 
| 25 | 25 | 
| 26   // Opens the given library and manages its lifetime. | 26   // Opens the given library and manages its lifetime. | 
| 27   explicit ScopedNativeLibrary(const FilePath& library_path); | 27   explicit ScopedNativeLibrary(const FilePath& library_path); | 
| 28 | 28 | 
| 29   ~ScopedNativeLibrary(); | 29   ~ScopedNativeLibrary(); | 
| 30 | 30 | 
| 31   // Returns true if there's a valid library loaded. | 31   // Returns true if there's a valid library loaded. | 
| 32   bool is_valid() const { return !!library_; } | 32   bool is_valid() const { return !!library_; } | 
| 33 | 33 | 
|  | 34   NativeLibrary get() const { return library_; } | 
|  | 35 | 
| 34   void* GetFunctionPointer(const char* function_name) const; | 36   void* GetFunctionPointer(const char* function_name) const; | 
| 35 | 37 | 
| 36   // Takes ownership of the given library handle. Any existing handle will | 38   // Takes ownership of the given library handle. Any existing handle will | 
| 37   // be freed. | 39   // be freed. | 
| 38   void Reset(NativeLibrary library); | 40   void Reset(NativeLibrary library); | 
| 39 | 41 | 
| 40   // Returns the native library handle and removes it from this object. The | 42   // Returns the native library handle and removes it from this object. The | 
| 41   // caller must manage the lifetime of the handle. | 43   // caller must manage the lifetime of the handle. | 
| 42   NativeLibrary Release(); | 44   NativeLibrary Release(); | 
| 43 | 45 | 
| 44  private: | 46  private: | 
| 45   NativeLibrary library_; | 47   NativeLibrary library_; | 
| 46 | 48 | 
| 47   DISALLOW_COPY_AND_ASSIGN(ScopedNativeLibrary); | 49   DISALLOW_COPY_AND_ASSIGN(ScopedNativeLibrary); | 
| 48 }; | 50 }; | 
| 49 | 51 | 
| 50 }  // namespace base | 52 }  // namespace base | 
| 51 | 53 | 
| 52 #endif  // BASE_SCOPED_NATIVE_LIBRARY_H_ | 54 #endif  // BASE_SCOPED_NATIVE_LIBRARY_H_ | 
| OLD | NEW | 
|---|