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

Side by Side Diff: base/memory/scoped_native_library.h

Issue 7048007: Move scoped_temp_dir and scoped_native_library back from base/memory to base. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unknwn Created 9 years, 7 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/files/file_path_watcher_browsertest.cc ('k') | base/memory/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_MEMORY_SCOPED_NATIVE_LIBRARY_H_
6 #define BASE_MEMORY_SCOPED_NATIVE_LIBRARY_H_
7 #pragma once
8
9 #include "base/base_api.h"
10 #include "base/native_library.h"
11
12 class FilePath;
13
14 namespace base {
15
16 // A class which encapsulates a base::NativeLibrary object available only in a
17 // scope.
18 // This class automatically unloads the loaded library in its destructor.
19 class BASE_API ScopedNativeLibrary {
20 public:
21 // Initializes with a NULL library.
22 ScopedNativeLibrary();
23
24 // Takes ownership of the given library handle.
25 explicit ScopedNativeLibrary(NativeLibrary library);
26
27 // Opens the given library and manages its lifetime.
28 explicit ScopedNativeLibrary(const FilePath& library_path);
29
30 ~ScopedNativeLibrary();
31
32 // Returns true if there's a valid library loaded.
33 bool is_valid() const { return !!library_; }
34
35 void* GetFunctionPointer(const char* function_name) const;
36
37 // Takes ownership of the given library handle. Any existing handle will
38 // be freed.
39 void Reset(NativeLibrary library);
40
41 // Returns the native library handle and removes it from this object. The
42 // caller must manage the lifetime of the handle.
43 NativeLibrary Release();
44
45 private:
46 NativeLibrary library_;
47
48 DISALLOW_COPY_AND_ASSIGN(ScopedNativeLibrary);
49 };
50
51 } // namespace base
52
53 #endif // BASE_MEMORY_SCOPED_NATIVE_LIBRARY_H_
OLDNEW
« no previous file with comments | « base/files/file_path_watcher_browsertest.cc ('k') | base/memory/scoped_native_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698