diff options
author | wjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-24 18:54:11 +0000 |
---|---|---|
committer | wjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-24 18:54:11 +0000 |
commit | 51d173f6bfe575e36729ac7e5671db31acfd0978 (patch) | |
tree | b9fb4e53eea0ccf0516c085aab2f28a0d6d4d3d8 /third_party | |
parent | 3df79f4277938356ae3c7b3ecc25ab6165e8a899 (diff) | |
download | chromium_src-51d173f6bfe575e36729ac7e5671db31acfd0978.zip chromium_src-51d173f6bfe575e36729ac7e5671db31acfd0978.tar.gz chromium_src-51d173f6bfe575e36729ac7e5671db31acfd0978.tar.bz2 |
Support using loadable module for libpeerconnection on Android.
Borrowed create_standalone_apk_action.gypi, create_standalone_apk.py and finalize_apk_action.gypi from https://codereview.chromium.org/14843017/ with some minor fix in create_standalone_apk_action.gypi.
For some cases where libpeerconnection needs to be a loadable module, we need to add libpeerconnection.so into Chrome_apk.
This patch takes 2 steps:
1. build chrome with libpeer_target_type=loadable_module.
2. add libpeerconnection.so into the apk file.
TEST=run gyp: GYP_DEFINES="$GYP_DEFINES libpeer_target_type=loadable_module" build/gyp_chromium
build chrome
re-run gyp: GYP_DEFINES="$GYP_DEFINES libpeer_target_type=loadable_module" CHROMIUM_GYP_FILE="build/android/chrome_with_libs.gyp" build/gyp_chromium
build chrome_with_libs
install Chrome-with-libs.apk and it works for https://apprtc.appspot.com
R=cjhopman@chromium.org, mallinath@chromium.org, tommi@chromium.org
Review URL: https://codereview.chromium.org/17569006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208246 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
7 files changed, 18 insertions, 15 deletions
diff --git a/third_party/libjingle/libjingle.gyp b/third_party/libjingle/libjingle.gyp index 6bd91ba..45d5fd9 100644 --- a/third_party/libjingle/libjingle.gyp +++ b/third_party/libjingle/libjingle.gyp @@ -898,13 +898,12 @@ 'libjingle_webrtc_common', ], 'conditions': [ - ['libpeer_allocator_shim==1 and ' - 'libpeer_target_type!="static_library"', { + ['libpeer_target_type!="static_library"', { 'sources': [ 'overrides/initialize_module.cc', ], 'conditions': [ - ['OS!="mac"', { + ['OS!="mac" and OS!="android"', { 'sources': [ 'overrides/allocator_shim/allocator_proxy.cc', ], @@ -936,7 +935,7 @@ ['OS=="mac" and libpeer_target_type!="static_library"', { 'product_name': 'libpeerconnection', }], - ['OS=="android"', { + ['OS=="android" and "<(libpeer_target_type)"=="static_library"', { 'standalone_static_library': 1, }], ['OS=="linux" and libpeer_target_type!="static_library"', { diff --git a/third_party/libjingle/overrides/allocator_shim/allocator_proxy.cc b/third_party/libjingle/overrides/allocator_shim/allocator_proxy.cc index d3f24e0..515cad4 100644 --- a/third_party/libjingle/overrides/allocator_shim/allocator_proxy.cc +++ b/third_party/libjingle/overrides/allocator_shim/allocator_proxy.cc @@ -8,8 +8,8 @@ #error "Only compile the allocator proxy with the shared_library implementation" #endif -#if defined(OS_MACOSX) -#error "The allocator proxy isn't supported (or needed) on mac." +#if defined(OS_MACOSX) || defined(OS_ANDROID) +#error "The allocator proxy isn't supported (or needed) on mac or android." #endif extern AllocateFunction g_alloc; diff --git a/third_party/libjingle/overrides/allocator_shim/allocator_stub.cc b/third_party/libjingle/overrides/allocator_shim/allocator_stub.cc index 28ea658..77caee4 100644 --- a/third_party/libjingle/overrides/allocator_shim/allocator_stub.cc +++ b/third_party/libjingle/overrides/allocator_shim/allocator_stub.cc @@ -4,8 +4,8 @@ #include "allocator_shim/allocator_stub.h" -#if defined(OS_MACOSX) -#error "The allocator stub isn't supported (or needed) on mac." +#if defined(OS_MACOSX) || defined(OS_ANDROID) +#error "The allocator stub isn't supported (or needed) on mac or android." #endif void* Allocate(std::size_t n) { diff --git a/third_party/libjingle/overrides/allocator_shim/allocator_stub.h b/third_party/libjingle/overrides/allocator_shim/allocator_stub.h index 9e0fc2f..20b9c7d 100644 --- a/third_party/libjingle/overrides/allocator_shim/allocator_stub.h +++ b/third_party/libjingle/overrides/allocator_shim/allocator_stub.h @@ -9,7 +9,7 @@ #include "base/basictypes.h" -#if !defined(OS_MACOSX) +#if !defined(OS_MACOSX) && !defined(OS_ANDROID) typedef void* (*AllocateFunction)(std::size_t); typedef void (*DellocateFunction)(void*); @@ -19,6 +19,6 @@ typedef void (*DellocateFunction)(void*); void* Allocate(std::size_t n); void Dellocate(void* p); -#endif // OS_MACOSX +#endif // OS_MACOSX && OS_ANDROID #endif // THIRD_PARTY_LIBJINGLE_OVERRIDES_ALLOCATOR_SHIM_ALLOCATOR_STUB_H_ diff --git a/third_party/libjingle/overrides/init_webrtc.cc b/third_party/libjingle/overrides/init_webrtc.cc index ba28478..5436345 100644 --- a/third_party/libjingle/overrides/init_webrtc.cc +++ b/third_party/libjingle/overrides/init_webrtc.cc @@ -61,6 +61,10 @@ static base::FilePath GetLibPeerConnectionPath() { CHECK(PathService::Get(base::DIR_MODULE, &path)); path = path.Append(FILE_PATH_LITERAL("Libraries")) .Append(FILE_PATH_LITERAL("libpeerconnection.so")); +#elif defined(OS_ANDROID) + base::FilePath path; + CHECK(PathService::Get(base::DIR_MODULE, &path)); + path = path.Append(FILE_PATH_LITERAL("libpeerconnection.so")); #else base::FilePath path; CHECK(PathService::Get(base::DIR_MODULE, &path)); @@ -94,7 +98,7 @@ bool InitializeWebRtcModule() { // PS: This function is actually implemented in allocator_proxy.cc with the // new/delete overrides. return initialize_module(*CommandLine::ForCurrentProcess(), -#if !defined(OS_MACOSX) +#if !defined(OS_MACOSX) && !defined(OS_ANDROID) &Allocate, &Dellocate, #endif logging::GetLogMessageHandler(), diff --git a/third_party/libjingle/overrides/init_webrtc.h b/third_party/libjingle/overrides/init_webrtc.h index 78fb4de..e277783 100644 --- a/third_party/libjingle/overrides/init_webrtc.h +++ b/third_party/libjingle/overrides/init_webrtc.h @@ -40,7 +40,7 @@ typedef void (*DestroyWebRtcMediaEngineFunction)( // to go through GetProcAddress et al and rely on specific name mangling. typedef bool (*InitializeModuleFunction)( const CommandLine& command_line, -#if !defined(OS_MACOSX) +#if !defined(OS_MACOSX) && !defined(OS_ANDROID) AllocateFunction alloc, DellocateFunction dealloc, #endif diff --git a/third_party/libjingle/overrides/initialize_module.cc b/third_party/libjingle/overrides/initialize_module.cc index c54ae56..a2528b8 100644 --- a/third_party/libjingle/overrides/initialize_module.cc +++ b/third_party/libjingle/overrides/initialize_module.cc @@ -20,7 +20,7 @@ #define ALLOC_EXPORT __attribute__((visibility("default"))) #endif -#if !defined(OS_MACOSX) +#if !defined(OS_MACOSX) && !defined(OS_ANDROID) // These are used by our new/delete overrides in // allocator_shim/allocator_proxy.cc AllocateFunction g_alloc = NULL; @@ -44,7 +44,7 @@ extern "C" { // Called from init_webrtc.cc. ALLOC_EXPORT bool InitializeModule(const CommandLine& command_line, -#if !defined(OS_MACOSX) +#if !defined(OS_MACOSX) && !defined(OS_ANDROID) AllocateFunction alloc, DellocateFunction dealloc, #endif @@ -53,7 +53,7 @@ bool InitializeModule(const CommandLine& command_line, webrtc::AddTraceEventPtr trace_add_trace_event, CreateWebRtcMediaEngineFunction* create_media_engine, DestroyWebRtcMediaEngineFunction* destroy_media_engine) { -#if !defined(OS_MACOSX) +#if !defined(OS_MACOSX) && !defined(OS_ANDROID) g_alloc = alloc; g_dealloc = dealloc; #endif |