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

Unified Diff: third_party/libjingle/overrides/init_webrtc.cc

Issue 14907003: Build libpeerconnection as a loadable module for win, mac and linux by default. Also remove the all… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add support for loading the .so from the build layout. Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/libjingle/libjingle.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libjingle/overrides/init_webrtc.cc
diff --git a/third_party/libjingle/overrides/init_webrtc.cc b/third_party/libjingle/overrides/init_webrtc.cc
index c73b2702cd94ec2e0ca0970d1faa41078f2b6ad7..13765468a3cd7b83ce58516a5f5354b24996d802 100644
--- a/third_party/libjingle/overrides/init_webrtc.cc
+++ b/third_party/libjingle/overrides/init_webrtc.cc
@@ -51,6 +51,21 @@ static base::FilePath GetLibPeerConnectionPath() {
return path;
}
+#if !defined(OS_WIN)
+// On platforms other than Windows (i.e. mac and linux based ones),
+// the location of the .so in the installed layout will be different relative
+// to the loading module than it is in the build directory.
+// GetLibPeerConnectionPath returns the path as it will be in the installed
+// layout, but to support isolated tests, we need to also support loading the
+// so in the build layout, which we do here.
+// On Windows, these layouts are the same.
+static base::FilePath GetLibPeerConnectionPathForTests() {
+ base::FilePath path;
+ CHECK(PathService::Get(base::DIR_MODULE, &path));
+ return path.Append(FILE_PATH_LITERAL("libpeerconnection.so"));
+}
+#endif
+
bool InitializeWebRtcModule() {
if (g_create_webrtc_media_engine)
return true; // InitializeWebRtcModule has already been called.
@@ -61,6 +76,10 @@ bool InitializeWebRtcModule() {
std::string error;
static base::NativeLibrary lib =
base::LoadNativeLibrary(path, &error);
+#if !defined(OS_WIN)
+ if (!lib)
+ lib = base::LoadNativeLibrary(GetLibPeerConnectionPathForTests(), &error);
+#endif
CHECK(lib);
InitializeModuleFunction initialize_module =
« no previous file with comments | « third_party/libjingle/libjingle.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698