summaryrefslogtreecommitdiffstats
path: root/base/scoped_native_library.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-10 01:16:11 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-10 01:16:11 +0000
commit709a847ee12e1380df59db8cd3c972ec4f9c674e (patch)
tree48217fd87c7e1fe15afdd90db26a925f7db28a1b /base/scoped_native_library.cc
parentf30e74751217091c0b6050080f46cd6eb4914226 (diff)
downloadchromium_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.cc')
-rw-r--r--base/scoped_native_library.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/base/scoped_native_library.cc b/base/scoped_native_library.cc
new file mode 100644
index 0000000..9d34449
--- /dev/null
+++ b/base/scoped_native_library.cc
@@ -0,0 +1,44 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/scoped_native_library.h"
+
+namespace base {
+
+ScopedNativeLibrary::ScopedNativeLibrary() : library_(NULL) {
+}
+
+ScopedNativeLibrary::ScopedNativeLibrary(NativeLibrary library)
+ : library_(library) {
+}
+
+ScopedNativeLibrary::ScopedNativeLibrary(const FilePath& library_path) {
+ library_ = base::LoadNativeLibrary(library_path);
+}
+
+ScopedNativeLibrary::~ScopedNativeLibrary() {
+ if (library_)
+ base::UnloadNativeLibrary(library_);
+}
+
+void* ScopedNativeLibrary::GetFunctionPointer(
+ const char* function_name) const {
+ if (!library_)
+ return NULL;
+ return base::GetFunctionPointerFromNativeLibrary(library_, function_name);
+}
+
+void ScopedNativeLibrary::Reset(NativeLibrary library) {
+ if (library_)
+ base::UnloadNativeLibrary(library_);
+ library_ = library;
+}
+
+NativeLibrary ScopedNativeLibrary::Release() {
+ NativeLibrary result = library_;
+ library_ = NULL;
+ return result;
+}
+
+} // namespace base