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

Side by Side Diff: base/scoped_native_library.h

Issue 303033: Implements AeroPeek of Windows 7.. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « base/scoped_handle_win.h ('k') | base/scoped_native_library_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 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/file_path.h"
9 #include "base/native_library.h"
10
11 namespace base {
12
13 // A class which encapsulates a base::NativeLibrary object available only in a
14 // scope.
15 // This class automatically unloads the loaded library in its destructor.
16 class ScopedNativeLibrary {
17 public:
18 explicit ScopedNativeLibrary(const FilePath& library_path) {
19 library_ = base::LoadNativeLibrary(library_path);
20 }
21
22 ~ScopedNativeLibrary() {
23 if (library_)
24 base::UnloadNativeLibrary(library_);
25 }
26
27 void* GetFunctionPointer(const char* function_name) {
28 if (!library_)
29 return NULL;
30 return base::GetFunctionPointerFromNativeLibrary(library_, function_name);
31 }
32
33 private:
34 base::NativeLibrary library_;
35 };
36
37 } // namespace base
38
39 #endif // BASE_SCOPED_NATIVE_LIBRARY_H_
OLDNEW
« no previous file with comments | « base/scoped_handle_win.h ('k') | base/scoped_native_library_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698