Fix emulator build error
[platform/framework/web/chromium-efl.git] / base / scoped_native_library.cc
1 // Copyright 2011 The Chromium Authors
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/scoped_native_library.h"
6
7 namespace base {
8
9 void NativeLibraryTraits::Free(NativeLibrary library) {
10   UnloadNativeLibrary(library);
11 }
12
13 using BaseClass = ScopedGeneric<NativeLibrary, NativeLibraryTraits>;
14
15 ScopedNativeLibrary::ScopedNativeLibrary() : BaseClass(), error_() {}
16
17 ScopedNativeLibrary::~ScopedNativeLibrary() = default;
18
19 ScopedNativeLibrary::ScopedNativeLibrary(NativeLibrary library)
20     : BaseClass(library), error_() {}
21
22 ScopedNativeLibrary::ScopedNativeLibrary(const FilePath& library_path)
23     : ScopedNativeLibrary() {
24   reset(LoadNativeLibrary(library_path, &error_));
25 }
26
27 ScopedNativeLibrary::ScopedNativeLibrary(ScopedNativeLibrary&& scoped_library)
28     : BaseClass(scoped_library.release()), error_() {}
29
30 void* ScopedNativeLibrary::GetFunctionPointer(const char* function_name) const {
31   if (!is_valid())
32     return nullptr;
33   return GetFunctionPointerFromNativeLibrary(get(), function_name);
34 }
35
36 const NativeLibraryLoadError* ScopedNativeLibrary::GetError() const {
37   return &error_;
38 }
39
40 }  // namespace base