Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: base/scoped_native_library.h

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/scoped_generic_unittest.cc ('k') | base/scoped_native_library.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BASE_SCOPED_NATIVE_LIBRARY_H_
6 #define BASE_SCOPED_NATIVE_LIBRARY_H_
7
8 #include "base/base_export.h"
9 #include "base/native_library.h"
10
11 namespace base {
12
13 class FilePath;
14
15 // A class which encapsulates a base::NativeLibrary object available only in a
16 // scope.
17 // This class automatically unloads the loaded library in its destructor.
18 class BASE_EXPORT ScopedNativeLibrary {
19 public:
20 // Initializes with a NULL library.
21 ScopedNativeLibrary();
22
23 // Takes ownership of the given library handle.
24 explicit ScopedNativeLibrary(NativeLibrary library);
25
26 // Opens the given library and manages its lifetime.
27 explicit ScopedNativeLibrary(const FilePath& library_path);
28
29 ~ScopedNativeLibrary();
30
31 // Returns true if there's a valid library loaded.
32 bool is_valid() const { return !!library_; }
33
34 void* GetFunctionPointer(const char* function_name) const;
35
36 // Takes ownership of the given library handle. Any existing handle will
37 // be freed.
38 void Reset(NativeLibrary library);
39
40 // Returns the native library handle and removes it from this object. The
41 // caller must manage the lifetime of the handle.
42 NativeLibrary Release();
43
44 private:
45 NativeLibrary library_;
46
47 DISALLOW_COPY_AND_ASSIGN(ScopedNativeLibrary);
48 };
49
50 } // namespace base
51
52 #endif // BASE_SCOPED_NATIVE_LIBRARY_H_
OLDNEW
« no previous file with comments | « base/scoped_generic_unittest.cc ('k') | base/scoped_native_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698