diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-10 01:16:11 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-10 01:16:11 +0000 |
commit | 709a847ee12e1380df59db8cd3c972ec4f9c674e (patch) | |
tree | 48217fd87c7e1fe15afdd90db26a925f7db28a1b /base/scoped_native_library.h | |
parent | f30e74751217091c0b6050080f46cd6eb4914226 (diff) | |
download | chromium_src-709a847ee12e1380df59db8cd3c972ec4f9c674e.zip chromium_src-709a847ee12e1380df59db8cd3c972ec4f9c674e.tar.gz chromium_src-709a847ee12e1380df59db8cd3c972ec4f9c674e.tar.bz2 |
Implement a new process type for running PPAPI plugins. The process itself is
quite simple and just sets up the PPAPI dispatcher and loads the library.
There is a new command line switch --ppapi-out-of-process which runs PPAPI
plugins out of process using the new code path. There is some logic in
RenderView and PepperPluginModule for setting up this connection, but it should
be straightforward.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/3915002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65614 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/scoped_native_library.h')
-rw-r--r-- | base/scoped_native_library.h | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/base/scoped_native_library.h b/base/scoped_native_library.h index bed5c39..28b29b3 100644 --- a/base/scoped_native_library.h +++ b/base/scoped_native_library.h @@ -17,23 +17,33 @@ namespace base { // This class automatically unloads the loaded library in its destructor. class ScopedNativeLibrary { public: - explicit ScopedNativeLibrary(const FilePath& library_path) { - library_ = base::LoadNativeLibrary(library_path); - } + // Initializes with a NULL library. + ScopedNativeLibrary(); - ~ScopedNativeLibrary() { - if (library_) - base::UnloadNativeLibrary(library_); - } + // Takes ownership of the given library handle. + explicit ScopedNativeLibrary(NativeLibrary library); - void* GetFunctionPointer(const char* function_name) { - if (!library_) - return NULL; - return base::GetFunctionPointerFromNativeLibrary(library_, function_name); - } + // Opens the given library and manages its lifetime. + explicit ScopedNativeLibrary(const FilePath& library_path); + + ~ScopedNativeLibrary(); + + // Returns true if there's a valid library loaded. + bool is_valid() const { return !!library_; } + + void* GetFunctionPointer(const char* function_name) const; + + // Takes ownership of the given library handle. Any existing handle will + // be freed. + void Reset(NativeLibrary library); + + // Returns the native library handle and removes it from this object. The + // caller must manage the lifetime of the handle. + NativeLibrary Release(); private: - base::NativeLibrary library_; + NativeLibrary library_; + DISALLOW_COPY_AND_ASSIGN(ScopedNativeLibrary); }; |