Compare commits
51
Commits
release
...
nsis-cleanup
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21743e0b7c | ||
|
|
c97a22776d | ||
|
|
c484dbcca5 | ||
|
|
54f15d7afe | ||
|
|
05441188be | ||
|
|
25a2d31be7 | ||
|
|
58a4e0d545 | ||
|
|
ad06b4ce5e | ||
|
|
be3827b088 | ||
|
|
a136aaf502 | ||
|
|
40d91a8eae | ||
|
|
5b81a81ac4 | ||
|
|
328ddb2927 | ||
|
|
06b9622302 | ||
|
|
1218649202 | ||
|
|
cbea8f5a53 | ||
|
|
f42e644486 | ||
|
|
a40490b946 | ||
|
|
ad98693f3d | ||
|
|
7b4aaca975 | ||
|
|
400e59a96d | ||
|
|
09276b72a6 | ||
|
|
ec18304362 | ||
|
|
4cf411f393 | ||
|
|
2b0935adf4 | ||
|
|
cbdc5fa85f | ||
|
|
2a06c40a09 | ||
|
|
f499e3dd36 | ||
|
|
48d21fa2bf | ||
|
|
c91c69272b | ||
|
|
91f4fa744e | ||
|
|
c2abd4aaa6 | ||
|
|
617ad84f96 | ||
|
|
33b6bfa1b9 | ||
|
|
4e03afd191 | ||
|
|
3512b73bc3 | ||
|
|
d0ac45cb08 | ||
|
|
ab3d950bd3 | ||
|
|
44ddd79356 | ||
|
|
054ddf661f | ||
|
|
da466a3bdd | ||
|
|
42f0c2d78f | ||
|
|
5853784a31 | ||
|
|
5b20295620 | ||
|
|
68e151c2a3 | ||
|
|
dd764a70a2 | ||
|
|
12defe0d12 | ||
|
|
8868dd5785 | ||
|
|
e787d585a4 | ||
|
|
5eb7518ce2 | ||
|
|
5be93da111 |
No files matched your search
@@ -43,8 +43,6 @@ gyp_vars.update({
|
||||
'arm_neon': 0,
|
||||
'arm_neon_optional': 1,
|
||||
|
||||
'moz_webrtc_omx': 0,
|
||||
'moz_webrtc_mediacodec': 0,
|
||||
|
||||
# Turn off multi monitor screen share
|
||||
'multi_monitor_screenshare%' : 0,
|
||||
|
||||
@@ -344,7 +344,7 @@ def split_triplet(triplet):
|
||||
if cpu.endswith('86') or (cpu.startswith('i') and '86' in cpu):
|
||||
canonical_cpu = 'x86'
|
||||
endianness = 'little'
|
||||
elif cpu in ('x86_64', 'ia64'):
|
||||
elif cpu == 'x86_64':
|
||||
canonical_cpu = cpu
|
||||
endianness = 'little'
|
||||
elif cpu in ('s390', 's390x'):
|
||||
|
||||
@@ -290,11 +290,6 @@ fi
|
||||
if [ -n "$LD_LIBRARY_PATH_64" ]; then
|
||||
LD_LIBRARY_PATH_64=${MOZ_DIST_BIN}:${MOZ_DIST_BIN}/plugins:${MRE_HOME}${LD_LIBRARY_PATH_64:+":$LD_LIBRARY_PATH_64"}
|
||||
fi
|
||||
#
|
||||
#
|
||||
## Set SHLIB_PATH for HPUX
|
||||
SHLIB_PATH=${MOZ_DIST_BIN}:${MRE_HOME}${SHLIB_PATH:+":$SHLIB_PATH"}
|
||||
#
|
||||
## Set LIBPATH for AIX
|
||||
LIBPATH=${MOZ_DIST_BIN}:${MRE_HOME}${LIBPATH:+":$LIBPATH"}
|
||||
#
|
||||
@@ -339,7 +334,6 @@ then
|
||||
fi
|
||||
echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH"
|
||||
echo " LIBRARY_PATH=$LIBRARY_PATH"
|
||||
echo " SHLIB_PATH=$SHLIB_PATH"
|
||||
echo " LIBPATH=$LIBPATH"
|
||||
echo " ADDON_PATH=$ADDON_PATH"
|
||||
echo " MOZ_PROGRAM=$MOZ_PROGRAM"
|
||||
@@ -350,7 +344,7 @@ then
|
||||
fi
|
||||
#
|
||||
export MOZILLA_FIVE_HOME LD_LIBRARY_PATH
|
||||
export SHLIB_PATH LIBPATH LIBRARY_PATH ADDON_PATH DYLD_LIBRARY_PATH
|
||||
export LIBPATH LIBRARY_PATH ADDON_PATH DYLD_LIBRARY_PATH
|
||||
|
||||
if [ $moz_debug -eq 1 ]
|
||||
then
|
||||
|
||||
@@ -448,7 +448,6 @@ gtk/gtkx.h
|
||||
gtk/gtkunixprint.h
|
||||
HIToolbox/HIToolbox.h
|
||||
hlink.h
|
||||
ia64/sys/inline.h
|
||||
Icons.h
|
||||
iconv.h
|
||||
ieeefp.h
|
||||
|
||||
@@ -105,8 +105,6 @@ gDownMixMatrices[CUSTOM_CHANNEL_LAYOUTS*(CUSTOM_CHANNEL_LAYOUTS - 1)/2] =
|
||||
* Given an array of input channels, downmix to aOutputChannelCount, and copy
|
||||
* the results to the channel buffers in aOutputChannels. Don't call this with
|
||||
* input count <= output count.
|
||||
* Each of aOutputChannels must be non-null.
|
||||
* aChannelArray elements may be null.
|
||||
*/
|
||||
template<typename T>
|
||||
void AudioChannelsDownMix(const nsTArray<const T*>& aChannelArray,
|
||||
@@ -121,11 +119,7 @@ void AudioChannelsDownMix(const nsTArray<const T*>& aChannelArray,
|
||||
if (inputChannelCount > 6) {
|
||||
// Just drop the unknown channels.
|
||||
for (uint32_t o = 0; o < aOutputChannelCount; ++o) {
|
||||
if (inputChannels[o]) {
|
||||
PodCopy(aOutputChannels[o], inputChannels[o], aDuration);
|
||||
} else {
|
||||
std::fill_n(aOutputChannels[o], aDuration, static_cast<T>(0));
|
||||
}
|
||||
PodCopy(aOutputChannels[o], inputChannels[o], aDuration);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -144,19 +138,13 @@ void AudioChannelsDownMix(const nsTArray<const T*>& aChannelArray,
|
||||
// want an input channel to contribute to nothing
|
||||
T outputChannels[CUSTOM_CHANNEL_LAYOUTS + 1] = {0};
|
||||
for (uint32_t c = 0; c < inputChannelCount; ++c) {
|
||||
if (inputChannels[c]) {
|
||||
outputChannels[m.mInputDestination[c]] +=
|
||||
m.mInputCoefficient[c] *
|
||||
(static_cast<const T*>(inputChannels[c]))[s];
|
||||
}
|
||||
outputChannels[m.mInputDestination[c]] +=
|
||||
m.mInputCoefficient[c]*(static_cast<const T*>(inputChannels[c]))[s];
|
||||
}
|
||||
// Utilize the fact that in every layout, C is the third channel.
|
||||
if (m.mCExtraDestination != IGNORE) {
|
||||
if (inputChannels[SURROUND_C]) {
|
||||
outputChannels[m.mCExtraDestination] +=
|
||||
m.mInputCoefficient[SURROUND_C] *
|
||||
(static_cast<const T*>(inputChannels[SURROUND_C]))[s];
|
||||
}
|
||||
outputChannels[m.mCExtraDestination] +=
|
||||
m.mInputCoefficient[SURROUND_C]*(static_cast<const T*>(inputChannels[SURROUND_C]))[s];
|
||||
}
|
||||
|
||||
for (uint32_t c = 0; c < aOutputChannelCount; ++c) {
|
||||
|
||||
@@ -121,19 +121,13 @@ AudioSegment::Mix(AudioMixer& aMixer, uint32_t aOutputChannels,
|
||||
}
|
||||
if (channelData.Length() < aOutputChannels) {
|
||||
// Up-mix.
|
||||
AudioChannelsUpMix(&channelData, aOutputChannels, static_cast<const AudioDataValue*>(nullptr));
|
||||
AudioChannelsUpMix(&channelData, aOutputChannels, SilentChannel::ZeroChannel<AudioDataValue>());
|
||||
for (uint32_t channel = 0; channel < aOutputChannels; channel++) {
|
||||
AudioDataValue* ptr =
|
||||
PointerForOffsetInChannel(buf.Elements(), outBufferLength,
|
||||
aOutputChannels, channel, offsetSamples);
|
||||
if (channelData[channel]) {
|
||||
PodCopy(
|
||||
ptr,
|
||||
reinterpret_cast<const AudioDataValue*>(channelData[channel]),
|
||||
frames);
|
||||
} else {
|
||||
PodZero(ptr, frames);
|
||||
}
|
||||
PodCopy(ptr, reinterpret_cast<const AudioDataValue*>(channelData[channel]),
|
||||
frames);
|
||||
}
|
||||
MOZ_ASSERT(channelData.Length() == aOutputChannels);
|
||||
} else if (channelData.Length() > aOutputChannels) {
|
||||
|
||||
@@ -61,22 +61,15 @@ template <typename SrcT, typename DestT>
|
||||
static void
|
||||
InterleaveAndConvertBuffer(const SrcT* const* aSourceChannels,
|
||||
uint32_t aLength, float aVolume,
|
||||
uint32_t aChannelCount,
|
||||
uint32_t aChannels,
|
||||
DestT* aOutput)
|
||||
{
|
||||
for (size_t channel = 0; channel < aChannelCount; ++channel) {
|
||||
DestT* output = aOutput;
|
||||
if (aSourceChannels[channel]) {
|
||||
for (size_t i = 0; i < aLength; ++i) {
|
||||
float v = AudioSampleToFloat(aSourceChannels[channel][i])*aVolume;
|
||||
*output = FloatToAudioSample<DestT>(v);
|
||||
output += aChannelCount;
|
||||
}
|
||||
} else {
|
||||
for (size_t i = 0; i < aLength; ++i) {
|
||||
*output = static_cast<DestT>(0);
|
||||
output += aChannelCount;
|
||||
}
|
||||
DestT* output = aOutput;
|
||||
for (size_t i = 0; i < aLength; ++i) {
|
||||
for (size_t channel = 0; channel < aChannels; ++channel) {
|
||||
float v = AudioSampleToFloat(aSourceChannels[channel][i])*aVolume;
|
||||
*output = FloatToAudioSample<DestT>(v);
|
||||
++output;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,7 +93,7 @@ DeinterleaveAndConvertBuffer(const SrcT* aSourceBuffer,
|
||||
class SilentChannel
|
||||
{
|
||||
public:
|
||||
static const int AUDIO_PROCESSING_FRAMES = 640; /* > 10ms of 48KHz audio */
|
||||
static const int AUDIO_PROCESSING_FRAMES = 4096; /* > 10ms of 48KHz audio */
|
||||
static const uint8_t gZeroChannel[MAX_AUDIO_SAMPLE_SIZE*AUDIO_PROCESSING_FRAMES];
|
||||
// We take advantage of the fact that zero in float and zero in int have the
|
||||
// same all-zeros bit layout.
|
||||
@@ -415,7 +408,7 @@ void WriteChunk(AudioChunk& aChunk,
|
||||
if (channelData.Length() < aOutputChannels) {
|
||||
// Up-mix. Note that this might actually make channelData have more
|
||||
// than aOutputChannels temporarily.
|
||||
AudioChannelsUpMix(&channelData, aOutputChannels, static_cast<const SrcT*>(nullptr));
|
||||
AudioChannelsUpMix(&channelData, aOutputChannels, SilentChannel::ZeroChannel<SrcT>());
|
||||
}
|
||||
if (channelData.Length() > aOutputChannels) {
|
||||
// Down-mix.
|
||||
|
||||
@@ -29,8 +29,7 @@ enum {
|
||||
* Abstract interface for managing audio and video devices. Each platform
|
||||
* must implement a concrete class that will map these classes and methods
|
||||
* to the appropriate backend. For example, on Desktop platforms, these will
|
||||
* correspond to equivalent webrtc (GIPS) calls, and on B2G they will map to
|
||||
* a Gonk interface.
|
||||
* correspond to equivalent webrtc (GIPS) calls.
|
||||
*/
|
||||
class MediaEngineVideoSource;
|
||||
class MediaEngineAudioSource;
|
||||
@@ -302,7 +301,6 @@ public:
|
||||
|
||||
/* If implementation of MediaEngineSource supports TakePhoto(), the picture
|
||||
* should be return via aCallback object. Otherwise, it returns NS_ERROR_NOT_IMPLEMENTED.
|
||||
* Currently, only Gonk MediaEngineSource implementation supports it.
|
||||
*/
|
||||
virtual nsresult TakePhoto(MediaEnginePhotoCallback* aCallback) = 0;
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ bool MediaEngineCameraVideoSource::AppendToTrack(SourceMediaStream* aSource,
|
||||
return aSource->AppendToTrack(aID, &(segment));
|
||||
}
|
||||
|
||||
// Sub-classes (B2G or desktop) should overload one of both of these two methods
|
||||
// to provide capabilities
|
||||
// Subclasses should overload one or both of these methods to provide
|
||||
// capabilities.
|
||||
size_t
|
||||
MediaEngineCameraVideoSource::NumCapabilities() const
|
||||
{
|
||||
@@ -324,21 +324,6 @@ MediaEngineCameraVideoSource::SetName(nsString aName)
|
||||
bool hasFacingMode = false;
|
||||
VideoFacingModeEnum facingMode = VideoFacingModeEnum::User;
|
||||
|
||||
// Set facing mode based on device name.
|
||||
#if defined(ANDROID)
|
||||
// Names are generated. Example: "Camera 0, Facing back, Orientation 90"
|
||||
//
|
||||
// See media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/
|
||||
// webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java
|
||||
|
||||
if (aName.Find(NS_LITERAL_STRING("Facing back")) != kNotFound) {
|
||||
hasFacingMode = true;
|
||||
facingMode = VideoFacingModeEnum::Environment;
|
||||
} else if (aName.Find(NS_LITERAL_STRING("Facing front")) != kNotFound) {
|
||||
hasFacingMode = true;
|
||||
facingMode = VideoFacingModeEnum::User;
|
||||
}
|
||||
#endif // ANDROID
|
||||
#ifdef XP_MACOSX
|
||||
// Kludge to test user-facing cameras on OSX.
|
||||
if (aName.Find(NS_LITERAL_STRING("Face")) != -1) {
|
||||
|
||||
@@ -108,7 +108,7 @@ protected:
|
||||
nsTArray<PrincipalHandle> mPrincipalHandles; // Directly mapped to mSources.
|
||||
RefPtr<layers::Image> mImage;
|
||||
RefPtr<layers::ImageContainer> mImageContainer;
|
||||
int mWidth, mHeight; // protected with mMonitor on Gonk due to different threading
|
||||
int mWidth, mHeight; // protected with mMonitor
|
||||
// end of data protected by mMonitor
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#ifdef FF
|
||||
#undef FF
|
||||
#endif
|
||||
#include "webrtc/modules/audio_device/opensl/single_rw_fifo.h"
|
||||
#include "SingleRwFifo.h"
|
||||
|
||||
#define CHANNELS 1
|
||||
#define ENCODING "L16"
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "SingleRwFifo.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
static int
|
||||
UpdatePos(int pos, int capacity)
|
||||
{
|
||||
return (pos + 1) % capacity;
|
||||
}
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
namespace subtle {
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
inline void
|
||||
MemoryBarrier()
|
||||
{
|
||||
::MemoryBarrier();
|
||||
}
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
inline void
|
||||
MemoryBarrier()
|
||||
{
|
||||
__sync_synchronize();
|
||||
}
|
||||
#else
|
||||
#error Add an implementation of MemoryBarrier() for this platform!
|
||||
#endif
|
||||
|
||||
} // namespace subtle
|
||||
|
||||
SingleRwFifo::SingleRwFifo(int capacity)
|
||||
: capacity_(capacity)
|
||||
, size_(0)
|
||||
, read_pos_(0)
|
||||
, write_pos_(0)
|
||||
{
|
||||
queue_.reset(new int8_t*[capacity_]);
|
||||
}
|
||||
|
||||
SingleRwFifo::~SingleRwFifo()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SingleRwFifo::Push(int8_t* mem)
|
||||
{
|
||||
assert(mem);
|
||||
|
||||
// Ensure that there is space for the new data in the FIFO. There is only one
|
||||
// writer, so the other thread is guaranteed only to decrease the size.
|
||||
const int free_slots = capacity() - size();
|
||||
if (free_slots <= 0) {
|
||||
// Size can be queried outside of Push. The caller is expected to ensure
|
||||
// that Push will be successful before calling it.
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
queue_[write_pos_] = mem;
|
||||
// Ensure that |size_| is updated after the stored pointer is visible.
|
||||
subtle::MemoryBarrier();
|
||||
++size_;
|
||||
write_pos_ = UpdatePos(write_pos_, capacity());
|
||||
}
|
||||
|
||||
int8_t*
|
||||
SingleRwFifo::Pop()
|
||||
{
|
||||
int8_t* ret_val = nullptr;
|
||||
if (size() <= 0) {
|
||||
// Size can be queried outside of Pop. The caller is expected to ensure
|
||||
// that Pop will be successful before calling it.
|
||||
assert(false);
|
||||
return ret_val;
|
||||
}
|
||||
ret_val = queue_[read_pos_];
|
||||
// Ensure that |size_| is updated after the stored pointer is read.
|
||||
subtle::MemoryBarrier();
|
||||
--size_;
|
||||
read_pos_ = UpdatePos(read_pos_, capacity());
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
+5
-8
@@ -8,8 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_SINGLE_RW_FIFO_H_
|
||||
#define WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_SINGLE_RW_FIFO_H_
|
||||
#ifndef DOM_MEDIA_WEBRTC_SINGLE_RW_FIFO_H_
|
||||
#define DOM_MEDIA_WEBRTC_SINGLE_RW_FIFO_H_
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/system_wrappers/interface/atomic32.h"
|
||||
@@ -17,10 +17,9 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// Implements a lock-free FIFO losely based on
|
||||
// Implements a lock-free FIFO loosely based on
|
||||
// http://src.chromium.org/viewvc/chrome/trunk/src/media/base/audio_fifo.cc
|
||||
// Note that this class assumes there is one producer (writer) and one
|
||||
// consumer (reader) thread.
|
||||
// This class assumes there is one producer and one consumer thread.
|
||||
class SingleRwFifo {
|
||||
public:
|
||||
explicit SingleRwFifo(int capacity);
|
||||
@@ -29,8 +28,6 @@ class SingleRwFifo {
|
||||
void Push(int8_t* mem);
|
||||
int8_t* Pop();
|
||||
|
||||
void Clear();
|
||||
|
||||
int size() { return size_.Value(); }
|
||||
int capacity() const { return capacity_; }
|
||||
|
||||
@@ -46,4 +43,4 @@ class SingleRwFifo {
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_SINGLE_RW_FIFO_H_
|
||||
#endif // DOM_MEDIA_WEBRTC_SINGLE_RW_FIFO_H_
|
||||
@@ -38,6 +38,7 @@ if CONFIG['MOZ_WEBRTC']:
|
||||
# MediaEngineWebRTC.cpp needs to be built separately.
|
||||
SOURCES += [
|
||||
'MediaEngineWebRTC.cpp',
|
||||
'SingleRwFifo.cpp',
|
||||
]
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/base',
|
||||
@@ -68,8 +69,7 @@ include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
# Suppress some GCC/clang warnings being treated as errors:
|
||||
# - about attributes on forward declarations for types that are already
|
||||
# defined, which complains about important MOZ_EXPORT attributes for
|
||||
# android API types
|
||||
# defined, which complains about important MOZ_EXPORT attributes.
|
||||
if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
|
||||
CXXFLAGS += [
|
||||
'-Wno-error=attributes',
|
||||
|
||||
@@ -194,7 +194,7 @@ static void FreeStringArray(uint32_t variants, char ** array)
|
||||
|
||||
static bool CanLoadPlugin(char16ptr_t aBinaryPath)
|
||||
{
|
||||
#if defined(_M_IX86) || defined(_M_X64) || defined(_M_IA64)
|
||||
#if defined(_M_IX86) || defined(_M_X64)
|
||||
bool canLoad = false;
|
||||
|
||||
HANDLE file = CreateFileW(aBinaryPath, GENERIC_READ,
|
||||
@@ -214,8 +214,6 @@ static bool CanLoadPlugin(char16ptr_t aBinaryPath)
|
||||
canLoad = (arch == IMAGE_FILE_MACHINE_I386);
|
||||
#elif defined(_M_X64)
|
||||
canLoad = (arch == IMAGE_FILE_MACHINE_AMD64);
|
||||
#elif defined(_M_IA64)
|
||||
canLoad = (arch == IMAGE_FILE_MACHINE_IA64);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,6 +301,7 @@ LoadContextOptions(const char* aPrefName, void* /* aClosure */)
|
||||
.setAsyncStack(GetWorkerPref<bool>(NS_LITERAL_CSTRING("asyncstack")))
|
||||
.setWerror(GetWorkerPref<bool>(NS_LITERAL_CSTRING("werror")))
|
||||
.setStreams(GetWorkerPref<bool>(NS_LITERAL_CSTRING("streams")))
|
||||
.setWeakRefs(GetWorkerPref<bool>(NS_LITERAL_CSTRING("weakrefs")))
|
||||
.setExtraWarnings(GetWorkerPref<bool>(NS_LITERAL_CSTRING("strict")))
|
||||
.setArrayProtoValues(GetWorkerPref<bool>(
|
||||
NS_LITERAL_CSTRING("array_prototype_values")));
|
||||
|
||||
@@ -35,6 +35,7 @@ WORKER_SIMPLE_PREF("dom.serviceWorkers.openWindow.enabled", OpenWindowEnabled, O
|
||||
WORKER_SIMPLE_PREF("dom.storageManager.enabled", StorageManagerEnabled, STORAGEMANAGER_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.push.enabled", PushEnabled, PUSH_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.streams.enabled", StreamsEnabled, STREAMS_ENABLED)
|
||||
WORKER_SIMPLE_PREF("javascript.options.weakrefs", WeakRefsEnabled, WEAKREFS_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.requestcontext.enabled", RequestContextEnabled, REQUESTCONTEXT_ENABLED)
|
||||
WORKER_SIMPLE_PREF("gfx.offscreencanvas.enabled", OffscreenCanvasEnabled, OFFSCREENCANVAS_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.webkitBlink.dirPicker.enabled", WebkitBlinkDirectoryPickerEnabled, DOM_WEBKITBLINK_DIRPICKER_WEBKITBLINK)
|
||||
|
||||
@@ -66,10 +66,28 @@ struct WeakCell {
|
||||
WeakCellKind kind;
|
||||
WeakRef<JSObject*> object;
|
||||
WeakRef<JS::Symbol*> symbol;
|
||||
bool enabled;
|
||||
|
||||
WeakCell() : kind(WeakCellKind::Empty), object(nullptr), symbol(nullptr) {}
|
||||
explicit WeakCell(JSObject* obj) : kind(WeakCellKind::Object), object(obj), symbol(nullptr) {}
|
||||
explicit WeakCell(JS::Symbol* sym) : kind(WeakCellKind::Symbol), object(nullptr), symbol(sym) {}
|
||||
WeakCell()
|
||||
: kind(WeakCellKind::Empty)
|
||||
, object(nullptr)
|
||||
, symbol(nullptr)
|
||||
, enabled(true)
|
||||
{}
|
||||
|
||||
explicit WeakCell(JSObject* obj, bool enabled)
|
||||
: kind(WeakCellKind::Object)
|
||||
, object(obj)
|
||||
, symbol(nullptr)
|
||||
, enabled(enabled)
|
||||
{}
|
||||
|
||||
explicit WeakCell(JS::Symbol* sym, bool enabled)
|
||||
: kind(WeakCellKind::Symbol)
|
||||
, object(nullptr)
|
||||
, symbol(sym)
|
||||
, enabled(enabled)
|
||||
{}
|
||||
|
||||
void clear() {
|
||||
kind = WeakCellKind::Empty;
|
||||
@@ -101,7 +119,9 @@ struct WeakCell {
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
if (IsInsideNursery(target)) {
|
||||
if (!enabled) {
|
||||
// Do nothing
|
||||
} else if (IsInsideNursery(target)) {
|
||||
TraceManuallyBarrieredEdge(trc, object.unsafeGet(), name);
|
||||
} else {
|
||||
if (trc->isMarkingTracer() && !target->asTenured().zone()->isCollecting())
|
||||
@@ -110,7 +130,7 @@ struct WeakCell {
|
||||
}
|
||||
} else if (kind == WeakCellKind::Symbol) {
|
||||
JS::Symbol* target = symbol.unbarrieredGet();
|
||||
if (target) {
|
||||
if (enabled && target) {
|
||||
if (trc->isMarkingTracer() && !target->asTenured().zone()->isCollecting())
|
||||
return;
|
||||
TraceWeakEdge(trc, &symbol, name);
|
||||
@@ -124,14 +144,16 @@ struct WeakCell {
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
if (IsInsideNursery(target)) {
|
||||
if (!enabled) {
|
||||
// Do nothing
|
||||
} else if (IsInsideNursery(target)) {
|
||||
TraceManuallyBarrieredEdge(trc, object.unsafeGet(), name);
|
||||
} else if (target->asTenured().zone()->isCollecting()) {
|
||||
TraceWeakEdge(trc, &object, name);
|
||||
}
|
||||
} else if (kind == WeakCellKind::Symbol) {
|
||||
JS::Symbol* target = symbol.unbarrieredGet();
|
||||
if (target && target->asTenured().zone()->isCollecting())
|
||||
if (enabled && target && target->asTenured().zone()->isCollecting())
|
||||
TraceWeakEdge(trc, &symbol, name);
|
||||
}
|
||||
}
|
||||
@@ -143,22 +165,24 @@ struct FinalizationRecord {
|
||||
WeakCell unregisterToken;
|
||||
bool active;
|
||||
bool queued;
|
||||
bool enabled;
|
||||
|
||||
FinalizationRecord(HandleValue targetValue, HandleValue heldValue,
|
||||
HandleValue unregisterTokenValue)
|
||||
HandleValue unregisterTokenValue, bool enabled)
|
||||
: heldValue(heldValue),
|
||||
active(true),
|
||||
queued(false)
|
||||
queued(false),
|
||||
enabled(enabled)
|
||||
{
|
||||
if (targetValue.isObject())
|
||||
target = WeakCell(NormalizeWeakObject(&targetValue.toObject()));
|
||||
target = WeakCell(NormalizeWeakObject(&targetValue.toObject()), enabled);
|
||||
else
|
||||
target = WeakCell(targetValue.toSymbol());
|
||||
target = WeakCell(targetValue.toSymbol(), enabled);
|
||||
|
||||
if (unregisterTokenValue.isObject())
|
||||
unregisterToken = WeakCell(NormalizeWeakObject(&unregisterTokenValue.toObject()));
|
||||
unregisterToken = WeakCell(NormalizeWeakObject(&unregisterTokenValue.toObject()), enabled);
|
||||
else if (unregisterTokenValue.isSymbol())
|
||||
unregisterToken = WeakCell(unregisterTokenValue.toSymbol());
|
||||
unregisterToken = WeakCell(unregisterTokenValue.toSymbol(), enabled);
|
||||
}
|
||||
|
||||
void trace(JSTracer* trc) {
|
||||
@@ -217,13 +241,15 @@ struct FinalizationRegistryObject::Data {
|
||||
FinalizationRecordVector records;
|
||||
FinalizationRecordVector cleanupQueue;
|
||||
bool queuedForCleanup;
|
||||
bool enabled;
|
||||
|
||||
explicit Data(JSObject* cleanupCallback)
|
||||
explicit Data(JSObject* cleanupCallback, bool enabled)
|
||||
: cleanupCallback(cleanupCallback),
|
||||
cleanupJob(nullptr),
|
||||
records(SystemAllocPolicy()),
|
||||
cleanupQueue(SystemAllocPolicy()),
|
||||
queuedForCleanup(false)
|
||||
queuedForCleanup(false),
|
||||
enabled(enabled)
|
||||
{}
|
||||
|
||||
~Data() {
|
||||
@@ -232,11 +258,13 @@ struct FinalizationRegistryObject::Data {
|
||||
}
|
||||
|
||||
void trace(JSTracer* trc) {
|
||||
JS::TraceEdge(trc, &cleanupCallback, "FinalizationRegistry cleanup callback");
|
||||
if (cleanupJob.unbarrieredGet())
|
||||
JS::TraceEdge(trc, &cleanupJob, "FinalizationRegistry cleanup job");
|
||||
for (size_t i = 0; i < records.length(); i++)
|
||||
records[i]->trace(trc);
|
||||
if (enabled) {
|
||||
JS::TraceEdge(trc, &cleanupCallback, "FinalizationRegistry cleanup callback");
|
||||
if (cleanupJob.unbarrieredGet())
|
||||
JS::TraceEdge(trc, &cleanupJob, "FinalizationRegistry cleanup job");
|
||||
for (size_t i = 0; i < records.length(); i++)
|
||||
records[i]->trace(trc);
|
||||
}
|
||||
}
|
||||
|
||||
bool appendRecord(FinalizationRecord* record) {
|
||||
@@ -317,7 +345,7 @@ FinalizationRegistry_register_impl(JSContext* cx, const CallArgs& args)
|
||||
unregisterToken.setUndefined();
|
||||
}
|
||||
|
||||
FinalizationRecord* record = cx->new_<FinalizationRecord>(target, heldValue, unregisterToken);
|
||||
FinalizationRecord* record = cx->new_<FinalizationRecord>(target, heldValue, unregisterToken, cx->options().weakRefs());
|
||||
if (!record)
|
||||
return false;
|
||||
|
||||
@@ -401,7 +429,7 @@ FinalizationRegistryObject::create(JSContext* cx, HandleObject cleanupCallback,
|
||||
if (!obj)
|
||||
return nullptr;
|
||||
|
||||
Data* data = cx->new_<Data>(cleanupCallback);
|
||||
Data* data = cx->new_<Data>(cleanupCallback, cx->options().weakRefs());
|
||||
if (!data)
|
||||
return nullptr;
|
||||
|
||||
|
||||
@@ -140,9 +140,9 @@ WeakRefObject::create(JSContext* cx, HandleValue target, HandleObject proto /* =
|
||||
|
||||
Referent* data;
|
||||
if (target.isObject())
|
||||
data = cx->new_<Referent>(&target.toObject());
|
||||
data = cx->new_<Referent>(&target.toObject(), cx->options().weakRefs());
|
||||
else
|
||||
data = cx->new_<Referent>(target.toSymbol());
|
||||
data = cx->new_<Referent>(target.toSymbol(), cx->options().weakRefs());
|
||||
|
||||
if (!data)
|
||||
return nullptr;
|
||||
@@ -210,7 +210,9 @@ WeakRefObject::trace(JSTracer* trc, JSObject* obj)
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
if (IsInsideNursery(target)) {
|
||||
if (!data->enabled) {
|
||||
// Pref disabled, don't do anything.
|
||||
} else if (IsInsideNursery(target)) {
|
||||
// Weak edges must be tenured; trace strongly while referent is in the nursery.
|
||||
TraceManuallyBarrieredEdge(trc, data->objectTarget.unsafeGet(),
|
||||
"WeakRef nursery referent");
|
||||
@@ -220,7 +222,7 @@ WeakRefObject::trace(JSTracer* trc, JSObject* obj)
|
||||
} else {
|
||||
MOZ_ASSERT(data->isSymbol());
|
||||
JS::Symbol* target = data->symbolTarget.unbarrieredGet();
|
||||
if (target)
|
||||
if (data->enabled && target)
|
||||
TraceWeakEdge(trc, &data->symbolTarget, "WeakRef symbol referent");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,17 +22,27 @@ class WeakRefObject : public NativeObject
|
||||
Symbol
|
||||
};
|
||||
|
||||
explicit Referent(JSObject* obj)
|
||||
: kind(Kind::Object), objectTarget(obj), symbolTarget(nullptr) {}
|
||||
explicit Referent(JS::Symbol* sym)
|
||||
: kind(Kind::Symbol), objectTarget(nullptr), symbolTarget(sym) {}
|
||||
|
||||
explicit Referent(JSObject* obj, bool enabled)
|
||||
: kind(Kind::Object)
|
||||
, objectTarget(obj)
|
||||
, symbolTarget(nullptr)
|
||||
, enabled(enabled)
|
||||
{}
|
||||
|
||||
explicit Referent(JS::Symbol* sym, bool enabled)
|
||||
: kind(Kind::Symbol)
|
||||
, objectTarget(nullptr)
|
||||
, symbolTarget(sym)
|
||||
, enabled(enabled)
|
||||
{}
|
||||
|
||||
bool isObject() const { return kind == Kind::Object; }
|
||||
bool isSymbol() const { return kind == Kind::Symbol; }
|
||||
|
||||
Kind kind;
|
||||
WeakRef<JSObject*> objectTarget;
|
||||
WeakRef<JS::Symbol*> symbolTarget;
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
static const Class class_;
|
||||
|
||||
+10
-10
@@ -416,13 +416,13 @@ MapMemoryAt(void* desired, size_t length, int prot = PROT_READ | PROT_WRITE,
|
||||
int flags = MAP_PRIVATE | MAP_ANON, int fd = -1, off_t offset = 0)
|
||||
|
||||
// Solaris manages 64-bit address space in a different manner from every other
|
||||
// AMD64 operating system, but fortunately the fix is the same one
|
||||
// required for every operating system on 64-bit SPARC, Itanium, and ARM.
|
||||
// AMD64 operating system, but fortunately the fix is the same one
|
||||
// required for every operating system on 64-bit SPARC and ARM.
|
||||
// Most people's intuition failed them here and they thought this couldn't
|
||||
// possibly be correct on AMD64, but for Solaris/illumos it is.
|
||||
|
||||
{
|
||||
#if defined(__ia64__) || defined(__aarch64__) || (defined(__sun) && defined(__x86_64__)) || (defined(__sparc__) && defined(__arch64__) && (defined(__NetBSD__) || defined(__linux__)))
|
||||
#if defined(__aarch64__) || (defined(__sun) && defined(__x86_64__)) || (defined(__sparc__) && defined(__arch64__) && (defined(__NetBSD__) || defined(__linux__)))
|
||||
MOZ_ASSERT((0xffff800000000000ULL & (uintptr_t(desired) + length - 1)) == 0);
|
||||
#endif
|
||||
void* region = mmap(desired, length, prot, flags, fd, offset);
|
||||
@@ -445,14 +445,14 @@ static inline void*
|
||||
MapMemory(size_t length, int prot = PROT_READ | PROT_WRITE,
|
||||
int flags = MAP_PRIVATE | MAP_ANON, int fd = -1, off_t offset = 0)
|
||||
{
|
||||
#if defined(__ia64__) || (defined(__sparc__) && defined(__arch64__) && defined(__NetBSD__))
|
||||
#if defined(__sparc__) && defined(__arch64__) && defined(__NetBSD__)
|
||||
/*
|
||||
* The JS engine assumes that all allocated pointers have their high 17 bits clear,
|
||||
* which ia64's mmap doesn't support directly. However, we can emulate it by passing
|
||||
* mmap an "addr" parameter with those bits clear. The mmap will return that address,
|
||||
* or the nearest available memory above that address, providing a near-guarantee
|
||||
* that those bits are clear. If they are not, we return nullptr below to indicate
|
||||
* out-of-memory.
|
||||
* which mmap on this platform doesn't support directly. However, we can emulate it
|
||||
* by passing mmap an "addr" parameter with those bits clear. The mmap will return
|
||||
* that address, or the nearest available memory above that address, providing a
|
||||
* near-guarantee that those bits are clear. If they are not, we return nullptr below
|
||||
* to indicate out-of-memory.
|
||||
*
|
||||
* The addr is chosen as 0x0000070000000000, which still allows about 120TB of virtual
|
||||
* address space.
|
||||
@@ -479,7 +479,7 @@ MapMemory(size_t length, int prot = PROT_READ | PROT_WRITE,
|
||||
* different due to the different mmap behavior.
|
||||
*
|
||||
* TODO: Merge with the above code block if this implementation works for
|
||||
* ia64 and sparc64.
|
||||
* sparc64.
|
||||
*/
|
||||
const uintptr_t start = UINT64_C(0x0000070000000000);
|
||||
const uintptr_t end = UINT64_C(0x0000800000000000);
|
||||
|
||||
@@ -320,7 +320,6 @@ size_t AssemblerLOONGARCH64::bytesNeeded() const {
|
||||
|
||||
// write a blob of binary into the instruction stream
|
||||
BufferOffset AssemblerLOONGARCH64::writeInst(uint32_t x, uint32_t* dest) {
|
||||
MOZ_ASSERT(hasCreator());
|
||||
if (dest == nullptr) {
|
||||
return m_buffer.putInt(x);
|
||||
}
|
||||
|
||||
@@ -212,6 +212,8 @@ static constexpr Register WasmTableCallIndexReg = ABINonArgReg3;
|
||||
static constexpr Register WasmIonExitRegCallee = t0;
|
||||
static constexpr Register WasmIonExitRegE0 = a0;
|
||||
static constexpr Register WasmIonExitRegE1 = a1;
|
||||
static constexpr Register WasmIonExitRegReturnData = JSReturnReg_Data;
|
||||
static constexpr Register WasmIonExitRegReturnType = JSReturnReg_Type;
|
||||
static constexpr Register WasmIonExitRegD0 = a0;
|
||||
static constexpr Register WasmIonExitRegD1 = a1;
|
||||
static constexpr Register WasmIonExitRegD2 = t0;
|
||||
|
||||
@@ -1013,8 +1013,8 @@ CodeGeneratorLoongArch64::visitTestI64AndBranch(LTestI64AndBranch* lir)
|
||||
void
|
||||
CodeGeneratorLoongArch64::setReturnDoubleRegs(LiveRegisterSet* regs)
|
||||
{
|
||||
MOZ_ASSERT(ReturnFloat32Reg.reg_ == FloatRegisters::f0);
|
||||
MOZ_ASSERT(ReturnDoubleReg.reg_ == FloatRegisters::f0);
|
||||
MOZ_ASSERT(ReturnFloat32Reg.encoding() == FloatRegisters::f0);
|
||||
MOZ_ASSERT(ReturnDoubleReg.encoding() == FloatRegisters::f0);
|
||||
FloatRegister f1 = { FloatRegisters::f1, FloatRegisters::Single };
|
||||
regs->add(ReturnFloat32Reg);
|
||||
regs->add(f1);
|
||||
|
||||
@@ -2395,7 +2395,7 @@ void MacroAssemblerLOONGARCH64::wasmLoadImpl(const wasm::MemoryAccessDesc& acces
|
||||
Register ptrScratch,
|
||||
AnyRegister output, Register tmp) {
|
||||
uint32_t offset = access.offset();
|
||||
MOZ_ASSERT(offset < asMasm().wasmMaxOffsetGuardLimit());
|
||||
MOZ_ASSERT(offset < wasm::OffsetGuardLimit);
|
||||
MOZ_ASSERT_IF(offset, ptrScratch != InvalidReg);
|
||||
|
||||
// Maybe add the offset.
|
||||
@@ -2442,7 +2442,7 @@ void MacroAssemblerLOONGARCH64::wasmStoreImpl(const wasm::MemoryAccessDesc& acce
|
||||
Register memoryBase, Register ptr,
|
||||
Register ptrScratch, Register tmp) {
|
||||
uint32_t offset = access.offset();
|
||||
MOZ_ASSERT(offset < asMasm().wasmMaxOffsetGuardLimit());
|
||||
MOZ_ASSERT(offset < wasm::OffsetGuardLimit);
|
||||
MOZ_ASSERT_IF(offset, ptrScratch != InvalidReg);
|
||||
|
||||
// Maybe add the offset.
|
||||
@@ -2488,7 +2488,7 @@ void MacroAssemblerLOONGARCH64Compat::wasmLoadI64Impl(
|
||||
const wasm::MemoryAccessDesc& access, Register memoryBase, Register ptr,
|
||||
Register ptrScratch, Register64 output, Register tmp) {
|
||||
uint32_t offset = access.offset();
|
||||
MOZ_ASSERT(offset < asMasm().wasmMaxOffsetGuardLimit());
|
||||
MOZ_ASSERT(offset < wasm::OffsetGuardLimit);
|
||||
MOZ_ASSERT_IF(offset, ptrScratch != InvalidReg);
|
||||
|
||||
// Maybe add the offset.
|
||||
@@ -2534,7 +2534,7 @@ void MacroAssemblerLOONGARCH64Compat::wasmStoreI64Impl(
|
||||
const wasm::MemoryAccessDesc& access, Register64 value, Register memoryBase,
|
||||
Register ptr, Register ptrScratch, Register tmp) {
|
||||
uint32_t offset = access.offset();
|
||||
MOZ_ASSERT(offset < asMasm().wasmMaxOffsetGuardLimit());
|
||||
MOZ_ASSERT(offset < wasm::OffsetGuardLimit);
|
||||
MOZ_ASSERT_IF(offset, ptrScratch != InvalidReg);
|
||||
|
||||
// Maybe add the offset.
|
||||
@@ -2774,12 +2774,13 @@ CodeOffset MacroAssembler::nopPatchableToNearJump() {
|
||||
}
|
||||
|
||||
void MacroAssembler::patchNopToNearJump(uint8_t* jump, uint8_t* target) {
|
||||
MOZ_ASSERT(reinterpret_cast<Instruction*>(jump)->is<InstNOP>());
|
||||
MOZ_ASSERT(reinterpret_cast<Instruction*>(jump)->encode() == NopInst);
|
||||
new (jump) InstJump(op_b, JOffImm26(target - jump));
|
||||
}
|
||||
|
||||
void MacroAssembler::patchNearJumpToNop(uint8_t* jump) {
|
||||
MOZ_ASSERT(reinterpret_cast<Instruction*>(jump)->is<InstJump>());
|
||||
MOZ_ASSERT(reinterpret_cast<Instruction*>(jump)->extractBitField(31, 26) ==
|
||||
(uint32_t)op_b >> 26);
|
||||
new (jump) InstNOP();
|
||||
}
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ void unmapPages(void* p, size_t size) { }
|
||||
void*
|
||||
mapMemoryAt(void* desired, size_t length)
|
||||
{
|
||||
#if defined(__ia64__) || defined(__aarch64__) || \
|
||||
#if defined(__aarch64__) || \
|
||||
(defined(__sparc__) && defined(__arch64__) && (defined(__NetBSD__) || defined(__linux__)))
|
||||
MOZ_RELEASE_ASSERT(0xffff800000000000ULL & (uintptr_t(desired) + length - 1) == 0);
|
||||
#endif
|
||||
@@ -324,7 +324,7 @@ mapMemory(size_t length)
|
||||
int fd = -1;
|
||||
off_t offset = 0;
|
||||
// The test code must be aligned with the implementation in gc/Memory.cpp.
|
||||
#if defined(__ia64__) || (defined(__sparc__) && defined(__arch64__) && defined(__NetBSD__))
|
||||
#if defined(__sparc__) && defined(__arch64__) && defined(__NetBSD__)
|
||||
void* region = mmap((void*)0x0000070000000000, length, prot, flags, fd, offset);
|
||||
if (region == MAP_FAILED)
|
||||
return nullptr;
|
||||
|
||||
+6
-3
@@ -999,7 +999,8 @@ class JS_PUBLIC_API(ContextOptions) {
|
||||
strictMode_(false),
|
||||
extraWarnings_(false),
|
||||
arrayProtoValues_(true),
|
||||
streams_(false)
|
||||
streams_(false),
|
||||
weakRefs_(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1139,12 +1140,13 @@ class JS_PUBLIC_API(ContextOptions) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool weakRefs() const { return true; }
|
||||
bool weakRefs() const { return weakRefs_; }
|
||||
ContextOptions& setWeakRefs(bool flag) {
|
||||
(void) flag;
|
||||
weakRefs_ = flag;
|
||||
return *this;
|
||||
}
|
||||
ContextOptions& toggleWeakRefs() {
|
||||
weakRefs_ = !weakRefs_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1165,6 +1167,7 @@ class JS_PUBLIC_API(ContextOptions) {
|
||||
bool extraWarnings_ : 1;
|
||||
bool arrayProtoValues_ : 1;
|
||||
bool streams_ : 1;
|
||||
bool weakRefs_ : 1;
|
||||
};
|
||||
|
||||
JS_PUBLIC_API(ContextOptions&)
|
||||
|
||||
+6
-3
@@ -4761,11 +4761,14 @@ GCRuntime::sweepFinalizationRegistries()
|
||||
if (!obj || !obj->is<FinalizationRegistryObject>()) {
|
||||
zone->finalizationRegistries.erase(zone->finalizationRegistries.begin() + i);
|
||||
continue;
|
||||
}
|
||||
|
||||
obj->as<FinalizationRegistryObject>().sweepAfterGC(rt);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
for (size_t i = 0; i < zone->finalizationRegistries.length(); i++) {
|
||||
JSObject* obj = zone->finalizationRegistries[i].unbarrieredGet();
|
||||
obj->as<FinalizationRegistryObject>().sweepAfterGC(rt);
|
||||
}
|
||||
zone->finalizationRegistries.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+35
-7
@@ -976,6 +976,12 @@ CanUpperCaseSpecialCasing(Latin1Char charCode)
|
||||
static inline bool
|
||||
CanUpperCaseSpecialCasing(char16_t charCode)
|
||||
{
|
||||
// Update mapping for U+00DF LATIN SMALL LETTER SHARP S inline,
|
||||
// overriding Unicode data files to force the use of
|
||||
// U+1E9E LATIN CAPITAL LETTER SHARP S.
|
||||
if (charCode == unicode::LATIN_SMALL_LETTER_SHARP_S)
|
||||
return true;
|
||||
|
||||
return unicode::CanUpperCaseSpecialCasing(charCode);
|
||||
}
|
||||
|
||||
@@ -991,6 +997,11 @@ LengthUpperCaseSpecialCasing(Latin1Char charCode)
|
||||
static inline size_t
|
||||
LengthUpperCaseSpecialCasing(char16_t charCode)
|
||||
{
|
||||
// U+00DF LATIN SMALL LETTER SHARP S is uppercased according to ICU or
|
||||
// to U+1E9E LATIN CAPITAL LETTER SHARP S.
|
||||
if (charCode == unicode::LATIN_SMALL_LETTER_SHARP_S)
|
||||
return 1;
|
||||
|
||||
MOZ_ASSERT(CanUpperCaseSpecialCasing(charCode));
|
||||
|
||||
return unicode::LengthUpperCaseSpecialCasing(charCode);
|
||||
@@ -1010,6 +1021,13 @@ AppendUpperCaseSpecialCasing(char16_t charCode, Latin1Char* elements, size_t* in
|
||||
static inline void
|
||||
AppendUpperCaseSpecialCasing(char16_t charCode, char16_t* elements, size_t* index)
|
||||
{
|
||||
// U+00DF LATIN SMALL LETTER SHARP S is uppercased according to ICU or
|
||||
// to U+1E9E LATIN CAPITAL LETTER SHARP S.
|
||||
if (charCode == unicode::LATIN_SMALL_LETTER_SHARP_S) {
|
||||
elements[(*index)++] = 0x1E9E;
|
||||
return;
|
||||
}
|
||||
|
||||
unicode::AppendUpperCaseSpecialCasing(charCode, elements, index);
|
||||
}
|
||||
|
||||
@@ -1025,6 +1043,7 @@ ToUpperCaseImpl(DestChar* destChars, const SrcChar* srcChars, size_t startIndex,
|
||||
MOZ_ASSERT(srcLength <= destLength);
|
||||
|
||||
size_t j = startIndex;
|
||||
size_t upperLength = srcLength;
|
||||
for (size_t i = startIndex; i < srcLength; i++) {
|
||||
char16_t c = srcChars[i];
|
||||
if (!IsSame<DestChar, Latin1Char>::value) {
|
||||
@@ -1040,9 +1059,10 @@ ToUpperCaseImpl(DestChar* destChars, const SrcChar* srcChars, size_t startIndex,
|
||||
}
|
||||
}
|
||||
|
||||
if (MOZ_UNLIKELY(c > 0x7f && CanUpperCaseSpecialCasing(static_cast<SrcChar>(c)))) {
|
||||
if (MOZ_UNLIKELY(c > 0x7f && CanUpperCaseSpecialCasing(static_cast<DestChar>(c)))) {
|
||||
// Return if the output buffer is too small.
|
||||
if (srcLength == destLength)
|
||||
upperLength += (LengthUpperCaseSpecialCasing(static_cast<DestChar>(c)) - 1);
|
||||
if (upperLength > destLength)
|
||||
return i;
|
||||
|
||||
AppendUpperCaseSpecialCasing(c, destChars, &j);
|
||||
@@ -1071,14 +1091,18 @@ ToUpperCaseImpl(Latin1Char* destChars, const char16_t* srcChars, size_t startInd
|
||||
|
||||
template <typename CharT>
|
||||
static size_t
|
||||
ToUpperCaseLength(const CharT* chars, size_t startIndex, size_t length)
|
||||
ToUpperCaseLength(const CharT* chars, size_t startIndex, size_t length, bool force16)
|
||||
{
|
||||
size_t upperLength = length;
|
||||
for (size_t i = startIndex; i < length; i++) {
|
||||
char16_t c = chars[i];
|
||||
|
||||
if (c > 0x7f && CanUpperCaseSpecialCasing(static_cast<CharT>(c)))
|
||||
upperLength += LengthUpperCaseSpecialCasing(static_cast<CharT>(c)) - 1;
|
||||
if (c > 0x7f &&
|
||||
(force16 && CanUpperCaseSpecialCasing(c) ||
|
||||
CanUpperCaseSpecialCasing(static_cast<CharT>(c))))
|
||||
upperLength += (force16
|
||||
? LengthUpperCaseSpecialCasing(c)
|
||||
: LengthUpperCaseSpecialCasing(static_cast<CharT>(c))) - 1;
|
||||
}
|
||||
return upperLength;
|
||||
}
|
||||
@@ -1117,7 +1141,7 @@ ToUpperCase(JSContext* cx, const SrcChar* chars, size_t startIndex, size_t lengt
|
||||
|
||||
size_t readChars = ToUpperCaseImpl(buf.get(), chars, startIndex, length, length);
|
||||
if (readChars < length) {
|
||||
size_t actualLength = ToUpperCaseLength(chars, readChars, length);
|
||||
size_t actualLength = ToUpperCaseLength(chars, readChars, length, !IsSame<DestChar, Latin1Char>::value);
|
||||
|
||||
*resultLength = actualLength;
|
||||
DestCharPtr buf2 = ReallocChars(cx, Move(buf), length + 1, actualLength + 1);
|
||||
@@ -1178,7 +1202,8 @@ ToUpperCase(JSContext* cx, JSLinearString* str)
|
||||
//
|
||||
// If the original string is Latin-1, it can -- unless the string
|
||||
// contains U+00B5 MICRO SIGN or U+00FF SMALL LETTER Y WITH DIAERESIS,
|
||||
// the only Latin-1 codepoints that don't uppercase within Latin-1.
|
||||
// the only Latin-1 codepoints that don't uppercase within Latin-1, or
|
||||
// it contains U+00DF LATIN SMALL LETTER SHARP S, which we override.
|
||||
// Search for those codepoints to decide whether the new string can be
|
||||
// Latin-1.
|
||||
// If the original string is a two-byte string, its uppercase form is
|
||||
@@ -1195,6 +1220,9 @@ ToUpperCase(JSContext* cx, JSLinearString* str)
|
||||
MOZ_ASSERT(unicode::ToUpperCase(c) > JSString::MAX_LATIN1_CHAR);
|
||||
resultIsLatin1 = false;
|
||||
break;
|
||||
} else if (c == unicode::LATIN_SMALL_LETTER_SHARP_S) {
|
||||
resultIsLatin1 = false;
|
||||
break;
|
||||
} else {
|
||||
MOZ_ASSERT(unicode::ToUpperCase(c) <= JSString::MAX_LATIN1_CHAR);
|
||||
}
|
||||
|
||||
@@ -839,7 +839,7 @@ wasm::ToggleProfiling(const Code& code, const CallSite& callSite, bool enabled)
|
||||
#elif defined(JS_CODEGEN_LOONGARCH64)
|
||||
uint8_t* caller = callerRetAddr - sizeof(uint32_t);
|
||||
Instruction* callerInsn = reinterpret_cast<Instruction*>(caller);
|
||||
MOZ_ASSERT(callerInsn->extractOpcode() == ((uint32_t)op_bl >> OpcodeShift));
|
||||
MOZ_ASSERT(callerInsn->extractBitField(31, 26) == ((uint32_t)op_bl >> 26));
|
||||
int32_t calleeOffset =
|
||||
int32_t(reinterpret_cast<InstJump*>(callerInsn)->extractImm26Value() << 8) >> 6;
|
||||
void* callee = caller + calleeOffset;
|
||||
|
||||
@@ -1442,6 +1442,7 @@ ReloadPrefsCallback(const char* pref, void* data)
|
||||
bool extraWarnings = Preferences::GetBool(JS_OPTIONS_DOT_STR "strict");
|
||||
|
||||
bool streams = Preferences::GetBool(JS_OPTIONS_DOT_STR "streams");
|
||||
bool weakRefs = Preferences::GetBool(JS_OPTIONS_DOT_STR "weakrefs");
|
||||
|
||||
bool unboxedObjects = Preferences::GetBool(JS_OPTIONS_DOT_STR "unboxed_objects");
|
||||
|
||||
@@ -1468,7 +1469,8 @@ ReloadPrefsCallback(const char* pref, void* data)
|
||||
.setWerror(werror)
|
||||
.setExtraWarnings(extraWarnings)
|
||||
.setArrayProtoValues(arrayProtoValues)
|
||||
.setStreams(streams);
|
||||
.setStreams(streams)
|
||||
.setWeakRefs(weakRefs);
|
||||
|
||||
JS_SetParallelParsingEnabled(cx, parallelParsing);
|
||||
JS_SetOffthreadIonCompilationEnabled(cx, offthreadIonCompilation);
|
||||
|
||||
@@ -318,7 +318,7 @@ nsCaseTransformTextRunFactory::TransformString(
|
||||
// in the output string
|
||||
uint32_t irishMarkSrc = uint32_t(-1); // corresponding location in source
|
||||
// string (may differ from output due to
|
||||
// expansions like eszet -> 'SS')
|
||||
// expansions)
|
||||
|
||||
for (uint32_t i = 0; i < length; ++i, ++aOffsetInTextRun) {
|
||||
uint32_t ch = str[i];
|
||||
@@ -604,6 +604,13 @@ nsCaseTransformTextRunFactory::TransformString(
|
||||
// to check for special uppercase (ß)
|
||||
}
|
||||
|
||||
// Updated mapping for Germen eszett, not currently reflected in the
|
||||
// Unicode data files.
|
||||
if (ch == 0x00DF) {
|
||||
ch = 0x1E9E;
|
||||
break;
|
||||
}
|
||||
|
||||
mcm = mozilla::unicode::SpecialUpper(ch);
|
||||
if (mcm) {
|
||||
int j = 0;
|
||||
@@ -658,6 +665,12 @@ nsCaseTransformTextRunFactory::TransformString(
|
||||
}
|
||||
}
|
||||
|
||||
// Updated mapping for Germen eszett as a capital letter.
|
||||
if (ch == 0x00DF) {
|
||||
ch = 0x1E9E;
|
||||
break;
|
||||
}
|
||||
|
||||
mcm = mozilla::unicode::SpecialTitle(ch);
|
||||
if (mcm) {
|
||||
int j = 0;
|
||||
|
||||
@@ -8610,14 +8610,18 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
|
||||
{
|
||||
const nsCSSPropertyID* subprops =
|
||||
nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_radius);
|
||||
const float RADIUS_MAX = 17895697; // CSS length clamp value
|
||||
NS_FOR_CSS_FULL_CORNERS(corner) {
|
||||
int cx = FullToHalfCorner(corner, false);
|
||||
int cy = FullToHalfCorner(corner, true);
|
||||
const nsCSSValue& radius = *aRuleData->ValueFor(subprops[corner]);
|
||||
nsCSSValue radius = *aRuleData->ValueFor(subprops[corner]);
|
||||
nsStyleCoord parentX = parentBorder->mBorderRadius.Get(cx);
|
||||
nsStyleCoord parentY = parentBorder->mBorderRadius.Get(cy);
|
||||
nsStyleCoord coordX, coordY;
|
||||
|
||||
// Clamp border radius to the max value so it will not wrap and cause artifacts.
|
||||
if (radius.GetFloatValue() > RADIUS_MAX) {
|
||||
radius.SetFloatValue(RADIUS_MAX, eCSSUnit_Number);
|
||||
}
|
||||
if (SetPairCoords(radius, coordX, coordY, parentX, parentY,
|
||||
SETCOORD_LPH | SETCOORD_INITIAL_ZERO |
|
||||
SETCOORD_STORE_CALC | SETCOORD_UNSET_INITIAL,
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
*/
|
||||
|
||||
#ifndef SYSV
|
||||
#if defined( hpux ) || defined(XP_SOLARIS) || defined ( sgi ) || defined( SVR4 )
|
||||
#if defined(XP_SOLARIS) || defined ( sgi ) || defined( SVR4 )
|
||||
#define SYSV
|
||||
#endif
|
||||
#endif
|
||||
@@ -82,7 +82,7 @@
|
||||
/*
|
||||
* System V has socket options in filio.h
|
||||
*/
|
||||
#if !defined( NEED_FILIO ) && defined( SYSV ) && !defined( hpux ) && !defined( AIX )
|
||||
#if !defined( NEED_FILIO ) && defined( SYSV ) && !defined( AIX )
|
||||
#define NEED_FILIO
|
||||
#endif
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
* for select()
|
||||
*/
|
||||
#if !defined(WINSOCK) && !defined(_WINDOWS) && !defined(macintosh) && !defined(XP_OS2)
|
||||
#if defined(hpux) || defined(LINUX) || defined(SUNOS4) || defined(XP_BEOS)
|
||||
#if defined(LINUX) || defined(SUNOS4) || defined(XP_BEOS)
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <sys/select.h>
|
||||
@@ -190,7 +190,7 @@
|
||||
* is necessary on some buggy UNIXes.
|
||||
*/
|
||||
#if !defined(NSLDAPI_CONNECT_MUST_NOT_BE_INTERRUPTED) && \
|
||||
( defined(AIX) || defined(IRIX) || defined(HPUX) || defined(SUNOS4) \
|
||||
( defined(AIX) || defined(IRIX) || defined(SUNOS4) \
|
||||
|| defined(XP_SOLARIS) || defined(OSF1) ||defined(freebsd))
|
||||
#define NSLDAPI_CONNECT_MUST_NOT_BE_INTERRUPTED
|
||||
#endif
|
||||
@@ -208,7 +208,7 @@
|
||||
/*
|
||||
* toupper and tolower macros are different under bsd and sys v
|
||||
*/
|
||||
#if defined( SYSV ) && !defined( hpux )
|
||||
#if defined( SYSV )
|
||||
#define TOUPPER(c) (isascii(c) && islower(c) ? _toupper(c) : c)
|
||||
#define TOLOWER(c) (isascii(c) && isupper(c) ? _tolower(c) : c)
|
||||
#else
|
||||
@@ -236,7 +236,7 @@
|
||||
#define SETFLAGS( tio, flags ) (tio).c_lflag = (flags)
|
||||
#endif
|
||||
|
||||
#if ( !defined( HPUX9 )) && ( !defined( sunos4 )) && ( !defined( SNI )) && \
|
||||
#if ( !defined( sunos4 )) && ( !defined( SNI )) && \
|
||||
( !defined( HAVE_TIME_R ))
|
||||
#define HAVE_TIME_R
|
||||
#endif
|
||||
@@ -267,10 +267,9 @@ int strncasecmp(const char *, const char *, size_t);
|
||||
#define NSLDAPI_NETDB_BUF_SIZE 1024
|
||||
#endif
|
||||
|
||||
#if defined(sgi) || defined(HPUX9) || defined(SCOOS) || \
|
||||
#if defined(sgi) || defined(SCOOS) || \
|
||||
defined(UNIXWARE) || defined(SUNOS4) || defined(SNI) || defined(BSDI) || \
|
||||
defined(NCR) || defined(OSF1) || defined(NEC) || defined(VMS) || \
|
||||
( defined(HPUX10) && !defined(_REENTRANT)) || defined(HPUX11) || \
|
||||
defined(UnixWare) || defined(NETBSD) || \
|
||||
defined(FREEBSD) || defined(OPENBSD) || \
|
||||
(defined(LINUX) && __GLIBC__ < 2) || \
|
||||
@@ -286,9 +285,6 @@ typedef char GETHOSTBYNAME_buf_t [NSLDAPI_NETDB_BUF_SIZE];
|
||||
#define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t
|
||||
#define GETHOSTBYNAME( n, r, b, l, e ) \
|
||||
(memset (&b, 0, l), gethostbyname_r (n, r, &b) ? NULL : r)
|
||||
#elif defined(HPUX10)
|
||||
#define GETHOSTBYNAME_BUF_T struct hostent_data
|
||||
#define GETHOSTBYNAME( n, r, b, l, e ) nsldapi_compat_gethostbyname_r( n, r, (char *)&b, l, e )
|
||||
#elif defined(LINUX) || defined(DRAGONFLY)
|
||||
typedef char GETHOSTBYNAME_buf_t [NSLDAPI_NETDB_BUF_SIZE];
|
||||
#define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t
|
||||
@@ -299,17 +295,15 @@ typedef char GETHOSTBYNAME_buf_t [NSLDAPI_NETDB_BUF_SIZE];
|
||||
#define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t
|
||||
#define GETHOSTBYNAME( n, r, b, l, e ) gethostbyname_r( n, r, b, l, e )
|
||||
#endif
|
||||
#if defined(HPUX9) || defined(LINUX1_2) || defined(LINUX2_0) || \
|
||||
#if defined(LINUX1_2) || defined(LINUX2_0) || \
|
||||
defined(LINUX2_1) || defined(SUNOS4) || defined(SNI) || \
|
||||
defined(SCOOS) || defined(BSDI) || defined(NCR) || \
|
||||
defined(NEC) || ( defined(HPUX10) && !defined(_REENTRANT)) || \
|
||||
defined(NEC) || \
|
||||
(defined(AIX) && !defined(USE_REENTRANT_LIBC))
|
||||
#define NSLDAPI_CTIME( c, b, l ) ctime( c )
|
||||
#elif defined(HPUX10) && defined(_REENTRANT) && !defined(HPUX11)
|
||||
#define NSLDAPI_CTIME( c, b, l ) nsldapi_compat_ctime_r( c, b, l )
|
||||
#elif defined( IRIX6_2 ) || defined( IRIX6_3 ) || defined(UNIXWARE) \
|
||||
|| defined(OSF1V4) || defined(AIX) || defined(UnixWare) \
|
||||
|| defined(hpux) || defined(HPUX11) || defined(NETBSD) \
|
||||
|| defined(NETBSD) \
|
||||
|| defined(IRIX6) || defined(FREEBSD) || defined(VMS) \
|
||||
|| defined(NTO) || defined(OPENBSD) || defined(DRAGONFLY)
|
||||
#define NSLDAPI_CTIME( c, b, l ) ctime_r( c, b )
|
||||
@@ -318,7 +312,7 @@ typedef char GETHOSTBYNAME_buf_t [NSLDAPI_NETDB_BUF_SIZE];
|
||||
#else
|
||||
#define NSLDAPI_CTIME( c, b, l ) ctime_r( c, b, l )
|
||||
#endif
|
||||
#if defined(hpux9) || defined(SUNOS4) || defined(SNI) || \
|
||||
#if defined(SUNOS4) || defined(SNI) || \
|
||||
defined(SCOOS) || defined(BSDI) || defined(NCR) || defined(VMS) || \
|
||||
defined(NEC) || (defined(LINUX) && __GNU_LIBRARY__ != 6) || \
|
||||
(defined(AIX) && !defined(USE_REENTRANT_LIBC))
|
||||
@@ -366,7 +360,7 @@ extern char *strdup();
|
||||
/*
|
||||
* Define a portable type for IPv4 style Internet addresses (32 bits):
|
||||
*/
|
||||
#if defined(_IN_ADDR_T) || defined(aix) || defined(HPUX11) || defined(OSF1)
|
||||
#if defined(_IN_ADDR_T) || defined(aix) || defined(OSF1)
|
||||
typedef in_addr_t nsldapi_in_addr_t;
|
||||
#else
|
||||
typedef nsldapi_uint_32 nsldapi_in_addr_t;
|
||||
@@ -452,7 +446,7 @@ int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
||||
#define NSLDAPI_FOPEN( filename, mode ) fopen( filename, mode )
|
||||
#endif
|
||||
|
||||
#if defined(LINUX) || defined(AIX) || defined(HPUX) || defined(_WINDOWS)
|
||||
#if defined(LINUX) || defined(AIX) || defined(_WINDOWS)
|
||||
size_t nsldapi_compat_strlcpy(char *dst, const char *src, size_t len);
|
||||
#define STRLCPY nsldapi_compat_strlcpy
|
||||
#else
|
||||
|
||||
@@ -51,39 +51,7 @@ static char copyright[] = "@(#) Copyright (c) 1994 The Regents of the University
|
||||
|
||||
#include "ldap-int.h"
|
||||
|
||||
#if defined( HPUX10 ) && defined( _REENTRANT ) && !defined(HPUX11)
|
||||
extern int h_errno;
|
||||
|
||||
struct hostent *
|
||||
nsldapi_compat_gethostbyname_r( const char *name, struct hostent *result,
|
||||
char *buffer, int buflen, int *h_errnop )
|
||||
{
|
||||
struct hostent_data *hep;
|
||||
|
||||
if ( buflen < sizeof(struct hostent_data)) { /* sanity check */
|
||||
*h_errnop = NO_RECOVERY; /* XXX best error code to use? */
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
hep = (struct hostent_data *)buffer;
|
||||
hep->current = NULL;
|
||||
|
||||
if ( gethostbyname_r( name, result, hep ) == -1) {
|
||||
*h_errnop = h_errno; /* XXX don't see anywhere else to get this */
|
||||
return NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
char *
|
||||
nsldapi_compat_ctime_r( const time_t *clock, char *buf, int buflen )
|
||||
{
|
||||
NSLDAPI_CTIME1( clock, buf, buflen );
|
||||
return buf;
|
||||
}
|
||||
#endif /* HPUX10 && _REENTRANT && !HPUX11 */
|
||||
|
||||
#if defined(LINUX) || defined(AIX) || defined(HPUX) || defined(_WINDOWS)
|
||||
#if defined(LINUX) || defined(AIX) || defined(_WINDOWS)
|
||||
/*
|
||||
* Copies src to the dstsize buffer at dst. The copy will never
|
||||
* overflow the destination buffer and the buffer will always be null
|
||||
|
||||
@@ -43,9 +43,6 @@
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef hpux
|
||||
#include <strings.h>
|
||||
#endif /* hpux */
|
||||
|
||||
#ifdef _WINDOWS
|
||||
# define FD_SETSIZE 256 /* number of connections we support */
|
||||
@@ -62,9 +59,9 @@
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
# include <netdb.h>
|
||||
#if !defined(hpux) && !defined(SUNOS4) && !defined(XP_BEOS)
|
||||
#if !defined(SUNOS4) && !defined(XP_BEOS)
|
||||
# include <sys/select.h>
|
||||
#endif /* !defined(hpux) and others */
|
||||
#endif /* !defined(SUNOS4) and others */
|
||||
#endif /* _WINDOWS */
|
||||
|
||||
#if defined(IRIX)
|
||||
@@ -818,12 +815,6 @@ void nsldapi_hex_unescape( char *s );
|
||||
/*
|
||||
* in compat.c
|
||||
*/
|
||||
#ifdef hpux
|
||||
char *nsldapi_compat_ctime_r( const time_t *clock, char *buf, int buflen );
|
||||
struct hostent *nsldapi_compat_gethostbyname_r( const char *name,
|
||||
struct hostent *result, char *buffer, int buflen, int *h_errnop );
|
||||
#endif /* hpux */
|
||||
|
||||
/*
|
||||
* in control.c
|
||||
*/
|
||||
|
||||
@@ -1259,17 +1259,10 @@ nsldapi_iostatus_poll( LDAP *ld, struct timeval *timeout )
|
||||
iosp->ios_status.ios_osinfo.ossi_use_writefds
|
||||
= iosp->ios_status.ios_osinfo.ossi_writefds;
|
||||
|
||||
#ifdef HPUX9
|
||||
rc = NSLDAPI_SELECT( nsldapi_get_select_table_size(),
|
||||
(int *)&iosp->ios_status.ios_osinfo.ossi_use_readfds
|
||||
(int *)&iosp->ios_status.ios_osinfo.ossi_use_writefds,
|
||||
NULL, timeout );
|
||||
#else
|
||||
rc = NSLDAPI_SELECT( nsldapi_get_select_table_size(),
|
||||
&iosp->ios_status.ios_osinfo.ossi_use_readfds,
|
||||
&iosp->ios_status.ios_osinfo.ossi_use_writefds,
|
||||
NULL, timeout );
|
||||
#endif /* else HPUX9 */
|
||||
#endif /* else NSLDAPI_HAVE_POLL */
|
||||
#endif /* NSLDAPI_AVOID_OS_SOCKETS */
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ struct prldap_errormap_entry {
|
||||
#define EOVERFLOW -1
|
||||
#endif
|
||||
|
||||
#if defined(__hpux) || defined(_AIX) || defined(OSF1) || defined(DARWIN) || \
|
||||
#if defined(_AIX) || defined(OSF1) || defined(DARWIN) || \
|
||||
defined(BEOS) || defined(FREEBSD) || defined(BSDI) || defined(VMS) || \
|
||||
defined(OPENBSD) || defined(NETBSD)
|
||||
#define EDEADLOCK -1
|
||||
|
||||
@@ -3964,9 +3964,9 @@ nsMsgDBView::FnSortIdUint32(const void *pItem1, const void *pItem2, void *privat
|
||||
|
||||
|
||||
// XXX are these still correct?
|
||||
//To compensate for memory alignment required for
|
||||
//systems such as HP-UX these values must be 4 bytes
|
||||
//aligned. Don't break this when modify the constants
|
||||
// To compensate for memory alignment required by strict-alignment systems,
|
||||
// these values must be 4 bytes aligned. Don't break this when modifying
|
||||
// the constants.
|
||||
const int kMaxSubjectKey = 160;
|
||||
const int kMaxLocationKey = 160; // also used for account
|
||||
const int kMaxAuthorKey = 160;
|
||||
@@ -4804,8 +4804,8 @@ NS_IMETHODIMP nsMsgDBView::Sort(nsMsgViewSortTypeValue sortType,
|
||||
info->folder = folders ? folders->ObjectAt(numSoFar) : m_folder.get();
|
||||
|
||||
memcpy(info->key, keyValue, actualFieldLen);
|
||||
//In order to align memory for systems that require it, such as HP-UX
|
||||
//calculate the correct value to pad the actualFieldLen value
|
||||
// In order to align memory for systems that require it, calculate the
|
||||
// correct value to pad the actualFieldLen value.
|
||||
const uint32_t align = sizeof(IdKey) - sizeof(IdUint32) - 1;
|
||||
actualFieldLen = (actualFieldLen + align) & ~align;
|
||||
|
||||
|
||||
+1
-14
@@ -92,7 +92,7 @@
|
||||
'LIBYUV_MSA',
|
||||
],
|
||||
}],
|
||||
['OS != "ios" and libyuv_disable_jpeg != 1', {
|
||||
['libyuv_disable_jpeg != 1', {
|
||||
'defines': [
|
||||
'HAVE_JPEG'
|
||||
],
|
||||
@@ -135,18 +135,6 @@
|
||||
'include',
|
||||
'.',
|
||||
],
|
||||
'conditions': [
|
||||
['OS == "android" and target_arch == "arm64"', {
|
||||
'ldflags': [
|
||||
'-Wl,--dynamic-linker,/system/bin/linker64',
|
||||
],
|
||||
}],
|
||||
['OS == "android" and target_arch != "arm64"', {
|
||||
'ldflags': [
|
||||
'-Wl,--dynamic-linker,/system/bin/linker',
|
||||
],
|
||||
}],
|
||||
], #conditions
|
||||
},
|
||||
'sources': [
|
||||
'<@(libyuv_sources)',
|
||||
@@ -154,4 +142,3 @@
|
||||
},
|
||||
], # targets.
|
||||
}
|
||||
|
||||
@@ -14,13 +14,8 @@ webrtc_non_unified_sources = [
|
||||
'trunk/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_filter_c.c', # Because of name clash in the kDampFilter variable
|
||||
'trunk/webrtc/modules/audio_coding/main/acm2/codec_manager.cc', # Because of duplicate IsCodecRED/etc
|
||||
'trunk/webrtc/modules/audio_coding/neteq/audio_vector.cc', # Because of explicit template specializations
|
||||
'trunk/webrtc/modules/audio_device/android/audio_record_jni.cc', # Becuse of commonly named module static vars
|
||||
'trunk/webrtc/modules/audio_device/android/audio_track_jni.cc', # Becuse of commonly named module static vars
|
||||
'trunk/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc', # Because of LATE()
|
||||
'trunk/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.cc',# Because of LATE()
|
||||
'trunk/webrtc/modules/audio_device/opensl/opensles_input.cc', # Because of name clash in the kOption variable
|
||||
'trunk/webrtc/modules/audio_device/opensl/opensles_output.cc', # Because of name clash in the kOption variable
|
||||
'trunk/webrtc/modules/audio_device/opensl/single_rw_fifo.cc', # Because of name clash with #define FF
|
||||
'trunk/webrtc/modules/audio_device/win/audio_device_core_win.cc', # Because of ordering assumptions in strsafe.h
|
||||
'trunk/webrtc/modules/audio_processing/aec/aec_core.c', # Because of name clash in the ComfortNoise function
|
||||
'trunk/webrtc/modules/audio_processing/aecm/aecm_core.c', # Because of name clash in the ComfortNoise function
|
||||
@@ -66,9 +61,7 @@ if CONFIG['MOZ_WEBRTC_SIGNALING']:
|
||||
'signaling/src/jsep/JsepSessionImpl.cpp',
|
||||
'signaling/src/media-conduit/AudioConduit.cpp',
|
||||
'signaling/src/media-conduit/CodecStatistics.cpp',
|
||||
'signaling/src/media-conduit/MediaCodecVideoCodec.cpp',
|
||||
'signaling/src/media-conduit/VideoConduit.cpp',
|
||||
'signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp',
|
||||
'signaling/src/mediapipeline/MediaPipeline.cpp',
|
||||
'signaling/src/mediapipeline/MediaPipelineFilter.cpp',
|
||||
'signaling/src/mediapipeline/SrtpFlow.cpp',
|
||||
@@ -116,7 +109,6 @@ if CONFIG['MOZ_WEBRTC_SIGNALING']:
|
||||
GYP_DIRS['signalingtest'].variables = gyp_vars.copy()
|
||||
GYP_DIRS['signalingtest'].variables.update(
|
||||
build_for_test=1,
|
||||
moz_webrtc_mediacodec=0,
|
||||
build_for_standalone=0
|
||||
)
|
||||
GYP_DIRS['signalingtest'].sandbox_vars['ALLOW_COMPILER_WARNINGS'] = True
|
||||
|
||||
@@ -219,41 +219,6 @@
|
||||
'../../../netwerk/srtp/src/crypto/include',
|
||||
],
|
||||
}],
|
||||
['moz_webrtc_omx==1', {
|
||||
'sources': [
|
||||
'./src/media-conduit/WebrtcOMXH264VideoCodec.cpp',
|
||||
'./src/media-conduit/OMXVideoCodec.cpp',
|
||||
],
|
||||
'include_dirs': [
|
||||
# hack on hack to re-add it after SrtpFlow removes it
|
||||
'../../../dom/media/omx',
|
||||
'../../../gfx/layers/client',
|
||||
],
|
||||
'cflags_mozilla': [
|
||||
'-I$(ANDROID_SOURCE)/frameworks/av/include/media/stagefright',
|
||||
'-I$(ANDROID_SOURCE)/frameworks/av/include',
|
||||
'-I$(ANDROID_SOURCE)/frameworks/native/include/media/openmax',
|
||||
'-I$(ANDROID_SOURCE)/frameworks/native/include',
|
||||
'-I$(ANDROID_SOURCE)/frameworks/native/opengl/include',
|
||||
],
|
||||
'defines' : [
|
||||
'MOZ_WEBRTC_OMX'
|
||||
],
|
||||
}],
|
||||
['moz_webrtc_mediacodec==1', {
|
||||
'include_dirs': [
|
||||
'../../../widget/android',
|
||||
],
|
||||
'sources': [
|
||||
'./src/media-conduit/MediaCodecVideoCodec.h',
|
||||
'./src/media-conduit/WebrtcMediaCodecVP8VideoCodec.h',
|
||||
'./src/media-conduit/MediaCodecVideoCodec.cpp',
|
||||
'./src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp',
|
||||
],
|
||||
'defines' : [
|
||||
'MOZ_WEBRTC_MEDIACODEC',
|
||||
],
|
||||
}],
|
||||
['(build_for_test==0) and (build_for_standalone==0)', {
|
||||
'defines' : [
|
||||
'MOZILLA_INTERNAL_API',
|
||||
@@ -294,7 +259,7 @@
|
||||
'USE_FAKE_PCOBSERVER',
|
||||
],
|
||||
}],
|
||||
['(OS=="linux") or (OS=="android")', {
|
||||
['OS=="linux"', {
|
||||
'include_dirs': [
|
||||
],
|
||||
|
||||
@@ -311,13 +276,6 @@
|
||||
'cflags_mozilla': [
|
||||
],
|
||||
}],
|
||||
['OS=="android"', {
|
||||
'cflags_mozilla': [
|
||||
# This warning complains about important MOZ_EXPORT attributes
|
||||
# on forward declarations for Android API types.
|
||||
'-Wno-error=attributes',
|
||||
],
|
||||
}],
|
||||
['OS=="win"', {
|
||||
'include_dirs': [
|
||||
],
|
||||
@@ -348,7 +306,7 @@
|
||||
'cflags_mozilla': [
|
||||
],
|
||||
}],
|
||||
['OS=="mac" or OS=="ios"', {
|
||||
['OS=="mac"', {
|
||||
'include_dirs': [
|
||||
],
|
||||
'defines': [
|
||||
|
||||
@@ -26,12 +26,7 @@ using mozilla::LogLevel;
|
||||
static int gWebRtcTraceLoggingOn = 0;
|
||||
|
||||
|
||||
#if defined(ANDROID)
|
||||
static const char *default_tmp_dir = "/dev/null";
|
||||
static const char *default_log_name = "nspr";
|
||||
#else // Assume a POSIX environment
|
||||
NS_NAMED_LITERAL_CSTRING(default_log_name, "WebRTC.log");
|
||||
#endif
|
||||
|
||||
static PRLogModuleInfo* GetWebRtcTraceLog()
|
||||
{
|
||||
@@ -110,11 +105,6 @@ void ConfigWebRtcLog(uint32_t trace_mask, nsCString &aLogFile, nsCString &aAECLo
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(ANDROID)
|
||||
// Special case: use callback to pipe to NSPR logging.
|
||||
aLogFile.Assign(default_log_name);
|
||||
#else
|
||||
|
||||
webrtc::Trace::set_level_filter(trace_mask);
|
||||
|
||||
if (trace_mask != 0) {
|
||||
@@ -133,7 +123,6 @@ void ConfigWebRtcLog(uint32_t trace_mask, nsCString &aLogFile, nsCString &aAECLo
|
||||
tempDir->GetNativePath(aLogFile);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
|
||||
if (XRE_IsParentProcess()) {
|
||||
@@ -208,12 +197,6 @@ void ConfigAecLog(nsCString &aAECLogDir) {
|
||||
if (webrtc::Trace::aec_debug()) {
|
||||
return;
|
||||
}
|
||||
#if defined(ANDROID)
|
||||
// For AEC, do not use a default value: force the user to specify a directory.
|
||||
if (aAECLogDir.IsEmpty()) {
|
||||
aAECLogDir.Assign(default_tmp_dir);
|
||||
}
|
||||
#else
|
||||
if (aAECLogDir.IsEmpty()) {
|
||||
nsCOMPtr<nsIFile> tempDir;
|
||||
nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tempDir));
|
||||
@@ -223,7 +206,6 @@ void ConfigAecLog(nsCString &aAECLogDir) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
webrtc::Trace::set_aec_debug_filename(aAECLogDir.get());
|
||||
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
|
||||
if (XRE_IsParentProcess()) {
|
||||
|
||||
@@ -2114,12 +2114,7 @@ JsepSessionImpl::SetupDefaultCodecs()
|
||||
48000,
|
||||
2,
|
||||
960,
|
||||
#ifdef WEBRTC_GONK
|
||||
// TODO Move this elsewhere to be adaptive to rate - Bug 1207925
|
||||
16000 // B2G uses lower capture sampling rate
|
||||
#else
|
||||
40000
|
||||
#endif
|
||||
));
|
||||
|
||||
mSupportedCodecs.values.push_back(new JsepAudioCodecDescription(
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "CSFLog.h"
|
||||
#include "nspr.h"
|
||||
|
||||
#include "WebrtcMediaCodecVP8VideoCodec.h"
|
||||
#include "MediaCodecVideoCodec.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
static const char* logTag ="MediaCodecVideoCodec";
|
||||
|
||||
VideoEncoder* MediaCodecVideoCodec::CreateEncoder(CodecType aCodecType) {
|
||||
CSFLogDebug(logTag, "%s ", __FUNCTION__);
|
||||
if (aCodecType == CODEC_VP8) {
|
||||
return new WebrtcMediaCodecVP8VideoEncoder();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
VideoDecoder* MediaCodecVideoCodec::CreateDecoder(CodecType aCodecType) {
|
||||
CSFLogDebug(logTag, "%s ", __FUNCTION__);
|
||||
if (aCodecType == CODEC_VP8) {
|
||||
return new WebrtcMediaCodecVP8VideoDecoder();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef MediaCodecVideoCodec_h__
|
||||
#define MediaCodecVideoCodec_h__
|
||||
|
||||
#include "MediaConduitInterface.h"
|
||||
|
||||
namespace mozilla {
|
||||
class MediaCodecVideoCodec {
|
||||
public:
|
||||
enum CodecType {
|
||||
CODEC_VP8,
|
||||
};
|
||||
/**
|
||||
* Create encoder object for codec type |aCodecType|. Return |nullptr| when
|
||||
* failed.
|
||||
*/
|
||||
static VideoEncoder* CreateEncoder(CodecType aCodecType);
|
||||
|
||||
/**
|
||||
* Create decoder object for codec type |aCodecType|. Return |nullptr| when
|
||||
* failed.
|
||||
*/
|
||||
static VideoDecoder* CreateDecoder(CodecType aCodecType);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // MediaCodecVideoCodec_h__
|
||||
@@ -1,30 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "OMXVideoCodec.h"
|
||||
|
||||
#ifdef WEBRTC_GONK
|
||||
#include "WebrtcOMXH264VideoCodec.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
VideoEncoder*
|
||||
OMXVideoCodec::CreateEncoder(CodecType aCodecType)
|
||||
{
|
||||
if (aCodecType == CODEC_H264) {
|
||||
return new WebrtcOMXH264VideoEncoder();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
VideoDecoder*
|
||||
OMXVideoCodec::CreateDecoder(CodecType aCodecType) {
|
||||
if (aCodecType == CODEC_H264) {
|
||||
return new WebrtcOMXH264VideoDecoder();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef OMX_VIDEO_CODEC_H_
|
||||
#define OMX_VIDEO_CODEC_H_
|
||||
|
||||
#include "MediaConduitInterface.h"
|
||||
|
||||
namespace mozilla {
|
||||
class OMXVideoCodec {
|
||||
public:
|
||||
enum CodecType {
|
||||
CODEC_H264,
|
||||
};
|
||||
|
||||
/**
|
||||
* Create encoder object for codec type |aCodecType|. Return |nullptr| when
|
||||
* failed.
|
||||
*/
|
||||
static VideoEncoder* CreateEncoder(CodecType aCodecType);
|
||||
|
||||
/**
|
||||
* Create decoder object for codec type |aCodecType|. Return |nullptr| when
|
||||
* failed.
|
||||
*/
|
||||
static VideoDecoder* CreateDecoder(CodecType aCodecType);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // OMX_VIDEO_CODEC_H_
|
||||
@@ -679,15 +679,7 @@ WebrtcVideoConduit::ConfigureSendMediaCodec(const VideoCodecConfig* codecConfig)
|
||||
// width/height will be overridden on the first frame
|
||||
video_codec.width = 320;
|
||||
video_codec.height = 240;
|
||||
#ifdef MOZ_WEBRTC_OMX
|
||||
if (codecConfig->mType == webrtc::kVideoCodecH264) {
|
||||
video_codec.resolution_divisor = 16;
|
||||
} else {
|
||||
video_codec.resolution_divisor = 1; // We could try using it to handle odd resolutions
|
||||
}
|
||||
#else
|
||||
video_codec.resolution_divisor = 1; // We could try using it to handle odd resolutions
|
||||
#endif
|
||||
video_codec.qpMax = 56;
|
||||
video_codec.numberOfSimulcastStreams = 1;
|
||||
video_codec.simulcastStream[0].jsScaleDownBy =
|
||||
@@ -1896,8 +1888,6 @@ WebrtcVideoConduit::DeliverI420Frame(const webrtc::I420VideoFrame& webrtc_frame)
|
||||
}
|
||||
|
||||
#if 0
|
||||
//#ifndef MOZ_WEBRTC_OMX
|
||||
// XXX - this may not be possible on GONK with textures!
|
||||
if (mVideoLatencyTestEnable && mReceivingWidth && mReceivingHeight) {
|
||||
uint64_t now = PR_Now();
|
||||
uint64_t timestamp = 0;
|
||||
@@ -1967,9 +1957,6 @@ WebrtcVideoConduit::CodecConfigToWebRTCCodec(const VideoCodecConfig* codecInfo,
|
||||
|
||||
if (cinst.codecType == webrtc::kVideoCodecH264)
|
||||
{
|
||||
#ifdef MOZ_WEBRTC_OMX
|
||||
cinst.resolution_divisor = 16;
|
||||
#endif
|
||||
// cinst.codecSpecific.H264.profile = ?
|
||||
cinst.codecSpecific.H264.profile_byte = codecInfo->mProfile;
|
||||
cinst.codecSpecific.H264.constraints = codecInfo->mConstraints;
|
||||
|
||||
@@ -248,15 +248,9 @@ public:
|
||||
/**
|
||||
* Does DeliverFrame() support a null buffer and non-null handle
|
||||
* (video texture)?
|
||||
* B2G support it (when using HW video decoder with graphic buffer output).
|
||||
* XXX Investigate! Especially for Android
|
||||
*/
|
||||
virtual bool IsTextureSupported() override {
|
||||
#ifdef WEBRTC_GONK
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual uint64_t CodecPluginID() override;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,114 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef WebrtcMediaCodecVP8VideoCodec_h__
|
||||
#define WebrtcMediaCodecVP8VideoCodec_h__
|
||||
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
#include "MediaConduitInterface.h"
|
||||
#include "AudioConduit.h"
|
||||
#include "VideoConduit.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
struct EncodedFrame {
|
||||
uint32_t width_;
|
||||
uint32_t height_;
|
||||
uint32_t timeStamp_;
|
||||
uint64_t decode_timestamp_;
|
||||
};
|
||||
|
||||
class WebrtcAndroidMediaCodec;
|
||||
|
||||
class WebrtcMediaCodecVP8VideoEncoder : public WebrtcVideoEncoder {
|
||||
public:
|
||||
WebrtcMediaCodecVP8VideoEncoder();
|
||||
|
||||
virtual ~WebrtcMediaCodecVP8VideoEncoder() override;
|
||||
|
||||
// Implement VideoEncoder interface.
|
||||
virtual uint64_t PluginID() const override { return 0; }
|
||||
|
||||
virtual int32_t InitEncode(const webrtc::VideoCodec* codecSettings,
|
||||
int32_t numberOfCores,
|
||||
size_t maxPayloadSize) override;
|
||||
|
||||
virtual int32_t Encode(const webrtc::I420VideoFrame& inputImage,
|
||||
const webrtc::CodecSpecificInfo* codecSpecificInfo,
|
||||
const std::vector<webrtc::VideoFrameType>* frame_types) override;
|
||||
|
||||
virtual int32_t RegisterEncodeCompleteCallback(webrtc::EncodedImageCallback* callback) override;
|
||||
|
||||
virtual int32_t Release() override;
|
||||
|
||||
virtual int32_t SetChannelParameters(uint32_t packetLoss, int64_t rtt) override;
|
||||
|
||||
virtual int32_t SetRates(uint32_t newBitRate, uint32_t frameRate) override;
|
||||
|
||||
private:
|
||||
int32_t VerifyAndAllocate(const uint32_t minimumSize);
|
||||
bool ResetInputBuffers();
|
||||
bool ResetOutputBuffers();
|
||||
|
||||
size_t mMaxPayloadSize;
|
||||
uint32_t mTimestamp;
|
||||
webrtc::EncodedImage mEncodedImage;
|
||||
webrtc::EncodedImageCallback* mCallback;
|
||||
uint32_t mFrameWidth;
|
||||
uint32_t mFrameHeight;
|
||||
|
||||
WebrtcAndroidMediaCodec* mMediaCodecEncoder;
|
||||
|
||||
jobjectArray mInputBuffers;
|
||||
jobjectArray mOutputBuffers;
|
||||
};
|
||||
|
||||
class WebrtcMediaCodecVP8VideoDecoder : public WebrtcVideoDecoder {
|
||||
public:
|
||||
WebrtcMediaCodecVP8VideoDecoder();
|
||||
|
||||
virtual ~WebrtcMediaCodecVP8VideoDecoder() override;
|
||||
|
||||
// Implement VideoDecoder interface.
|
||||
virtual uint64_t PluginID() const override { return 0; }
|
||||
|
||||
virtual int32_t InitDecode(const webrtc::VideoCodec* codecSettings,
|
||||
int32_t numberOfCores) override;
|
||||
|
||||
virtual int32_t Decode(const webrtc::EncodedImage& inputImage,
|
||||
bool missingFrames,
|
||||
const webrtc::RTPFragmentationHeader* fragmentation,
|
||||
const webrtc::CodecSpecificInfo*
|
||||
codecSpecificInfo = NULL,
|
||||
int64_t renderTimeMs = -1) override;
|
||||
|
||||
virtual int32_t RegisterDecodeCompleteCallback(webrtc::DecodedImageCallback* callback) override;
|
||||
|
||||
virtual int32_t Release() override;
|
||||
|
||||
virtual int32_t Reset() override;
|
||||
|
||||
private:
|
||||
void DecodeFrame(EncodedFrame* frame);
|
||||
void RunCallback();
|
||||
bool ResetInputBuffers();
|
||||
bool ResetOutputBuffers();
|
||||
|
||||
webrtc::DecodedImageCallback* mCallback;
|
||||
|
||||
uint32_t mFrameWidth;
|
||||
uint32_t mFrameHeight;
|
||||
|
||||
WebrtcAndroidMediaCodec* mMediaCodecDecoder;
|
||||
jobjectArray mInputBuffers;
|
||||
jobjectArray mOutputBuffers;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // WebrtcMediaCodecVP8VideoCodec_h__
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,108 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef WEBRTC_GONK
|
||||
#pragma error WebrtcOMXH264VideoCodec works only on B2G.
|
||||
#endif
|
||||
|
||||
#ifndef WEBRTC_OMX_H264_CODEC_H_
|
||||
#define WEBRTC_OMX_H264_CODEC_H_
|
||||
|
||||
#include "AudioConduit.h"
|
||||
#include "VideoConduit.h"
|
||||
#include <foundation/ABase.h>
|
||||
#include <utils/RefBase.h>
|
||||
#include "OMXCodecWrapper.h"
|
||||
|
||||
namespace android {
|
||||
class OMXVideoEncoder;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class WebrtcOMXDecoder;
|
||||
class OMXOutputDrain;
|
||||
|
||||
// XXX see if we can reduce this
|
||||
#define WEBRTC_OMX_H264_MIN_DECODE_BUFFERS 10
|
||||
#define OMX_IDR_NEEDED_FOR_BITRATE 0
|
||||
|
||||
class WebrtcOMXH264VideoEncoder : public WebrtcVideoEncoder
|
||||
{
|
||||
public:
|
||||
WebrtcOMXH264VideoEncoder();
|
||||
|
||||
virtual ~WebrtcOMXH264VideoEncoder();
|
||||
|
||||
// Implement VideoEncoder interface.
|
||||
virtual uint64_t PluginID() const override { return 0; }
|
||||
|
||||
virtual int32_t InitEncode(const webrtc::VideoCodec* aCodecSettings,
|
||||
int32_t aNumOfCores,
|
||||
size_t aMaxPayloadSize) override;
|
||||
|
||||
virtual int32_t Encode(const webrtc::I420VideoFrame& aInputImage,
|
||||
const webrtc::CodecSpecificInfo* aCodecSpecificInfo,
|
||||
const std::vector<webrtc::VideoFrameType>* aFrameTypes) override;
|
||||
|
||||
virtual int32_t RegisterEncodeCompleteCallback(webrtc::EncodedImageCallback* aCallback) override;
|
||||
|
||||
virtual int32_t Release() override;
|
||||
|
||||
virtual int32_t SetChannelParameters(uint32_t aPacketLossRate,
|
||||
int64_t aRoundTripTimeMs) override;
|
||||
|
||||
virtual int32_t SetRates(uint32_t aBitRate, uint32_t aFrameRate) override;
|
||||
|
||||
private:
|
||||
nsAutoPtr<android::OMXVideoEncoder> mOMX;
|
||||
android::sp<android::OMXCodecReservation> mReservation;
|
||||
|
||||
webrtc::EncodedImageCallback* mCallback;
|
||||
RefPtr<OMXOutputDrain> mOutputDrain;
|
||||
uint32_t mWidth;
|
||||
uint32_t mHeight;
|
||||
uint32_t mFrameRate;
|
||||
uint32_t mBitRateKbps;
|
||||
#ifdef OMX_IDR_NEEDED_FOR_BITRATE
|
||||
uint32_t mBitRateAtLastIDR;
|
||||
TimeStamp mLastIDRTime;
|
||||
#endif
|
||||
bool mOMXConfigured;
|
||||
bool mOMXReconfigure;
|
||||
webrtc::EncodedImage mEncodedImage;
|
||||
};
|
||||
|
||||
class WebrtcOMXH264VideoDecoder : public WebrtcVideoDecoder
|
||||
{
|
||||
public:
|
||||
WebrtcOMXH264VideoDecoder();
|
||||
|
||||
virtual ~WebrtcOMXH264VideoDecoder();
|
||||
|
||||
// Implement VideoDecoder interface.
|
||||
virtual uint64_t PluginID() const override { return 0; }
|
||||
|
||||
virtual int32_t InitDecode(const webrtc::VideoCodec* aCodecSettings,
|
||||
int32_t aNumOfCores) override;
|
||||
virtual int32_t Decode(const webrtc::EncodedImage& aInputImage,
|
||||
bool aMissingFrames,
|
||||
const webrtc::RTPFragmentationHeader* aFragmentation,
|
||||
const webrtc::CodecSpecificInfo* aCodecSpecificInfo = nullptr,
|
||||
int64_t aRenderTimeMs = -1) override;
|
||||
virtual int32_t RegisterDecodeCompleteCallback(webrtc::DecodedImageCallback* callback) override;
|
||||
|
||||
virtual int32_t Release() override;
|
||||
|
||||
virtual int32_t Reset() override;
|
||||
|
||||
private:
|
||||
webrtc::DecodedImageCallback* mCallback;
|
||||
RefPtr<WebrtcOMXDecoder> mOMX;
|
||||
android::sp<android::OMXCodecReservation> mReservation;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // WEBRTC_OMX_H264_CODEC_H_
|
||||
@@ -28,10 +28,6 @@
|
||||
#include "MediaStreamVideoSink.h"
|
||||
#include "VideoUtils.h"
|
||||
#include "VideoStreamTrack.h"
|
||||
#ifdef WEBRTC_GONK
|
||||
#include "GrallocImages.h"
|
||||
#include "mozilla/layers/GrallocTextureClient.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "nsError.h"
|
||||
@@ -285,72 +281,6 @@ protected:
|
||||
}
|
||||
|
||||
ImageFormat format = aImage->GetFormat();
|
||||
#ifdef WEBRTC_GONK
|
||||
GrallocImage* nativeImage = aImage->AsGrallocImage();
|
||||
if (nativeImage) {
|
||||
android::sp<android::GraphicBuffer> graphicBuffer = nativeImage->GetGraphicBuffer();
|
||||
int pixelFormat = graphicBuffer->getPixelFormat(); /* PixelFormat is an enum == int */
|
||||
mozilla::VideoType destFormat;
|
||||
switch (pixelFormat) {
|
||||
case HAL_PIXEL_FORMAT_YV12:
|
||||
// all android must support this
|
||||
destFormat = mozilla::kVideoYV12;
|
||||
break;
|
||||
case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP:
|
||||
destFormat = mozilla::kVideoNV21;
|
||||
break;
|
||||
case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_P:
|
||||
destFormat = mozilla::kVideoI420;
|
||||
break;
|
||||
default:
|
||||
// XXX Bug NNNNNNN
|
||||
// use http://dxr.mozilla.org/mozilla-central/source/content/media/omx/I420ColorConverterHelper.cpp
|
||||
// to convert unknown types (OEM-specific) to I420
|
||||
MOZ_MTLOG(ML_ERROR, "Un-handled GRALLOC buffer type:" << pixelFormat);
|
||||
MOZ_CRASH();
|
||||
}
|
||||
void *basePtr;
|
||||
graphicBuffer->lock(android::GraphicBuffer::USAGE_SW_READ_MASK, &basePtr);
|
||||
uint32_t width = graphicBuffer->getWidth();
|
||||
uint32_t height = graphicBuffer->getHeight();
|
||||
// XXX gralloc buffer's width and stride could be different depends on implementations.
|
||||
|
||||
if (destFormat != mozilla::kVideoI420) {
|
||||
unsigned char *video_frame = static_cast<unsigned char*>(basePtr);
|
||||
webrtc::I420VideoFrame i420_frame;
|
||||
int stride_y = width;
|
||||
int stride_uv = (width + 1) / 2;
|
||||
int target_width = width;
|
||||
int target_height = height;
|
||||
if (i420_frame.CreateEmptyFrame(target_width,
|
||||
abs(target_height),
|
||||
stride_y,
|
||||
stride_uv, stride_uv) < 0) {
|
||||
MOZ_ASSERT(false, "Can't allocate empty i420frame");
|
||||
return;
|
||||
}
|
||||
webrtc::VideoType commonVideoType =
|
||||
webrtc::RawVideoTypeToCommonVideoVideoType(
|
||||
static_cast<webrtc::RawVideoType>((int)destFormat));
|
||||
if (ConvertToI420(commonVideoType, video_frame, 0, 0, width, height,
|
||||
I420SIZE(width, height), webrtc::kVideoRotation_0,
|
||||
&i420_frame)) {
|
||||
MOZ_ASSERT(false, "Can't convert video type for sending to I420");
|
||||
return;
|
||||
}
|
||||
i420_frame.set_ntp_time_ms(0);
|
||||
VideoFrameConverted(i420_frame);
|
||||
} else {
|
||||
VideoFrameConverted(static_cast<unsigned char*>(basePtr),
|
||||
I420SIZE(width, height),
|
||||
width,
|
||||
height,
|
||||
destFormat, 0);
|
||||
}
|
||||
graphicBuffer->unlock();
|
||||
return;
|
||||
} else
|
||||
#endif
|
||||
if (format == ImageFormat::PLANAR_YCBCR) {
|
||||
// Cast away constness b/c some of the accessors are non-const
|
||||
PlanarYCbCrImage* yuv = const_cast<PlanarYCbCrImage *>(
|
||||
@@ -2198,13 +2128,6 @@ public:
|
||||
|
||||
image_ = yuvImage;
|
||||
}
|
||||
#ifdef WEBRTC_GONK
|
||||
else {
|
||||
// Decoder produced video frame that can be appended to the track directly.
|
||||
MOZ_ASSERT(video_image);
|
||||
image_ = video_image;
|
||||
}
|
||||
#endif // WEBRTC_GONK
|
||||
#endif // MOZILLA_INTERNAL_API
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "logging.h"
|
||||
#include "nsIGfxInfo.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "PeerConnectionImpl.h"
|
||||
#include "PeerConnectionMedia.h"
|
||||
@@ -28,18 +26,6 @@
|
||||
#endif
|
||||
|
||||
#include "GmpVideoCodec.h"
|
||||
#ifdef MOZ_WEBRTC_OMX
|
||||
#include "OMXVideoCodec.h"
|
||||
#include "OMXCodecWrapper.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WEBRTC_MEDIACODEC
|
||||
#include "MediaCodecVideoCodec.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
#include "mozilla/Preferences.h"
|
||||
#endif
|
||||
|
||||
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
|
||||
#include "WebrtcGmpVideoCodec.h"
|
||||
@@ -979,60 +965,7 @@ MediaPipelineFactory::EnsureExternalCodec(VideoSessionConduit& aConduit,
|
||||
bool aIsSend)
|
||||
{
|
||||
if (aConfig->mName == "VP8") {
|
||||
#ifdef MOZ_WEBRTC_MEDIACODEC
|
||||
if (aIsSend) {
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
bool enabled = mozilla::Preferences::GetBool("media.navigator.hardware.vp8_encode.acceleration_enabled", false);
|
||||
#else
|
||||
bool enabled = false;
|
||||
#endif
|
||||
if (enabled) {
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
|
||||
if (gfxInfo) {
|
||||
int32_t status;
|
||||
nsCString discardFailureId;
|
||||
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_ENCODE, discardFailureId, &status))) {
|
||||
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
|
||||
NS_WARNING("VP8 encoder hardware is not whitelisted: disabling.\n");
|
||||
} else {
|
||||
VideoEncoder* encoder = nullptr;
|
||||
encoder = MediaCodecVideoCodec::CreateEncoder(MediaCodecVideoCodec::CodecType::CODEC_VP8);
|
||||
if (encoder) {
|
||||
return aConduit.SetExternalSendCodec(aConfig, encoder);
|
||||
}
|
||||
return kMediaConduitNoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
bool enabled = mozilla::Preferences::GetBool("media.navigator.hardware.vp8_decode.acceleration_enabled", false);
|
||||
#else
|
||||
bool enabled = false;
|
||||
#endif
|
||||
if (enabled) {
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
|
||||
if (gfxInfo) {
|
||||
int32_t status;
|
||||
nsCString discardFailureId;
|
||||
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_DECODE, discardFailureId, &status))) {
|
||||
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
|
||||
NS_WARNING("VP8 decoder hardware is not whitelisted: disabling.\n");
|
||||
} else {
|
||||
VideoDecoder* decoder;
|
||||
decoder = MediaCodecVideoCodec::CreateDecoder(MediaCodecVideoCodec::CodecType::CODEC_VP8);
|
||||
if (decoder) {
|
||||
return aConduit.SetExternalRecvCodec(aConfig, decoder);
|
||||
}
|
||||
return kMediaConduitNoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return kMediaConduitNoError;
|
||||
return kMediaConduitNoError;
|
||||
}
|
||||
if (aConfig->mName == "VP9") {
|
||||
return kMediaConduitNoError;
|
||||
@@ -1043,25 +976,13 @@ MediaPipelineFactory::EnsureExternalCodec(VideoSessionConduit& aConduit,
|
||||
}
|
||||
// Register H.264 codec.
|
||||
if (aIsSend) {
|
||||
VideoEncoder* encoder = nullptr;
|
||||
#ifdef MOZ_WEBRTC_OMX
|
||||
encoder =
|
||||
OMXVideoCodec::CreateEncoder(OMXVideoCodec::CodecType::CODEC_H264);
|
||||
#else
|
||||
encoder = GmpVideoCodec::CreateEncoder();
|
||||
#endif
|
||||
VideoEncoder* encoder = GmpVideoCodec::CreateEncoder();
|
||||
if (encoder) {
|
||||
return aConduit.SetExternalSendCodec(aConfig, encoder);
|
||||
}
|
||||
return kMediaConduitInvalidSendCodec;
|
||||
}
|
||||
VideoDecoder* decoder = nullptr;
|
||||
#ifdef MOZ_WEBRTC_OMX
|
||||
decoder =
|
||||
OMXVideoCodec::CreateDecoder(OMXVideoCodec::CodecType::CODEC_H264);
|
||||
#else
|
||||
decoder = GmpVideoCodec::CreateDecoder();
|
||||
#endif
|
||||
VideoDecoder* decoder = GmpVideoCodec::CreateDecoder();
|
||||
if (decoder) {
|
||||
return aConduit.SetExternalRecvCodec(aConfig, decoder);
|
||||
}
|
||||
|
||||
@@ -127,11 +127,6 @@
|
||||
#endif
|
||||
#include "mozilla/dom/PeerConnectionObserverEnumsBinding.h"
|
||||
|
||||
#ifdef MOZ_WEBRTC_OMX
|
||||
#include "OMXVideoCodec.h"
|
||||
#include "OMXCodecWrapper.h"
|
||||
#endif
|
||||
|
||||
#define ICE_PARSING "In RTCConfiguration passed to RTCPeerConnection constructor"
|
||||
|
||||
using namespace mozilla;
|
||||
@@ -921,34 +916,6 @@ class ConfigureCodec {
|
||||
mRedUlpfecEnabled(false),
|
||||
mDtmfEnabled(false)
|
||||
{
|
||||
#ifdef MOZ_WEBRTC_OMX
|
||||
// Check to see if what HW codecs are available (not in use) at this moment.
|
||||
// Note that streaming video decode can reserve a decoder
|
||||
|
||||
// XXX See bug 1018791 Implement W3 codec reservation policy
|
||||
// Note that currently, OMXCodecReservation needs to be held by an sp<> because it puts
|
||||
// 'this' into an sp<EventListener> to talk to the resource reservation code
|
||||
|
||||
// This pref is a misnomer; it is solely for h264 _hardware_ support.
|
||||
branch->GetBoolPref("media.peerconnection.video.h264_enabled",
|
||||
&mHardwareH264Enabled);
|
||||
|
||||
if (mHardwareH264Enabled) {
|
||||
// Ok, it is preffed on. Can we actually do it?
|
||||
android::sp<android::OMXCodecReservation> encode = new android::OMXCodecReservation(true);
|
||||
android::sp<android::OMXCodecReservation> decode = new android::OMXCodecReservation(false);
|
||||
|
||||
// Currently we just check if they're available right now, which will fail if we're
|
||||
// trying to call ourself, for example. It will work for most real-world cases, like
|
||||
// if we try to add a person to a 2-way call to make a 3-way mesh call
|
||||
if (encode->ReserveOMXCodec() && decode->ReserveOMXCodec()) {
|
||||
CSFLogDebug( logTag, "%s: H264 hardware codec available", __FUNCTION__);
|
||||
mHardwareH264Supported = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MOZ_WEBRTC_OMX
|
||||
|
||||
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
|
||||
mSoftwareH264Enabled = PeerConnectionCtx::GetInstance()->gmpHasH264();
|
||||
#else
|
||||
@@ -963,11 +930,6 @@ class ConfigureCodec {
|
||||
|
||||
branch->GetIntPref("media.navigator.video.h264.max_br", &mH264MaxBr);
|
||||
|
||||
#ifdef MOZ_WEBRTC_OMX
|
||||
// Level 1.2; but let's allow CIF@30 or QVGA@30+ by default
|
||||
mH264MaxMbps = 11880;
|
||||
#endif
|
||||
|
||||
branch->GetIntPref("media.navigator.video.h264.max_mbps", &mH264MaxMbps);
|
||||
|
||||
branch->GetBoolPref("media.peerconnection.video.vp9_enabled",
|
||||
|
||||
@@ -670,7 +670,6 @@ typedef struct sdp_fmtp {
|
||||
uint16_t par_height;
|
||||
/* PAR=12:11 implies par_width=12, par_height=11 */
|
||||
|
||||
/* CPCF should be a float. IOS does not support float and so it is uint16_t */
|
||||
/* For portable stack, CPCF should be defined as float and the parsing should
|
||||
* be modified accordingly */
|
||||
uint16_t cpcf;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
if CONFIG['OS_TARGET'] in ('Darwin', 'Android'):
|
||||
if CONFIG['OS_TARGET'] == 'Darwin':
|
||||
DEFINES['GTEST_USE_OWN_TR1_TUPLE'] = 1
|
||||
|
||||
for var in ('MOZILLA_EXTERNAL_LINKAGE', 'USE_FAKE_MEDIA_STREAMS', 'USE_FAKE_PCOBSERVER',
|
||||
@@ -42,11 +42,6 @@ LOCAL_INCLUDES += [
|
||||
'/xpcom/base',
|
||||
]
|
||||
|
||||
if CONFIG['OS_TARGET'] == 'Android':
|
||||
LOCAL_INCLUDES += [
|
||||
'/media/mtransport/third_party/nrappkit/src/port/android/include',
|
||||
]
|
||||
|
||||
if CONFIG['OS_TARGET'] == 'Linux':
|
||||
LOCAL_INCLUDES += [
|
||||
'/media/mtransport/third_party/nrappkit/src/port/linux/include',
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# TODO: bug 1172551 - get these tests working on iOS
|
||||
if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'uikit':
|
||||
GeckoCppUnitTests([
|
||||
'jsep_session_unittest',
|
||||
|
||||
@@ -30,8 +30,7 @@ deps_os = {
|
||||
|
||||
# Define rules for which include paths are allowed in our source.
|
||||
include_rules = [
|
||||
# Base is only used to build Android APK tests and may not be referenced by
|
||||
# WebRTC production code.
|
||||
# Base may not be referenced by WebRTC production code.
|
||||
'-base',
|
||||
'-chromium',
|
||||
'+gflags',
|
||||
@@ -100,4 +99,3 @@ hooks = [
|
||||
Var('extra_gyp_flag')],
|
||||
},
|
||||
]
|
||||
|
||||
@@ -770,7 +770,7 @@ endif
|
||||
|
||||
quiet_cmd_regen_makefile = ACTION Regenerating $@
|
||||
cmd_regen_makefile = ./build/gyp_chromium -fmake --ignore-environment "--toplevel-dir=." -I/home/jesup/src/mozilla/webrtc_import7/webrtc_update/trunk/build/common.gypi -I/home/jesup/src/mozilla/webrtc_import7/webrtc_update/trunk/supplement/supplement.gypi "--depth=." peerconnection_all.gyp
|
||||
Makefile: third_party/webrtc/build/common.gypi third_party/webrtc/common_video/common_video.gyp third_party/webrtc/video_engine/video_engine.gyp third_party/webrtc/modules/audio_coding/neteq/neteq.gypi third_party/libvpx/libvpx_srcs_arm.gypi build/filename_rules.gypi third_party/webrtc/modules/media_file/source/media_file.gypi third_party/jsoncpp/jsoncpp.gyp base/base.gyp third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi third_party/webrtc/modules/rtp_rtcp/source/rtp_rtcp_tests.gypi third_party/webrtc/modules/audio_processing/audio_processing.gypi third_party/webrtc/modules/video_processing/main/source/video_processing.gypi third_party/webrtc/system_wrappers/source/system_wrappers.gyp supplement/supplement.gypi third_party/webrtc/modules/audio_coding/codecs/ilbc/ilbc.gypi third_party/webrtc/modules/utility/source/utility.gypi third_party/webrtc/voice_engine/test/voice_engine_tests.gypi build/internal/release_impl.gypi third_party/webrtc/modules/audio_coding/codecs/isac/isacfix_test.gypi third_party/yasm/yasm_compile.gypi net/net.gyp third_party/webrtc/modules/audio_coding/codecs/isac/isac_test.gypi third_party/webrtc/modules/audio_coding/codecs/cng/cng.gypi third_party/libvpx/libvpx_srcs_x86_64.gypi third_party/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.gypi third_party/webrtc/modules/audio_device/audio_device.gypi third_party/libjingle/libjingle.gyp build/internal/release_impl_official.gypi build/internal/release_defaults.gypi third_party/webrtc/modules/rtp_rtcp/source/rtp_rtcp.gypi third_party/webrtc/modules/video_render/main/source/video_render.gypi third_party/libjpeg_turbo/libjpeg.gyp third_party/webrtc/modules/rtp_rtcp/test/testAPI/test_api.gypi third_party/webrtc/modules/udp_transport/source/udp_transport.gypi third_party/libvpx/libvpx_srcs_arm_neon.gypi third_party/webrtc/voice_engine/voice_engine.gyp third_party/webrtc/common_audio/resampler/resampler.gypi third_party/webrtc/modules/audio_conference_mixer/source/audio_conference_mixer.gypi build/win_precompile.gypi third_party/expat/expat.gyp third_party/webrtc/modules/video_coding/main/source/video_coding_test.gypi third_party/yasm/yasm.gyp third_party/webrtc/modules/video_capture/main/source/video_capture.gypi third_party/webrtc/video_engine/test/libvietest/libvietest.gypi third_party/webrtc/modules/video_coding/codecs/vp8/vp8.gyp third_party/webrtc/modules/bitrate_controller/bitrate_controller.gypi third_party/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.gypi build/ios/mac_build.gypi third_party/webrtc/modules/video_coding/main/source/video_coding.gypi third_party/webrtc/modules/audio_coding/main/source/audio_coding_module.gypi build/release.gypi peerconnection.gyp build/common.gypi third_party/webrtc/video_engine/video_engine_core.gypi third_party/webrtc/build/arm_neon.gypi third_party/libvpx/libvpx.gyp third_party/webrtc/common_audio/common_audio.gyp third_party/libyuv/libyuv.gyp third_party/webrtc/modules/audio_coding/codecs/isac/main/source/isac.gypi third_party/webrtc/modules/video_processing/main/test/vpm_tests.gypi third_party/webrtc/voice_engine/voice_engine_core.gypi third_party/webrtc/modules/rtp_rtcp/test/testFec/test_fec.gypi third_party/webrtc/modules/video_coding/codecs/tools/video_codecs_tools.gypi third_party/libsrtp/libsrtp.gyp peerconnection_all.gyp third_party/webrtc/modules/audio_coding/codecs/g711/g711.gypi third_party/webrtc/modules/audio_processing/audio_processing_tests.gypi third_party/libvpx/libvpx_srcs_x86.gypi third_party/webrtc/modules/modules.gyp third_party/webrtc/common_audio/signal_processing/signal_processing.gypi third_party/webrtc/video_engine/test/auto_test/vie_auto_test.gypi third_party/libvpx/libvpx_srcs_mips.gypi third_party/webrtc/common_audio/vad/vad.gypi third_party/webrtc/modules/video_coding/codecs/test/video_codecs_test_framework.gypi third_party/webrtc/modules/video_coding/codecs/i420/main/source/i420.gypi third_party/webrtc/modules/audio_coding/codecs/g722/g722.gypi third_party/webrtc/modules/video_coding/codecs/test_framework/test_framework.gypi third_party/webrtc/build/protoc.gypi third_party/protobuf/protobuf.gyp
|
||||
Makefile: third_party/webrtc/build/common.gypi third_party/webrtc/common_video/common_video.gyp third_party/webrtc/video_engine/video_engine.gyp third_party/webrtc/modules/audio_coding/neteq/neteq.gypi third_party/libvpx/libvpx_srcs_arm.gypi build/filename_rules.gypi third_party/webrtc/modules/media_file/source/media_file.gypi third_party/jsoncpp/jsoncpp.gyp base/base.gyp third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi third_party/webrtc/modules/rtp_rtcp/source/rtp_rtcp_tests.gypi third_party/webrtc/modules/audio_processing/audio_processing.gypi third_party/webrtc/modules/video_processing/main/source/video_processing.gypi third_party/webrtc/system_wrappers/source/system_wrappers.gyp supplement/supplement.gypi third_party/webrtc/modules/audio_coding/codecs/ilbc/ilbc.gypi third_party/webrtc/modules/utility/source/utility.gypi third_party/webrtc/voice_engine/test/voice_engine_tests.gypi build/internal/release_impl.gypi third_party/webrtc/modules/audio_coding/codecs/isac/isacfix_test.gypi third_party/yasm/yasm_compile.gypi net/net.gyp third_party/webrtc/modules/audio_coding/codecs/isac/isac_test.gypi third_party/webrtc/modules/audio_coding/codecs/cng/cng.gypi third_party/libvpx/libvpx_srcs_x86_64.gypi third_party/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.gypi third_party/webrtc/modules/audio_device/audio_device.gypi third_party/libjingle/libjingle.gyp build/internal/release_impl_official.gypi build/internal/release_defaults.gypi third_party/webrtc/modules/rtp_rtcp/source/rtp_rtcp.gypi third_party/webrtc/modules/video_render/main/source/video_render.gypi third_party/libjpeg_turbo/libjpeg.gyp third_party/webrtc/modules/rtp_rtcp/test/testAPI/test_api.gypi third_party/webrtc/modules/udp_transport/source/udp_transport.gypi third_party/libvpx/libvpx_srcs_arm_neon.gypi third_party/webrtc/voice_engine/voice_engine.gyp third_party/webrtc/common_audio/resampler/resampler.gypi third_party/webrtc/modules/audio_conference_mixer/source/audio_conference_mixer.gypi build/win_precompile.gypi third_party/expat/expat.gyp third_party/webrtc/modules/video_coding/main/source/video_coding_test.gypi third_party/yasm/yasm.gyp third_party/webrtc/modules/video_capture/main/source/video_capture.gypi third_party/webrtc/video_engine/test/libvietest/libvietest.gypi third_party/webrtc/modules/video_coding/codecs/vp8/vp8.gyp third_party/webrtc/modules/bitrate_controller/bitrate_controller.gypi third_party/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.gypi third_party/webrtc/modules/video_coding/main/source/video_coding.gypi third_party/webrtc/modules/audio_coding/main/source/audio_coding_module.gypi build/release.gypi peerconnection.gyp build/common.gypi third_party/webrtc/video_engine/video_engine_core.gypi third_party/webrtc/build/arm_neon.gypi third_party/libvpx/libvpx.gyp third_party/webrtc/common_audio/common_audio.gyp third_party/libyuv/libyuv.gyp third_party/webrtc/modules/audio_coding/codecs/isac/main/source/isac.gypi third_party/webrtc/modules/video_processing/main/test/vpm_tests.gypi third_party/webrtc/voice_engine/voice_engine_core.gypi third_party/webrtc/modules/rtp_rtcp/test/testFec/test_fec.gypi third_party/webrtc/modules/video_coding/codecs/tools/video_codecs_tools.gypi third_party/libsrtp/libsrtp.gyp peerconnection_all.gyp third_party/webrtc/modules/audio_coding/codecs/g711/g711.gypi third_party/webrtc/modules/audio_processing/audio_processing_tests.gypi third_party/libvpx/libvpx_srcs_x86.gypi third_party/webrtc/modules/modules.gyp third_party/webrtc/common_audio/signal_processing/signal_processing.gypi third_party/webrtc/video_engine/test/auto_test/vie_auto_test.gypi third_party/libvpx/libvpx_srcs_mips.gypi third_party/webrtc/common_audio/vad/vad.gypi third_party/webrtc/modules/video_coding/codecs/test/video_codecs_test_framework.gypi third_party/webrtc/modules/video_coding/codecs/i420/main/source/i420.gypi third_party/webrtc/modules/audio_coding/codecs/g722/g722.gypi third_party/webrtc/modules/video_coding/codecs/test_framework/test_framework.gypi third_party/webrtc/build/protoc.gypi third_party/protobuf/protobuf.gyp
|
||||
$(call do_cmd,regen_makefile)
|
||||
|
||||
# "all" is a concatenation of the "all" targets from all the included
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
'temp_gyp/googleurl.gyp:*',
|
||||
],
|
||||
'conditions': [
|
||||
['OS!="ios"', {
|
||||
['1==1', {
|
||||
'dependencies': [
|
||||
'../cc/cc_tests.gyp:*',
|
||||
'../chrome/chrome.gyp:*',
|
||||
@@ -64,17 +64,17 @@
|
||||
'<(libjpeg_gyp_path):*',
|
||||
],
|
||||
}],
|
||||
['os_posix==1 and OS!="android" and OS!="ios"', {
|
||||
['os_posix==1', {
|
||||
'dependencies': [
|
||||
'../third_party/yasm/yasm.gyp:*#host',
|
||||
],
|
||||
}],
|
||||
['OS=="mac" or OS=="ios" or OS=="win"', {
|
||||
['OS=="mac" or OS=="win"', {
|
||||
'dependencies': [
|
||||
'../third_party/nss/nss.gyp:*',
|
||||
],
|
||||
}],
|
||||
['OS=="win" or OS=="ios" or OS=="linux"', {
|
||||
['OS=="win" or OS=="linux"', {
|
||||
'dependencies': [
|
||||
'../breakpad/breakpad.gyp:*',
|
||||
],
|
||||
@@ -184,7 +184,7 @@
|
||||
'temp_gyp/googleurl.gyp:googleurl_unittests',
|
||||
],
|
||||
'conditions': [
|
||||
['OS!="ios"', {
|
||||
['1==1', {
|
||||
'dependencies': [
|
||||
'../cc/cc_tests.gyp:cc_unittests',
|
||||
'../chrome/chrome.gyp:browser_tests',
|
||||
@@ -246,16 +246,8 @@
|
||||
}, # target_name: chromium_2010_builder_tests
|
||||
],
|
||||
'conditions': [
|
||||
['OS!="ios"', {
|
||||
['1==1', {
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'chromium_builder_nacl_win_integration',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'chromium_builder_qa', # needed for pyauto
|
||||
'chromium_builder_tests',
|
||||
],
|
||||
}, # target_name: chromium_builder_nacl_win_integration
|
||||
{
|
||||
'target_name': 'chromium_builder_perf',
|
||||
'type': 'none',
|
||||
@@ -576,14 +568,6 @@
|
||||
'../webkit/webkit.gyp:pull_in_DumpRenderTree',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'chromium_builder_qa_nacl_win64',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'chromium_builder_qa', # needed for pyauto
|
||||
'../chrome/chrome.gyp:chrome_nacl_win64',
|
||||
],
|
||||
}, # target_name: chromium_builder_qa_nacl_win64
|
||||
], # targets
|
||||
'conditions': [
|
||||
['branding=="Chrome"', {
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
# This is all.gyp file for Android to prevent breakage in Android and other
|
||||
# platform; It will be churning a lot in the short term and eventually be merged
|
||||
# into all.gyp.
|
||||
|
||||
{
|
||||
'variables': {
|
||||
# A hook that can be overridden in other repositories to add additional
|
||||
# compilation targets to 'All'
|
||||
'android_app_targets%': [],
|
||||
},
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'All',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'../content/content.gyp:content_shell_apk',
|
||||
'<@(android_app_targets)',
|
||||
'android_builder_tests',
|
||||
'../android_webview/android_webview.gyp:android_webview_apk',
|
||||
'../chrome/chrome.gyp:chromium_testshell',
|
||||
],
|
||||
}, # target_name: All
|
||||
{
|
||||
# The current list of tests for android. This is temporary
|
||||
# until the full set supported. If adding a new test here,
|
||||
# please also add it to build/android/run_tests.py, else the
|
||||
# test is not run.
|
||||
#
|
||||
# WARNING:
|
||||
# Do not add targets here without communicating the implications
|
||||
# on tryserver triggers and load. Discuss with jrg please.
|
||||
'target_name': 'android_builder_tests',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'../base/android/jni_generator/jni_generator.gyp:jni_generator_tests',
|
||||
'../base/base.gyp:base_unittests',
|
||||
'../cc/cc_tests.gyp:cc_unittests',
|
||||
'../chrome/chrome.gyp:unit_tests',
|
||||
'../content/content.gyp:content_shell_test_apk',
|
||||
'../content/content.gyp:content_unittests',
|
||||
'../gpu/gpu.gyp:gpu_unittests',
|
||||
'../ipc/ipc.gyp:ipc_tests',
|
||||
'../media/media.gyp:media_unittests',
|
||||
'../net/net.gyp:net_unittests',
|
||||
'../sql/sql.gyp:sql_unittests',
|
||||
'../sync/sync.gyp:sync_unit_tests',
|
||||
'../third_party/WebKit/Source/WebKit/chromium/All.gyp:*',
|
||||
'../tools/android/device_stats_monitor/device_stats_monitor.gyp:device_stats_monitor',
|
||||
'../tools/android/fake_dns/fake_dns.gyp:fake_dns',
|
||||
'../tools/android/forwarder2/forwarder.gyp:forwarder2',
|
||||
'../tools/android/md5sum/md5sum.gyp:md5sum',
|
||||
'../ui/ui.gyp:ui_unittests',
|
||||
# From here down: not added to run_tests.py yet.
|
||||
'../jingle/jingle.gyp:jingle_unittests',
|
||||
# Required by ui_unittests.
|
||||
# TODO(wangxianzhu): It'd better let ui_unittests depend on it, but
|
||||
# this would cause circular gyp dependency which needs refactoring the
|
||||
# gyps to resolve.
|
||||
'../chrome/chrome_resources.gyp:packed_resources',
|
||||
],
|
||||
'conditions': [
|
||||
['linux_breakpad==1', {
|
||||
'dependencies': [
|
||||
'../breakpad/breakpad.gyp:breakpad_unittests',
|
||||
],
|
||||
}],
|
||||
['"<(gtest_target_type)"=="shared_library"', {
|
||||
'dependencies': [
|
||||
# The first item is simply the template. We add as a dep
|
||||
# to make sure it builds in ungenerated form. TODO(jrg):
|
||||
# once stable, transition to a test-only (optional)
|
||||
# target.
|
||||
'../testing/android/native_test.gyp:native_test_apk',
|
||||
# Unit test bundles packaged as an apk.
|
||||
'../base/base.gyp:base_unittests_apk',
|
||||
'../cc/cc_tests.gyp:cc_unittests_apk',
|
||||
'../chrome/chrome.gyp:unit_tests_apk',
|
||||
'../content/content.gyp:content_unittests_apk',
|
||||
'../gpu/gpu.gyp:gpu_unittests_apk',
|
||||
'../ipc/ipc.gyp:ipc_tests_apk',
|
||||
'../media/media.gyp:media_unittests_apk',
|
||||
'../net/net.gyp:net_unittests_apk',
|
||||
'../sql/sql.gyp:sql_unittests_apk',
|
||||
'../sync/sync.gyp:sync_unit_tests_apk',
|
||||
'../ui/ui.gyp:ui_unittests_apk',
|
||||
'../android_webview/android_webview.gyp:android_webview_test_apk',
|
||||
'../chrome/chrome.gyp:chromium_testshell_test_apk',
|
||||
],
|
||||
}],
|
||||
],
|
||||
},
|
||||
{
|
||||
# Experimental / in-progress targets that are expected to fail
|
||||
# but we still try to compile them on bots (turning the stage
|
||||
# orange, not red).
|
||||
'target_name': 'android_experimental',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
],
|
||||
},
|
||||
{
|
||||
# In-progress targets that are expected to fail and are NOT run
|
||||
# on any bot.
|
||||
'target_name': 'android_in_progress',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'../content/content.gyp:content_browsertests',
|
||||
],
|
||||
},
|
||||
], # targets
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2012 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.
|
||||
#
|
||||
# A collection of functions useful for maintaining android devices
|
||||
|
||||
|
||||
# Run an adb command on all connected device in parallel.
|
||||
# Usage: adb_all command line to eval. Quoting is optional.
|
||||
#
|
||||
# Examples:
|
||||
# adb_all install Chrome.apk
|
||||
# adb_all 'shell cat /path/to/file'
|
||||
#
|
||||
adb_all() {
|
||||
if [[ $# == 0 ]]; then
|
||||
echo "Usage: adb_all <adb command>. Quoting is optional."
|
||||
echo "Example: adb_all install Chrome.apk"
|
||||
return 1
|
||||
fi
|
||||
local DEVICES=$(adb_get_devices -b)
|
||||
local NUM_DEVICES=$(echo $DEVICES | wc -w)
|
||||
if (( $NUM_DEVICES > 1 )); then
|
||||
echo "Looping over $NUM_DEVICES devices"
|
||||
fi
|
||||
_adb_multi "$DEVICES" "$*"
|
||||
}
|
||||
|
||||
|
||||
# Run a command on each connected device. Quoting the command is suggested but
|
||||
# not required. The script setups up variable DEVICE to correspond to the
|
||||
# current serial number. Intended for complex one_liners that don't work in
|
||||
# adb_all
|
||||
# Usage: adb_device_loop 'command line to eval'
|
||||
adb_device_loop() {
|
||||
if [[ $# == 0 ]]; then
|
||||
echo "Intended for more complex one-liners that cannot be done with" \
|
||||
"adb_all."
|
||||
echo 'Usage: adb_device_loop "echo $DEVICE: $(adb root &&' \
|
||||
'adb shell cat /data/local.prop)"'
|
||||
return 1
|
||||
fi
|
||||
local DEVICES=$(adb_get_devices)
|
||||
if [[ -z $DEVICES ]]; then
|
||||
return
|
||||
fi
|
||||
# Do not change DEVICE variable name - part of api
|
||||
for DEVICE in $DEVICES; do
|
||||
DEV_TYPE=$(adb -s $DEVICE shell getprop ro.product.device | sed 's/\r//')
|
||||
echo "Running on $DEVICE ($DEV_TYPE)"
|
||||
ANDROID_SERIAL=$DEVICE eval "$*"
|
||||
done
|
||||
}
|
||||
|
||||
# Erases data from any devices visible on adb. To preserve a device,
|
||||
# disconnect it or:
|
||||
# 1) Reboot it into fastboot with 'adb reboot bootloader'
|
||||
# 2) Run wipe_all_devices to wipe remaining devices
|
||||
# 3) Restore device it with 'fastboot reboot'
|
||||
#
|
||||
# Usage: wipe_all_devices [-f]
|
||||
#
|
||||
wipe_all_devices() {
|
||||
if [[ -z $(which adb) || -z $(which fastboot) ]]; then
|
||||
echo "aborting: adb and fastboot not in path"
|
||||
return 1
|
||||
elif ! $(groups | grep -q 'plugdev'); then
|
||||
echo "If fastboot fails, run: 'sudo adduser $(whoami) plugdev'"
|
||||
fi
|
||||
|
||||
local DEVICES=$(adb_get_devices -b)
|
||||
|
||||
if [[ $1 != '-f' ]]; then
|
||||
echo "This will ERASE ALL DATA from $(echo $DEVICES | wc -w) device."
|
||||
read -p "Hit enter to continue"
|
||||
fi
|
||||
|
||||
_adb_multi "$DEVICES" "reboot bootloader"
|
||||
# Subshell to isolate job list
|
||||
(
|
||||
for DEVICE in $DEVICES; do
|
||||
fastboot_erase $DEVICE &
|
||||
done
|
||||
wait
|
||||
)
|
||||
|
||||
# Reboot devices together
|
||||
for DEVICE in $DEVICES; do
|
||||
fastboot -s $DEVICE reboot
|
||||
done
|
||||
}
|
||||
|
||||
# Wipe a device in fastboot.
|
||||
# Usage fastboot_erase [serial]
|
||||
fastboot_erase() {
|
||||
if [[ -n $1 ]]; then
|
||||
echo "Wiping $1"
|
||||
local SERIAL="-s $1"
|
||||
else
|
||||
if [ -z $(fastboot devices) ]; then
|
||||
echo "No devices in fastboot, aborting."
|
||||
echo "Check out wipe_all_devices to see if sufficient"
|
||||
echo "You can put a device in fastboot using adb reboot bootloader"
|
||||
return 1
|
||||
fi
|
||||
local SERIAL=""
|
||||
fi
|
||||
fastboot $SERIAL erase cache
|
||||
fastboot $SERIAL erase userdata
|
||||
}
|
||||
|
||||
# Get list of devices connected via adb
|
||||
# Args: -b block until adb detects a device
|
||||
adb_get_devices() {
|
||||
local DEVICES="$(adb devices | grep 'device$')"
|
||||
if [[ -z $DEVICES && $1 == '-b' ]]; then
|
||||
echo '- waiting for device -' >&2
|
||||
local DEVICES="$(adb wait-for-device devices | grep 'device$')"
|
||||
fi
|
||||
echo "$DEVICES" | awk -vORS=' ' '{print $1}' | sed 's/ $/\n/'
|
||||
}
|
||||
|
||||
###################################################
|
||||
## HELPER FUNCTIONS
|
||||
###################################################
|
||||
|
||||
# Run an adb command in parallel over a device list
|
||||
_adb_multi() {
|
||||
local DEVICES=$1
|
||||
local ADB_ARGS=$2
|
||||
(
|
||||
for DEVICE in $DEVICES; do
|
||||
adb -s $DEVICE $ADB_ARGS &
|
||||
done
|
||||
wait
|
||||
)
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2012 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.
|
||||
#
|
||||
# Kill a running content shell.
|
||||
#
|
||||
# Assumes you have sourced the build/android/envsetup.sh script.
|
||||
|
||||
SHELL_PID_LINES=$(adb shell ps | grep ' org.chromium.content_shell')
|
||||
VAL=$(echo "$SHELL_PID_LINES" | wc -l)
|
||||
if [ $VAL -lt 1 ] ; then
|
||||
echo "Not running Content shell."
|
||||
else
|
||||
SHELL_PID=$(echo $SHELL_PID_LINES | awk '{print $2}')
|
||||
if [ "$SHELL_PID" != "" ] ; then
|
||||
set -x
|
||||
adb shell kill $SHELL_PID
|
||||
set -
|
||||
else
|
||||
echo "Content shell does not appear to be running."
|
||||
fi
|
||||
fi
|
||||
@@ -1,155 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
"""Saves logcats from all connected devices.
|
||||
|
||||
Usage: adb_logcat_monitor.py <base_dir> [<adb_binary_path>]
|
||||
|
||||
This script will repeatedly poll adb for new devices and save logcats
|
||||
inside the <base_dir> directory, which it attempts to create. The
|
||||
script will run until killed by an external signal. To test, run the
|
||||
script in a shell and <Ctrl>-C it after a while. It should be
|
||||
resilient across phone disconnects and reconnects and start the logcat
|
||||
early enough to not miss anything.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
# Map from device_id -> (process, logcat_num)
|
||||
devices = {}
|
||||
|
||||
|
||||
class TimeoutException(Exception):
|
||||
"""Exception used to signal a timeout."""
|
||||
pass
|
||||
|
||||
|
||||
class SigtermError(Exception):
|
||||
"""Exception used to catch a sigterm."""
|
||||
pass
|
||||
|
||||
|
||||
def StartLogcatIfNecessary(device_id, adb_cmd, base_dir):
|
||||
"""Spawns a adb logcat process if one is not currently running."""
|
||||
process, logcat_num = devices[device_id]
|
||||
if process:
|
||||
if process.poll() is None:
|
||||
# Logcat process is still happily running
|
||||
return
|
||||
else:
|
||||
logging.info('Logcat for device %s has died', device_id)
|
||||
error_filter = re.compile('- waiting for device -')
|
||||
for line in process.stderr:
|
||||
if not error_filter.match(line):
|
||||
logging.error(device_id + ': ' + line)
|
||||
|
||||
logging.info('Starting logcat %d for device %s', logcat_num,
|
||||
device_id)
|
||||
logcat_filename = 'logcat_%s_%03d' % (device_id, logcat_num)
|
||||
logcat_file = open(os.path.join(base_dir, logcat_filename), 'w')
|
||||
process = subprocess.Popen([adb_cmd, '-s', device_id,
|
||||
'logcat', '-v', 'threadtime'],
|
||||
stdout=logcat_file,
|
||||
stderr=subprocess.PIPE)
|
||||
devices[device_id] = (process, logcat_num + 1)
|
||||
|
||||
|
||||
def GetAttachedDevices(adb_cmd):
|
||||
"""Gets the device list from adb.
|
||||
|
||||
We use an alarm in this function to avoid deadlocking from an external
|
||||
dependency.
|
||||
|
||||
Args:
|
||||
adb_cmd: binary to run adb
|
||||
|
||||
Returns:
|
||||
list of devices or an empty list on timeout
|
||||
"""
|
||||
signal.alarm(2)
|
||||
try:
|
||||
out, err = subprocess.Popen([adb_cmd, 'devices'],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE).communicate()
|
||||
if err:
|
||||
logging.warning('adb device error %s', err.strip())
|
||||
return re.findall('^(\w+)\tdevice$', out, re.MULTILINE)
|
||||
except TimeoutException:
|
||||
logging.warning('"adb devices" command timed out')
|
||||
return []
|
||||
except (IOError, OSError):
|
||||
logging.exception('Exception from "adb devices"')
|
||||
return []
|
||||
finally:
|
||||
signal.alarm(0)
|
||||
|
||||
|
||||
def main(base_dir, adb_cmd='adb'):
|
||||
"""Monitor adb forever. Expects a SIGINT (Ctrl-C) to kill."""
|
||||
# We create the directory to ensure 'run once' semantics
|
||||
if os.path.exists(base_dir):
|
||||
print('adb_logcat_monitor: %s already exists? Cleaning' % base_dir)
|
||||
shutil.rmtree(base_dir, ignore_errors=True)
|
||||
|
||||
os.makedirs(base_dir)
|
||||
logging.basicConfig(filename=os.path.join(base_dir, 'eventlog'),
|
||||
level=logging.INFO,
|
||||
format='%(asctime)-2s %(levelname)-8s %(message)s')
|
||||
|
||||
# Set up the alarm for calling 'adb devices'. This is to ensure
|
||||
# our script doesn't get stuck waiting for a process response
|
||||
def TimeoutHandler(_, unused_frame):
|
||||
raise TimeoutException()
|
||||
signal.signal(signal.SIGALRM, TimeoutHandler)
|
||||
|
||||
# Handle SIGTERMs to ensure clean shutdown
|
||||
def SigtermHandler(_, unused_frame):
|
||||
raise SigtermError()
|
||||
signal.signal(signal.SIGTERM, SigtermHandler)
|
||||
|
||||
logging.info('Started with pid %d', os.getpid())
|
||||
pid_file_path = os.path.join(base_dir, 'LOGCAT_MONITOR_PID')
|
||||
|
||||
try:
|
||||
with open(pid_file_path, 'w') as f:
|
||||
f.write(str(os.getpid()))
|
||||
while True:
|
||||
for device_id in GetAttachedDevices(adb_cmd):
|
||||
if not device_id in devices:
|
||||
devices[device_id] = (None, 0)
|
||||
|
||||
for device in devices:
|
||||
# This will spawn logcat watchers for any device ever detected
|
||||
StartLogcatIfNecessary(device, adb_cmd, base_dir)
|
||||
|
||||
time.sleep(5)
|
||||
except SigtermError:
|
||||
logging.info('Received SIGTERM, shutting down')
|
||||
except:
|
||||
logging.exception('Unexpected exception in main.')
|
||||
finally:
|
||||
for process, _ in devices.values():
|
||||
if process:
|
||||
try:
|
||||
process.terminate()
|
||||
except OSError:
|
||||
pass
|
||||
os.remove(pid_file_path)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if 2 <= len(sys.argv) <= 3:
|
||||
print('adb_logcat_monitor: Initializing')
|
||||
sys.exit(main(*sys.argv[1:3]))
|
||||
|
||||
print('Usage: %s <base_dir> [<adb_binary_path>]' % sys.argv[0])
|
||||
@@ -1,202 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
"""Shutdown adb_logcat_monitor and print accumulated logs.
|
||||
|
||||
To test, call './adb_logcat_printer.py <base_dir>' where
|
||||
<base_dir> contains 'adb logcat -v threadtime' files named as
|
||||
logcat_<deviceID>_<sequenceNum>
|
||||
|
||||
The script will print the files to out, and will combine multiple
|
||||
logcats from a single device if there is overlap.
|
||||
|
||||
Additionally, if a <base_dir>/LOGCAT_MONITOR_PID exists, the script
|
||||
will attempt to terminate the contained PID by sending a SIGINT and
|
||||
monitoring for the deletion of the aforementioned file.
|
||||
"""
|
||||
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import signal
|
||||
import sys
|
||||
import time
|
||||
|
||||
|
||||
# Set this to debug for more verbose output
|
||||
LOG_LEVEL = logging.INFO
|
||||
|
||||
|
||||
def CombineLogFiles(list_of_lists, logger):
|
||||
"""Splices together multiple logcats from the same device.
|
||||
|
||||
Args:
|
||||
list_of_lists: list of pairs (filename, list of timestamped lines)
|
||||
logger: handler to log events
|
||||
|
||||
Returns:
|
||||
list of lines with duplicates removed
|
||||
"""
|
||||
cur_device_log = ['']
|
||||
for cur_file, cur_file_lines in list_of_lists:
|
||||
# Ignore files with just the logcat header
|
||||
if len(cur_file_lines) < 2:
|
||||
continue
|
||||
common_index = 0
|
||||
# Skip this step if list just has empty string
|
||||
if len(cur_device_log) > 1:
|
||||
try:
|
||||
line = cur_device_log[-1]
|
||||
# Used to make sure we only splice on a timestamped line
|
||||
if re.match('^\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3} ', line):
|
||||
common_index = cur_file_lines.index(line)
|
||||
else:
|
||||
logger.warning('splice error - no timestamp in "%s"?', line.strip())
|
||||
except ValueError:
|
||||
# The last line was valid but wasn't found in the next file
|
||||
cur_device_log += ['***** POSSIBLE INCOMPLETE LOGCAT *****']
|
||||
logger.info('Unable to splice %s. Incomplete logcat?', cur_file)
|
||||
|
||||
cur_device_log += ['*'*30 + ' %s' % cur_file]
|
||||
cur_device_log.extend(cur_file_lines[common_index:])
|
||||
|
||||
return cur_device_log
|
||||
|
||||
|
||||
def FindLogFiles(base_dir):
|
||||
"""Search a directory for logcat files.
|
||||
|
||||
Args:
|
||||
base_dir: directory to search
|
||||
|
||||
Returns:
|
||||
Mapping of device_id to a sorted list of file paths for a given device
|
||||
"""
|
||||
logcat_filter = re.compile('^logcat_(\w+)_(\d+)$')
|
||||
# list of tuples (<device_id>, <seq num>, <full file path>)
|
||||
filtered_list = []
|
||||
for cur_file in os.listdir(base_dir):
|
||||
matcher = logcat_filter.match(cur_file)
|
||||
if matcher:
|
||||
filtered_list += [(matcher.group(1), int(matcher.group(2)),
|
||||
os.path.join(base_dir, cur_file))]
|
||||
filtered_list.sort()
|
||||
file_map = {}
|
||||
for device_id, _, cur_file in filtered_list:
|
||||
if not device_id in file_map:
|
||||
file_map[device_id] = []
|
||||
|
||||
file_map[device_id] += [cur_file]
|
||||
return file_map
|
||||
|
||||
|
||||
def GetDeviceLogs(log_filenames, logger):
|
||||
"""Read log files, combine and format.
|
||||
|
||||
Args:
|
||||
log_filenames: mapping of device_id to sorted list of file paths
|
||||
logger: logger handle for logging events
|
||||
|
||||
Returns:
|
||||
list of formatted device logs, one for each device.
|
||||
"""
|
||||
device_logs = []
|
||||
|
||||
for device, device_files in log_filenames.items():
|
||||
logger.debug('%s: %s', device, str(device_files))
|
||||
device_file_lines = []
|
||||
for cur_file in device_files:
|
||||
with open(cur_file) as f:
|
||||
device_file_lines += [(cur_file, f.read().splitlines())]
|
||||
combined_lines = CombineLogFiles(device_file_lines, logger)
|
||||
# Prepend each line with a short unique ID so it's easy to see
|
||||
# when the device changes. We don't use the start of the device
|
||||
# ID because it can be the same among devices. Example lines:
|
||||
# AB324: foo
|
||||
# AB324: blah
|
||||
device_logs += [('\n' + device[-5:] + ': ').join(combined_lines)]
|
||||
return device_logs
|
||||
|
||||
|
||||
def ShutdownLogcatMonitor(base_dir, logger):
|
||||
"""Attempts to shutdown adb_logcat_monitor and blocks while waiting."""
|
||||
try:
|
||||
monitor_pid_path = os.path.join(base_dir, 'LOGCAT_MONITOR_PID')
|
||||
with open(monitor_pid_path) as f:
|
||||
monitor_pid = int(f.readline())
|
||||
|
||||
logger.info('Sending SIGTERM to %d', monitor_pid)
|
||||
os.kill(monitor_pid, signal.SIGTERM)
|
||||
i = 0
|
||||
while True:
|
||||
time.sleep(.2)
|
||||
if not os.path.exists(monitor_pid_path):
|
||||
return
|
||||
if not os.path.exists('/proc/%d' % monitor_pid):
|
||||
logger.warning('Monitor (pid %d) terminated uncleanly?', monitor_pid)
|
||||
return
|
||||
logger.info('Waiting for logcat process to terminate.')
|
||||
i += 1
|
||||
if i >= 10:
|
||||
logger.warning('Monitor pid did not terminate. Continuing anyway.')
|
||||
return
|
||||
|
||||
except (ValueError, IOError, OSError):
|
||||
logger.exception('Error signaling logcat monitor - continuing')
|
||||
|
||||
|
||||
def main(base_dir, output_file):
|
||||
log_stringio = io.StringIO()
|
||||
logger = logging.getLogger('LogcatPrinter')
|
||||
logger.setLevel(LOG_LEVEL)
|
||||
sh = logging.StreamHandler(log_stringio)
|
||||
sh.setFormatter(logging.Formatter('%(asctime)-2s %(levelname)-8s'
|
||||
' %(message)s'))
|
||||
logger.addHandler(sh)
|
||||
|
||||
try:
|
||||
# Wait at least 5 seconds after base_dir is created before printing.
|
||||
#
|
||||
# The idea is that 'adb logcat > file' output consists of 2 phases:
|
||||
# 1 Dump all the saved logs to the file
|
||||
# 2 Stream log messages as they are generated
|
||||
#
|
||||
# We want to give enough time for phase 1 to complete. There's no
|
||||
# good method to tell how long to wait, but it usually only takes a
|
||||
# second. On most bots, this code path won't occur at all, since
|
||||
# adb_logcat_monitor.py command will have spawned more than 5 seconds
|
||||
# prior to called this shell script.
|
||||
try:
|
||||
sleep_time = 5 - (time.time() - os.path.getctime(base_dir))
|
||||
except OSError:
|
||||
sleep_time = 5
|
||||
if sleep_time > 0:
|
||||
logger.warning('Monitor just started? Sleeping %.1fs', sleep_time)
|
||||
time.sleep(sleep_time)
|
||||
|
||||
assert os.path.exists(base_dir), '%s does not exist' % base_dir
|
||||
ShutdownLogcatMonitor(base_dir, logger)
|
||||
separator = '\n' + '*' * 80 + '\n\n'
|
||||
for log in GetDeviceLogs(FindLogFiles(base_dir), logger):
|
||||
output_file.write(log)
|
||||
output_file.write(separator)
|
||||
with open(os.path.join(base_dir, 'eventlog')) as f:
|
||||
output_file.write('\nLogcat Monitor Event Log\n')
|
||||
output_file.write(f.read())
|
||||
except:
|
||||
logger.exception('Unexpected exception')
|
||||
|
||||
logger.info('Done.')
|
||||
sh.flush()
|
||||
output_file.write('\nLogcat Printer Event Log\n')
|
||||
output_file.write(log_stringio.getvalue())
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) == 1:
|
||||
print('Usage: %s <base_dir>' % sys.argv[0])
|
||||
sys.exit(1)
|
||||
sys.exit(main(sys.argv[1], sys.stdout))
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
if [ $# -gt 0 ] ; then
|
||||
INTENT_ARGS='-d "$1"' # e.g. a URL
|
||||
fi
|
||||
|
||||
adb shell am start \
|
||||
-a android.intent.action.VIEW \
|
||||
-n org.chromium.content_shell/.ContentShellActivity \
|
||||
$INTENT_ARGS
|
||||
@@ -1,97 +0,0 @@
|
||||
<!--
|
||||
Copyright (c) 2012 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.
|
||||
-->
|
||||
<project name="chromium-jars" default="dist">
|
||||
<!--
|
||||
Common ant build file for for chromium_*.jars.
|
||||
For creating a new chromium_*.jar :
|
||||
1. Use build/java.gypi action.
|
||||
The jar will be created as chromium_${PACKAGE_NAME} in
|
||||
${PRODUCT_DIR}/lib.java.
|
||||
-->
|
||||
<description>
|
||||
Building ${PROJECT_NAME}/ java source code with ant.
|
||||
</description>
|
||||
|
||||
<import file="common.xml"/>
|
||||
|
||||
<path id="javac.custom.classpath">
|
||||
<filelist files="${INPUT_JARS_PATHS}"/>
|
||||
<pathelement location="${ANDROID_SDK}/android.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="javac.srcdirs.additional">
|
||||
<filelist files="${ADDITIONAL_SRC_DIRS}"/>
|
||||
<filelist files="${GENERATED_SRC_DIRS}"/>
|
||||
</path>
|
||||
|
||||
<property-value
|
||||
name="javac.srcdir"
|
||||
value="src:${toString:javac.srcdirs.additional}"
|
||||
/>
|
||||
|
||||
<property-location
|
||||
name="dest.dir"
|
||||
location="${PRODUCT_DIR}/java/${PACKAGE_NAME}"
|
||||
check-exists="false"
|
||||
/>
|
||||
|
||||
<target name="init">
|
||||
<!-- Create the time stamp -->
|
||||
<tstamp/>
|
||||
<!-- Create the build directory structure used by compile -->
|
||||
<mkdir dir="${dest.dir}"/>
|
||||
|
||||
<!-- Remove all .class files from dest.dir. This prevents inclusion of
|
||||
incorrect .class files in the final .jar. For example, if a .java file
|
||||
was deleted, the .jar should not contain the .class files for that
|
||||
.java from previous builds.
|
||||
-->
|
||||
<delete>
|
||||
<fileset dir="${dest.dir}" includes="**/*.class"/>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="compile" depends="init" description="Compiles source.">
|
||||
<fail message="Error: javac.custom.classpath is not set. Please set it to
|
||||
classpath for javac.">
|
||||
<condition>
|
||||
<not><isreference refid="javac.custom.classpath"/></not>
|
||||
</condition>
|
||||
</fail>
|
||||
|
||||
<echo>
|
||||
Compiling ${javac.srcdir}, classpath: ${toString:javac.custom.classpath}
|
||||
</echo>
|
||||
|
||||
<javac
|
||||
srcdir="${javac.srcdir}"
|
||||
destdir="${dest.dir}"
|
||||
classpathref="javac.custom.classpath"
|
||||
debug="true"
|
||||
includeantruntime="false"
|
||||
/>
|
||||
</target>
|
||||
|
||||
<target name="dist" depends="compile"
|
||||
description="Generate chromium_${PACKAGE_NAME}.jar.">
|
||||
<!-- Create the distribution directory -->
|
||||
<jar
|
||||
jarfile="${lib.java.dir}/chromium_${PACKAGE_NAME}.jar"
|
||||
basedir="${dest.dir}"
|
||||
/>
|
||||
|
||||
<!-- If Gyp thinks this output is stale but Ant doesn't, the modification
|
||||
time should still be updated. Otherwise, this target will continue to
|
||||
be rebuilt in future builds.
|
||||
-->
|
||||
<touch file="${lib.java.dir}/chromium_${PACKAGE_NAME}.jar"/>
|
||||
</target>
|
||||
|
||||
<target name="clean" description="clean up">
|
||||
<!-- Delete the appropriate directory trees -->
|
||||
<delete dir="${dest.dir}"/>
|
||||
</target>
|
||||
</project>
|
||||
@@ -1,90 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2012 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.
|
||||
-->
|
||||
<project name="chrome_common_defines">
|
||||
<!-- Common build properties for Chrome for android. -->
|
||||
|
||||
<!--
|
||||
Macro for checking that a property is correctly set. Performs checks for:
|
||||
1. Property is set and not null.
|
||||
2. String value of property does not contains any '$' signs.
|
||||
-->
|
||||
<macrodef name="check-property-value">
|
||||
<attribute name="property"/>
|
||||
<sequential>
|
||||
<fail message ="Property @{property} is not set.">
|
||||
<condition>
|
||||
<or>
|
||||
<not><isset property="@{property}"/></not>
|
||||
<length string="${@{property}}" trim="true" when="less" length="1"/>
|
||||
</or>
|
||||
</condition>
|
||||
</fail>
|
||||
<!--
|
||||
Check for $ signs. This catches errors when properties are initialized from environment
|
||||
variables. E.g. if we have <property name="foo" value="${env.bar}" /> but env.bar is
|
||||
not set then foo will have the literal value of '${env.bar}'.
|
||||
-->
|
||||
<fail message="Value checked failed for property: @{property} : ${@{property}}.
|
||||
Property value contains an uninitialized environment variable.">
|
||||
<condition>
|
||||
<contains string="${@{property}}" substring="$"/>
|
||||
</condition>
|
||||
</fail>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<!--
|
||||
A safe setter for location properties. Checks that a location is not
|
||||
empty and actually exists. For specifying output directories, location
|
||||
check can be disabled by specifying check-exists="false".
|
||||
-->
|
||||
<macrodef name="property-location">
|
||||
<attribute name="name"/>
|
||||
<attribute name="location"/>
|
||||
<attribute name="check-exists" default="true"/>
|
||||
<sequential>
|
||||
<property name="@{name}" location="@{location}"/>
|
||||
<check-property-value property="@{name}"/>
|
||||
<fail message="Location specified for @{name} : @{location} does not exist.">
|
||||
<condition>
|
||||
<and>
|
||||
<equals arg1="@{check-exists}" arg2="true"/>
|
||||
<not><available file="@{location}"/></not>
|
||||
</and>
|
||||
</condition>
|
||||
</fail>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<!-- A safe setter for property values -->
|
||||
<macrodef name="property-value">
|
||||
<attribute name="name"/>
|
||||
<attribute name="value"/>
|
||||
<sequential>
|
||||
<property name="@{name}" value="@{value}"/>
|
||||
<check-property-value property="@{name}"/>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<!-- Common environment properties. -->
|
||||
<property-location name="sdk.dir" location="${ANDROID_SDK_ROOT}"/>
|
||||
<property-value name="target" value="android-${ANDROID_SDK_VERSION}"/>
|
||||
<property name="source.dir" location="src"/>
|
||||
<property-location name="android.gdbserver" location="${ANDROID_GDBSERVER}"/>
|
||||
<!--
|
||||
Common directories used by SDK Build, when making changes here
|
||||
make sure to update gyp files and test scripts constants in
|
||||
build/android/pylib/constants.py
|
||||
-->
|
||||
<!-- Common directory for chromium_*.jars. -->
|
||||
<property-location name="lib.java.dir" location="${PRODUCT_DIR}/lib.java"/>
|
||||
<!-- Common directory for test jars. -->
|
||||
<property-location name="test.lib.java.dir"
|
||||
location="${PRODUCT_DIR}/test.lib.java"/>
|
||||
<!-- Common directory for apks. -->
|
||||
<property-location name="apks.dir" location="${PRODUCT_DIR}/apks"/>
|
||||
</project>
|
||||
@@ -1,284 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2012 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.
|
||||
-->
|
||||
<project name="chrome_sdk_overrides" >
|
||||
<!--
|
||||
Redefinition of targets used by SDK tools.
|
||||
Supported version: SDK tools revision 20.
|
||||
|
||||
SDK tools do not allow easy way of extending classpaths
|
||||
for aidl and javac. This file defines targets which can be used to
|
||||
override targets used by tools.
|
||||
-->
|
||||
<target name="-pre-compile">
|
||||
<!--
|
||||
Remove all .class files from the output directory. This prevents inclusion of incorrect .class
|
||||
files in the final apk. For example, if a .java file was deleted, the apk should not contain
|
||||
the .class files for that .java from previous builds.
|
||||
-->
|
||||
<delete>
|
||||
<fileset dir="${out.classes.absolute.dir}" includes="**/*.class"/>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<!--
|
||||
Override the -compile target.
|
||||
This target requires 'javac.custom.classpath' to be set to reference
|
||||
of classpath to be used for javac. Also accepts custom path for
|
||||
sources: 'javac.custom.sourcepath'.
|
||||
-->
|
||||
<target
|
||||
name="-compile"
|
||||
depends="-build-setup, -pre-build, -code-gen, -pre-compile">
|
||||
<do-only-if-manifest-hasCode elseText="hasCode = false. Skipping..." >
|
||||
<!-- If javac.srcdirs.additional isn't set, set it to an empty path. -->
|
||||
<if>
|
||||
<condition>
|
||||
<not>
|
||||
<isreference refid="javac.srcdirs.additional"/>
|
||||
</not>
|
||||
</condition>
|
||||
<then>
|
||||
<path id="javac.srcdirs.additional"/>
|
||||
</then>
|
||||
</if>
|
||||
<javac
|
||||
bootclasspathref="project.target.class.path"
|
||||
classpathref="javac.custom.classpath"
|
||||
debug="true"
|
||||
destdir="${out.classes.absolute.dir}"
|
||||
encoding="${java.encoding}"
|
||||
extdirs=""
|
||||
fork="${need.javac.fork}"
|
||||
includeantruntime="false"
|
||||
source="${java.source}"
|
||||
target="${java.target}"
|
||||
verbose="${verbose}">
|
||||
<src path="${source.absolute.dir}"/>
|
||||
<src path="${gen.absolute.dir}"/>
|
||||
<src>
|
||||
<path refid="javac.srcdirs.additional"/>
|
||||
</src>
|
||||
<compilerarg line="${java.compilerargs}"/>
|
||||
</javac>
|
||||
<!--
|
||||
If the project is instrumented, then instrument the classes
|
||||
TODO(shashishekhar): Add option to override emma filter.
|
||||
-->
|
||||
<if condition="${build.is.instrumented}">
|
||||
<then>
|
||||
<echo level="info">
|
||||
Instrumenting classes from ${out.absolute.dir}/classes...
|
||||
</echo>
|
||||
<!-- build the default filter to remove R, Manifest, BuildConfig -->
|
||||
<getemmafilter
|
||||
appPackage="${project.app.package}"
|
||||
filterOut="emma.default.filter"
|
||||
libraryPackagesRefId="project.library.packages"/>
|
||||
<!--
|
||||
Define where the .em file is output.
|
||||
This may have been setup already if this is a library.
|
||||
-->
|
||||
<property name="emma.coverage.absolute.file"
|
||||
location="${out.absolute.dir}/coverage.em"/>
|
||||
<!-- It only instruments class files, not any external libs -->
|
||||
|
||||
<emma enabled="true">
|
||||
<instr
|
||||
instrpath="${out.absolute.dir}/classes"
|
||||
metadatafile="${emma.coverage.absolute.file}"
|
||||
mode="overwrite"
|
||||
outdir="${out.absolute.dir}/classes"
|
||||
verbosity="${verbosity}">
|
||||
<filter excludes="${emma.default.filter}"/>
|
||||
<filter value="${emma.filter}"/>
|
||||
</instr>
|
||||
</emma>
|
||||
</then>
|
||||
</if>
|
||||
<!--
|
||||
If the project needs a test jar then generate a jar containing
|
||||
all compiled classes and referenced jars.
|
||||
project.is.testapp is set by Android's ant build system based on the
|
||||
target's manifest. It is true only for instrumentation apks.
|
||||
-->
|
||||
<if condition="${project.is.testapp}">
|
||||
<then>
|
||||
<echo level="info">Creating test jar file:
|
||||
${ant.project.name}-debug.jar</echo>
|
||||
<property-location name="create.test.jar.file"
|
||||
location="${CHROMIUM_SRC}/build/android/ant/create-test-jar.js"/>
|
||||
<script language="javascript" src="${create.test.jar.file}"/>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
</do-only-if-manifest-hasCode>
|
||||
</target>
|
||||
|
||||
<!--
|
||||
For debug builds, the Android SDK tools create a key in ~/.android and sign the build with it.
|
||||
This has caused all kinds of issues. Instead, the debug build should be signed with a key in
|
||||
build/android/ant. The SDK tools do not provide any support for overriding that behavior and so
|
||||
instead one must use the hack below.
|
||||
-->
|
||||
|
||||
<!-- Disables automatic signing. -->
|
||||
<property name="build.is.signing.debug" value="false"/>
|
||||
|
||||
<!-- TODO(cjhopman): Remove this property when all gyp files define the CHROMIUM_SRC property. -->
|
||||
<property name="CHROMIUM_SRC" value="${PRODUCT_DIR}/../.." />
|
||||
|
||||
<property name="key.store" value="${CHROMIUM_SRC}/build/android/ant/chromium-debug.keystore"/>
|
||||
<property name="key.store.password" value="chromium"/>
|
||||
<property name="key.alias" value="chromiumdebugkey"/>
|
||||
<property name="key.alias.password" value="chromium"/>
|
||||
|
||||
<!-- SDK tools assume that out.packaged.file is signed and name it "...-unaligned" -->
|
||||
<property name="out.packaged.file"
|
||||
value="${apks.dir}/${ant.project.name}-debug-unsigned.apk" />
|
||||
<property name="out.unaligned.file"
|
||||
value="${apks.dir}/${ant.project.name}-debug-unaligned.apk" />
|
||||
|
||||
<!-- By default, the SDK tools build only aligns the APK in the -do-debug target. -->
|
||||
<target name="-do-debug"
|
||||
depends="-set-debug-mode, -debug-obfuscation-check, -package, -post-package">
|
||||
<!-- only create apk if *not* a library project -->
|
||||
<do-only-if-not-library elseText="Library project: do not create apk..." >
|
||||
<sequential>
|
||||
<!-- Signs the APK -->
|
||||
<echo level="info">Signing final apk...</echo>
|
||||
<signapk
|
||||
input="${out.packaged.file}"
|
||||
output="${out.unaligned.file}"
|
||||
keystore="${key.store}"
|
||||
storepass="${key.store.password}"
|
||||
alias="${key.alias}"
|
||||
keypass="${key.alias.password}"/>
|
||||
|
||||
<!-- Zip aligns the APK -->
|
||||
<zipalign-helper
|
||||
in.package="${out.unaligned.file}"
|
||||
out.package="${out.final.file}" />
|
||||
<echo level="info">Release Package: ${out.final.file}</echo>
|
||||
</sequential>
|
||||
</do-only-if-not-library>
|
||||
<record-build-info />
|
||||
</target>
|
||||
|
||||
<path id="native.libs.gdbserver">
|
||||
<fileset file="${android.gdbserver}"/>
|
||||
</path>
|
||||
|
||||
<target name="-post-compile">
|
||||
<!--
|
||||
Copy gdbserver to main libs directory if building a non-instrumentation debug apk.
|
||||
TODO(jrg): For now, Chrome on Android always builds native code
|
||||
as Release and java/ant as Debug, which means we always install
|
||||
gdbserver. Resolve this discrepancy, possibly by making this
|
||||
Release Official build java/ant as Release.
|
||||
-->
|
||||
<if>
|
||||
<condition>
|
||||
<and>
|
||||
<equals arg1="${build.target}" arg2="debug"/>
|
||||
<isfalse value="${project.is.testapp}"/>
|
||||
</and>
|
||||
</condition>
|
||||
<then>
|
||||
<echo message="Copying gdbserver to the apk to enable native debugging"/>
|
||||
<copy todir="${out.dir}/libs/${target.abi}">
|
||||
<path refid="native.libs.gdbserver"/>
|
||||
</copy>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<!-- Package all the compiled .class files into a .jar. -->
|
||||
<jar
|
||||
jarfile="${lib.java.dir}/chromium_apk_${PACKAGE_NAME}.jar"
|
||||
basedir="${out.classes.absolute.dir}"
|
||||
/>
|
||||
</target>
|
||||
|
||||
<!--
|
||||
Override obfuscate target to pass javac.custom.classpath to Proguard. SDK tools do not provide
|
||||
any way to pass custom class paths to Proguard.
|
||||
-->
|
||||
<target name="-obfuscate">
|
||||
<if condition="${proguard.enabled}">
|
||||
<then>
|
||||
<property name="obfuscate.absolute.dir" location="${out.absolute.dir}/proguard"/>
|
||||
<property name="preobfuscate.jar.file" value="${obfuscate.absolute.dir}/original.jar"/>
|
||||
<property name="obfuscated.jar.file" value="${obfuscate.absolute.dir}/obfuscated.jar"/>
|
||||
<!-- input for dex will be proguard's output -->
|
||||
<property name="out.dex.input.absolute.dir" value="${obfuscated.jar.file}"/>
|
||||
|
||||
<!-- Add Proguard Tasks -->
|
||||
<property name="proguard.jar" location="${android.tools.dir}/proguard/lib/proguard.jar"/>
|
||||
<taskdef name="proguard" classname="proguard.ant.ProGuardTask" classpath="${proguard.jar}"/>
|
||||
|
||||
<!-- Set the android classpath Path object into a single property. It'll be
|
||||
all the jar files separated by a platform path-separator.
|
||||
Each path must be quoted if it contains spaces.
|
||||
-->
|
||||
<pathconvert property="project.target.classpath.value" refid="project.target.class.path">
|
||||
<firstmatchmapper>
|
||||
<regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
|
||||
<identitymapper/>
|
||||
</firstmatchmapper>
|
||||
</pathconvert>
|
||||
|
||||
<!-- Build a path object with all the jar files that must be obfuscated.
|
||||
This include the project compiled source code and any 3rd party jar
|
||||
files. -->
|
||||
<path id="project.all.classes.path">
|
||||
<pathelement location="${preobfuscate.jar.file}"/>
|
||||
<path refid="project.all.jars.path"/>
|
||||
<!-- Pass javac.custom.classpath for apks. -->
|
||||
<path refid="javac.custom.classpath"/>
|
||||
</path>
|
||||
<!-- Set the project jar files Path object into a single property. It'll be
|
||||
all the jar files separated by a platform path-separator.
|
||||
Each path must be quoted if it contains spaces.
|
||||
-->
|
||||
<pathconvert property="project.all.classes.value" refid="project.all.classes.path">
|
||||
<firstmatchmapper>
|
||||
<regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
|
||||
<identitymapper/>
|
||||
</firstmatchmapper>
|
||||
</pathconvert>
|
||||
|
||||
<!-- Turn the path property ${proguard.config} from an A:B:C property
|
||||
into a series of includes: -include A -include B -include C
|
||||
suitable for processing by the ProGuard task. Note - this does
|
||||
not include the leading '-include "' or the closing '"'; those
|
||||
are added under the <proguard> call below.
|
||||
-->
|
||||
<path id="proguard.configpath">
|
||||
<pathelement path="${proguard.config}"/>
|
||||
</path>
|
||||
<pathconvert pathsep='" -include "' property="proguard.configcmd"
|
||||
refid="proguard.configpath"/>
|
||||
|
||||
<mkdir dir="${obfuscate.absolute.dir}"/>
|
||||
<delete file="${preobfuscate.jar.file}"/>
|
||||
<delete file="${obfuscated.jar.file}"/>
|
||||
<jar basedir="${out.classes.absolute.dir}"
|
||||
destfile="${preobfuscate.jar.file}"/>
|
||||
<proguard>
|
||||
-include "${proguard.configcmd}"
|
||||
-include "${out.absolute.dir}/proguard.txt"
|
||||
-injars ${project.all.classes.value}
|
||||
-outjars "${obfuscated.jar.file}"
|
||||
-libraryjars ${project.target.classpath.value}
|
||||
-dump "${obfuscate.absolute.dir}/dump.txt"
|
||||
-printseeds "${obfuscate.absolute.dir}/seeds.txt"
|
||||
-printusage "${obfuscate.absolute.dir}/usage.txt"
|
||||
-printmapping "${obfuscate.absolute.dir}/mapping.txt"
|
||||
</proguard>
|
||||
</then>
|
||||
</if>
|
||||
</target>
|
||||
</project>
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
# Temporary placeholders to call new buildbot script locations until
|
||||
# buildbot master config can be pointed to new location.
|
||||
|
||||
exec $(dirname $0)/buildbot/bb_fyi_builder.sh "$@"
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
# Temporary placeholders to call new buildbot script locations until
|
||||
# buildbot master config can be pointed to new location.
|
||||
|
||||
exec $(dirname $0)/buildbot/bb_fyi_tester.sh "$@"
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
# Temporary placeholders to call new buildbot script locations until
|
||||
# buildbot master config can be pointed to new location.
|
||||
|
||||
exec $(dirname $0)/buildbot/bb_main_builder.sh "$@"
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
# Temporary placeholders to call new buildbot script locations until
|
||||
# buildbot master config can be pointed to new location.
|
||||
|
||||
exec $(dirname $0)/buildbot/bb_try_builder.sh "$@"
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
# Temporary placeholders to call new buildbot script locations until
|
||||
# buildbot master config can be pointed to new location.
|
||||
|
||||
exec $(dirname $0)/buildbot/bb_try_compile.sh "$@"
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
# Temporary placeholders to call new buildbot script locations until
|
||||
# buildbot master config can be pointed to new location.
|
||||
|
||||
exec $(dirname $0)/buildbot/bb_try_tester.sh "$@"
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
# Temporary placeholders to call new buildbot script locations until
|
||||
# buildbot master config can be pointed to new location.
|
||||
|
||||
exec $(dirname $0)/buildbot/bb_webkit_latest_builder.sh "$@"
|
||||
@@ -1,6 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#dummy gypi: contents should be discarded due to an enclosing 'conditions:' element.
|
||||
{}
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
"""Provides iotop/top style profiling for android.
|
||||
|
||||
Usage:
|
||||
./device_stats_monitor.py --hz=20 --duration=5 --outfile=/tmp/foo
|
||||
"""
|
||||
|
||||
import optparse
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
from pylib import android_commands
|
||||
from pylib import device_stats_monitor
|
||||
from pylib import test_options_parser
|
||||
|
||||
|
||||
def main(argv):
|
||||
option_parser = optparse.OptionParser()
|
||||
option_parser.add_option('--hz', type='int', default=20,
|
||||
help='Number of samples/sec.')
|
||||
option_parser.add_option('--duration', type='int', default=5,
|
||||
help='Seconds to monitor.')
|
||||
option_parser.add_option('--outfile', default='/tmp/devicestatsmonitor',
|
||||
help='Location to start output file.')
|
||||
test_options_parser.AddBuildTypeOption(option_parser)
|
||||
options, args = option_parser.parse_args(argv)
|
||||
|
||||
monitor = device_stats_monitor.DeviceStatsMonitor(
|
||||
android_commands.AndroidCommands(), options.hz, options.build_type)
|
||||
monitor.Start()
|
||||
print('Waiting for %d seconds while profiling.' % options.duration)
|
||||
time.sleep(options.duration)
|
||||
url = monitor.StopAndCollect(options.outfile)
|
||||
print('View results in browser at %s' % url)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
||||
@@ -1,170 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
"""A class to keep track of devices across builds and report state."""
|
||||
import logging
|
||||
import optparse
|
||||
import os
|
||||
import smtplib
|
||||
import sys
|
||||
|
||||
from pylib import buildbot_report
|
||||
from pylib.android_commands import GetAttachedDevices
|
||||
from pylib.cmd_helper import GetCmdOutput
|
||||
|
||||
|
||||
def DeviceInfo(serial):
|
||||
"""Gathers info on a device via various adb calls.
|
||||
|
||||
Args:
|
||||
serial: The serial of the attached device to construct info about.
|
||||
|
||||
Returns:
|
||||
Tuple of device type, build id and report as a string.
|
||||
"""
|
||||
|
||||
def AdbShellCmd(cmd):
|
||||
return GetCmdOutput('adb -s %s shell %s' % (serial, cmd),
|
||||
shell=True).strip()
|
||||
|
||||
device_type = AdbShellCmd('getprop ro.build.product')
|
||||
device_build = AdbShellCmd('getprop ro.build.id')
|
||||
|
||||
report = ['Device %s (%s)' % (serial, device_type),
|
||||
' Build: %s (%s)' % (device_build,
|
||||
AdbShellCmd('getprop ro.build.fingerprint')),
|
||||
' Battery: %s%%' % AdbShellCmd('dumpsys battery | grep level '
|
||||
"| awk '{print $2}'"),
|
||||
' Battery temp: %s' % AdbShellCmd('dumpsys battery'
|
||||
'| grep temp '
|
||||
"| awk '{print $2}'"),
|
||||
' IMEI slice: %s' % AdbShellCmd('dumpsys iphonesubinfo '
|
||||
'| grep Device'
|
||||
"| awk '{print $4}'")[-6:],
|
||||
' Wifi IP: %s' % AdbShellCmd('getprop dhcp.wlan0.ipaddress'),
|
||||
'']
|
||||
|
||||
return device_type, device_build, '\n'.join(report)
|
||||
|
||||
|
||||
def CheckForMissingDevices(options, adb_online_devs):
|
||||
"""Uses file of previous online devices to detect broken phones.
|
||||
|
||||
Args:
|
||||
options: out_dir parameter of options argument is used as the base
|
||||
directory to load and update the cache file.
|
||||
adb_online_devs: A list of serial numbers of the currently visible
|
||||
and online attached devices.
|
||||
"""
|
||||
# TODO(navabi): remove this once the bug that causes different number
|
||||
# of devices to be detected between calls is fixed.
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
out_dir = os.path.abspath(options.out_dir)
|
||||
|
||||
def ReadDeviceList(file_name):
|
||||
devices_path = os.path.join(out_dir, file_name)
|
||||
devices = []
|
||||
try:
|
||||
with open(devices_path) as f:
|
||||
devices = f.read().splitlines()
|
||||
except IOError:
|
||||
# Ignore error, file might not exist
|
||||
pass
|
||||
return devices
|
||||
|
||||
def WriteDeviceList(file_name, device_list):
|
||||
path = os.path.join(out_dir, file_name)
|
||||
if not os.path.exists(out_dir):
|
||||
os.makedirs(out_dir)
|
||||
with open(path, 'w') as f:
|
||||
# Write devices currently visible plus devices previously seen.
|
||||
f.write('\n'.join(set(device_list)))
|
||||
|
||||
last_devices_path = os.path.join(out_dir, '.last_devices')
|
||||
last_devices = ReadDeviceList('.last_devices')
|
||||
|
||||
missing_devs = list(set(last_devices) - set(adb_online_devs))
|
||||
if missing_devs:
|
||||
from_address = 'buildbot@chromium.org'
|
||||
to_address = 'chromium-android-device-alerts@google.com'
|
||||
bot_name = os.environ['BUILDBOT_BUILDERNAME']
|
||||
slave_name = os.environ['BUILDBOT_SLAVENAME']
|
||||
num_online_devs = len(adb_online_devs)
|
||||
subject = 'Devices offline on %s, %s (%d remaining).' % (slave_name,
|
||||
bot_name,
|
||||
num_online_devs)
|
||||
buildbot_report.PrintWarning()
|
||||
devices_missing_msg = '%d devices not detected.' % len(missing_devs)
|
||||
buildbot_report.PrintSummaryText(devices_missing_msg)
|
||||
|
||||
# TODO(navabi): Debug by printing both output from GetCmdOutput and
|
||||
# GetAttachedDevices to compare results.
|
||||
body = '\n'.join(
|
||||
['Current online devices: %s' % adb_online_devs,
|
||||
'%s are no longer visible. Were they removed?\n' % missing_devs,
|
||||
'SHERIFF: See go/chrome_device_monitor',
|
||||
'Cache file: %s\n\n' % last_devices_path,
|
||||
'adb devices: %s' % GetCmdOutput(['adb', 'devices']),
|
||||
'adb devices(GetAttachedDevices): %s' % GetAttachedDevices()])
|
||||
|
||||
print(body)
|
||||
|
||||
# Only send email if the first time a particular device goes offline
|
||||
last_missing = ReadDeviceList('.last_missing')
|
||||
new_missing_devs = set(missing_devs) - set(last_missing)
|
||||
|
||||
if new_missing_devs:
|
||||
msg_body = '\r\n'.join(
|
||||
['From: %s' % from_address,
|
||||
'To: %s' % to_address,
|
||||
'Subject: %s' % subject,
|
||||
'', body])
|
||||
try:
|
||||
server = smtplib.SMTP('localhost')
|
||||
server.sendmail(from_address, [to_address], msg_body)
|
||||
server.quit()
|
||||
except Exception as e:
|
||||
print('Failed to send alert email. Error: %s' % e)
|
||||
else:
|
||||
new_devs = set(adb_online_devs) - set(last_devices)
|
||||
if new_devs and os.path.exists(last_devices_path):
|
||||
buildbot_report.PrintWarning()
|
||||
buildbot_report.PrintSummaryText(
|
||||
'%d new devices detected' % len(new_devs))
|
||||
print(('New devices detected %s. And now back to your '
|
||||
'regularly scheduled program.' % list(new_devs)))
|
||||
WriteDeviceList('.last_devices', (adb_online_devs + last_devices))
|
||||
WriteDeviceList('.last_missing', missing_devs)
|
||||
|
||||
|
||||
def main():
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option('', '--out-dir',
|
||||
help='Directory where the device path is stored',
|
||||
default=os.path.join(os.path.dirname(__file__), '..',
|
||||
'..', 'out'))
|
||||
|
||||
options, args = parser.parse_args()
|
||||
if args:
|
||||
parser.error('Unknown options %s' % args)
|
||||
buildbot_report.PrintNamedStep('Device Status Check')
|
||||
devices = GetAttachedDevices()
|
||||
types, builds, reports = [], [], []
|
||||
if devices:
|
||||
types, builds, reports = list(zip(*[DeviceInfo(dev) for dev in devices]))
|
||||
|
||||
unique_types = list(set(types))
|
||||
unique_builds = list(set(builds))
|
||||
|
||||
buildbot_report.PrintMsg('Online devices: %d. Device types %s, builds %s'
|
||||
% (len(devices), unique_types, unique_builds))
|
||||
print('\n'.join(reports))
|
||||
CheckForMissingDevices(options, devices)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
@@ -1,321 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
"""Provides an interface to start and stop Android emulator.
|
||||
|
||||
Assumes system environment ANDROID_NDK_ROOT has been set.
|
||||
|
||||
Emulator: The class provides the methods to launch/shutdown the emulator with
|
||||
the android virtual device named 'avd_armeabi' .
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
from pylib import android_commands
|
||||
from pylib import cmd_helper
|
||||
|
||||
# adb_interface.py is under ../../third_party/android_testrunner/
|
||||
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..',
|
||||
'..', 'third_party', 'android_testrunner'))
|
||||
import adb_interface
|
||||
import errors
|
||||
import run_command
|
||||
|
||||
class EmulatorLaunchException(Exception):
|
||||
"""Emulator failed to launch."""
|
||||
pass
|
||||
|
||||
def _KillAllEmulators():
|
||||
"""Kill all running emulators that look like ones we started.
|
||||
|
||||
There are odd 'sticky' cases where there can be no emulator process
|
||||
running but a device slot is taken. A little bot trouble and and
|
||||
we're out of room forever.
|
||||
"""
|
||||
emulators = android_commands.GetEmulators()
|
||||
if not emulators:
|
||||
return
|
||||
for emu_name in emulators:
|
||||
cmd_helper.GetCmdOutput(['adb', '-s', emu_name, 'emu', 'kill'])
|
||||
logging.info('Emulator killing is async; give a few seconds for all to die.')
|
||||
for i in range(5):
|
||||
if not android_commands.GetEmulators():
|
||||
return
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def DeleteAllTempAVDs():
|
||||
"""Delete all temporary AVDs which are created for tests.
|
||||
|
||||
If the test exits abnormally and some temporary AVDs created when testing may
|
||||
be left in the system. Clean these AVDs.
|
||||
"""
|
||||
avds = android_commands.GetAVDs()
|
||||
if not avds:
|
||||
return
|
||||
for avd_name in avds:
|
||||
if 'run_tests_avd' in avd_name:
|
||||
cmd = ['android', '-s', 'delete', 'avd', '--name', avd_name]
|
||||
cmd_helper.GetCmdOutput(cmd)
|
||||
logging.info('Delete AVD %s' % avd_name)
|
||||
|
||||
|
||||
class PortPool(object):
|
||||
"""Pool for emulator port starting position that changes over time."""
|
||||
_port_min = 5554
|
||||
_port_max = 5585
|
||||
_port_current_index = 0
|
||||
|
||||
@classmethod
|
||||
def port_range(cls):
|
||||
"""Return a range of valid ports for emulator use.
|
||||
|
||||
The port must be an even number between 5554 and 5584. Sometimes
|
||||
a killed emulator "hangs on" to a port long enough to prevent
|
||||
relaunch. This is especially true on slow machines (like a bot).
|
||||
Cycling through a port start position helps make us resilient."""
|
||||
ports = list(range(cls._port_min, cls._port_max, 2))
|
||||
n = cls._port_current_index
|
||||
cls._port_current_index = (n + 1) % len(ports)
|
||||
return ports[n:] + ports[:n]
|
||||
|
||||
|
||||
def _GetAvailablePort():
|
||||
"""Returns an available TCP port for the console."""
|
||||
used_ports = []
|
||||
emulators = android_commands.GetEmulators()
|
||||
for emulator in emulators:
|
||||
used_ports.append(emulator.split('-')[1])
|
||||
for port in PortPool.port_range():
|
||||
if str(port) not in used_ports:
|
||||
return port
|
||||
|
||||
|
||||
class Emulator(object):
|
||||
"""Provides the methods to lanuch/shutdown the emulator.
|
||||
|
||||
The emulator has the android virtual device named 'avd_armeabi'.
|
||||
|
||||
The emulator could use any even TCP port between 5554 and 5584 for the
|
||||
console communication, and this port will be part of the device name like
|
||||
'emulator-5554'. Assume it is always True, as the device name is the id of
|
||||
emulator managed in this class.
|
||||
|
||||
Attributes:
|
||||
emulator: Path of Android's emulator tool.
|
||||
popen: Popen object of the running emulator process.
|
||||
device: Device name of this emulator.
|
||||
"""
|
||||
|
||||
# Signals we listen for to kill the emulator on
|
||||
_SIGNALS = (signal.SIGINT, signal.SIGHUP)
|
||||
|
||||
# Time to wait for an emulator launch, in seconds. This includes
|
||||
# the time to launch the emulator and a wait-for-device command.
|
||||
_LAUNCH_TIMEOUT = 120
|
||||
|
||||
# Timeout interval of wait-for-device command before bouncing to a a
|
||||
# process life check.
|
||||
_WAITFORDEVICE_TIMEOUT = 5
|
||||
|
||||
# Time to wait for a "wait for boot complete" (property set on device).
|
||||
_WAITFORBOOT_TIMEOUT = 300
|
||||
|
||||
def __init__(self, new_avd_name, fast_and_loose):
|
||||
"""Init an Emulator.
|
||||
|
||||
Args:
|
||||
nwe_avd_name: If set, will create a new temporary AVD.
|
||||
fast_and_loose: Loosen up the rules for reliable running for speed.
|
||||
Intended for quick testing or re-testing.
|
||||
|
||||
"""
|
||||
try:
|
||||
android_sdk_root = os.environ['ANDROID_SDK_ROOT']
|
||||
except KeyError:
|
||||
logging.critical('The ANDROID_SDK_ROOT must be set to run the test on '
|
||||
'emulator.')
|
||||
raise
|
||||
self.emulator = os.path.join(android_sdk_root, 'tools', 'emulator')
|
||||
self.android = os.path.join(android_sdk_root, 'tools', 'android')
|
||||
self.popen = None
|
||||
self.device = None
|
||||
self.default_avd = True
|
||||
self.fast_and_loose = fast_and_loose
|
||||
self.abi = 'armeabi-v7a'
|
||||
self.avd = 'avd_armeabi'
|
||||
if 'x86' in os.environ.get('TARGET_PRODUCT', ''):
|
||||
self.abi = 'x86'
|
||||
self.avd = 'avd_x86'
|
||||
if new_avd_name:
|
||||
self.default_avd = False
|
||||
self.avd = self._CreateAVD(new_avd_name)
|
||||
|
||||
def _DeviceName(self):
|
||||
"""Return our device name."""
|
||||
port = _GetAvailablePort()
|
||||
return ('emulator-%d' % port, port)
|
||||
|
||||
def _CreateAVD(self, avd_name):
|
||||
"""Creates an AVD with the given name.
|
||||
|
||||
Return avd_name.
|
||||
"""
|
||||
avd_command = [
|
||||
self.android,
|
||||
'--silent',
|
||||
'create', 'avd',
|
||||
'--name', avd_name,
|
||||
'--abi', self.abi,
|
||||
'--target', 'android-16',
|
||||
'-c', '128M',
|
||||
'--force',
|
||||
]
|
||||
avd_process = subprocess.Popen(args=avd_command,
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT)
|
||||
avd_process.stdin.write('no\n')
|
||||
avd_process.wait()
|
||||
logging.info('Create AVD command: %s', ' '.join(avd_command))
|
||||
return avd_name
|
||||
|
||||
def _DeleteAVD(self):
|
||||
"""Delete the AVD of this emulator."""
|
||||
avd_command = [
|
||||
self.android,
|
||||
'--silent',
|
||||
'delete',
|
||||
'avd',
|
||||
'--name', self.avd,
|
||||
]
|
||||
avd_process = subprocess.Popen(args=avd_command,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT)
|
||||
logging.info('Delete AVD command: %s', ' '.join(avd_command))
|
||||
avd_process.wait()
|
||||
|
||||
def Launch(self, kill_all_emulators):
|
||||
"""Launches the emulator asynchronously. Call ConfirmLaunch() to ensure the
|
||||
emulator is ready for use.
|
||||
|
||||
If fails, an exception will be raised.
|
||||
"""
|
||||
if kill_all_emulators:
|
||||
_KillAllEmulators() # just to be sure
|
||||
if not self.fast_and_loose:
|
||||
self._AggressiveImageCleanup()
|
||||
(self.device, port) = self._DeviceName()
|
||||
emulator_command = [
|
||||
self.emulator,
|
||||
# Speed up emulator launch by 40%. Really.
|
||||
'-no-boot-anim',
|
||||
# The default /data size is 64M.
|
||||
# That's not enough for 8 unit test bundles and their data.
|
||||
'-partition-size', '512',
|
||||
# Enable GPU by default.
|
||||
'-gpu', 'on',
|
||||
# Use a familiar name and port.
|
||||
'-avd', self.avd,
|
||||
'-port', str(port)]
|
||||
if not self.fast_and_loose:
|
||||
emulator_command.extend([
|
||||
# Wipe the data. We've seen cases where an emulator
|
||||
# gets 'stuck' if we don't do this (every thousand runs or
|
||||
# so).
|
||||
'-wipe-data',
|
||||
])
|
||||
logging.info('Emulator launch command: %s', ' '.join(emulator_command))
|
||||
self.popen = subprocess.Popen(args=emulator_command,
|
||||
stderr=subprocess.STDOUT)
|
||||
self._InstallKillHandler()
|
||||
|
||||
def _AggressiveImageCleanup(self):
|
||||
"""Aggressive cleanup of emulator images.
|
||||
|
||||
Experimentally it looks like our current emulator use on the bot
|
||||
leaves image files around in /tmp/android-$USER. If a "random"
|
||||
name gets reused, we choke with a 'File exists' error.
|
||||
TODO(jrg): is there a less hacky way to accomplish the same goal?
|
||||
"""
|
||||
logging.info('Aggressive Image Cleanup')
|
||||
emulator_imagedir = '/tmp/android-%s' % os.environ['USER']
|
||||
if not os.path.exists(emulator_imagedir):
|
||||
return
|
||||
for image in os.listdir(emulator_imagedir):
|
||||
full_name = os.path.join(emulator_imagedir, image)
|
||||
if 'emulator' in full_name:
|
||||
logging.info('Deleting emulator image %s', full_name)
|
||||
os.unlink(full_name)
|
||||
|
||||
def ConfirmLaunch(self, wait_for_boot=False):
|
||||
"""Confirm the emulator launched properly.
|
||||
|
||||
Loop on a wait-for-device with a very small timeout. On each
|
||||
timeout, check the emulator process is still alive.
|
||||
After confirming a wait-for-device can be successful, make sure
|
||||
it returns the right answer.
|
||||
"""
|
||||
seconds_waited = 0
|
||||
number_of_waits = 2 # Make sure we can wfd twice
|
||||
adb_cmd = "adb -s %s %s" % (self.device, 'wait-for-device')
|
||||
while seconds_waited < self._LAUNCH_TIMEOUT:
|
||||
try:
|
||||
run_command.RunCommand(adb_cmd,
|
||||
timeout_time=self._WAITFORDEVICE_TIMEOUT,
|
||||
retry_count=1)
|
||||
number_of_waits -= 1
|
||||
if not number_of_waits:
|
||||
break
|
||||
except errors.WaitForResponseTimedOutError as e:
|
||||
seconds_waited += self._WAITFORDEVICE_TIMEOUT
|
||||
adb_cmd = "adb -s %s %s" % (self.device, 'kill-server')
|
||||
run_command.RunCommand(adb_cmd)
|
||||
self.popen.poll()
|
||||
if self.popen.returncode != None:
|
||||
raise EmulatorLaunchException('EMULATOR DIED')
|
||||
if seconds_waited >= self._LAUNCH_TIMEOUT:
|
||||
raise EmulatorLaunchException('TIMEOUT with wait-for-device')
|
||||
logging.info('Seconds waited on wait-for-device: %d', seconds_waited)
|
||||
if wait_for_boot:
|
||||
# Now that we checked for obvious problems, wait for a boot complete.
|
||||
# Waiting for the package manager is sometimes problematic.
|
||||
a = android_commands.AndroidCommands(self.device)
|
||||
a.WaitForSystemBootCompleted(self._WAITFORBOOT_TIMEOUT)
|
||||
|
||||
def Shutdown(self):
|
||||
"""Shuts down the process started by launch."""
|
||||
if not self.default_avd:
|
||||
self._DeleteAVD()
|
||||
if self.popen:
|
||||
self.popen.poll()
|
||||
if self.popen.returncode == None:
|
||||
self.popen.kill()
|
||||
self.popen = None
|
||||
|
||||
def _ShutdownOnSignal(self, signum, frame):
|
||||
logging.critical('emulator _ShutdownOnSignal')
|
||||
for sig in self._SIGNALS:
|
||||
signal.signal(sig, signal.SIG_DFL)
|
||||
self.Shutdown()
|
||||
raise KeyboardInterrupt # print a stack
|
||||
|
||||
def _InstallKillHandler(self):
|
||||
"""Install a handler to kill the emulator when we exit unexpectedly."""
|
||||
for sig in self._SIGNALS:
|
||||
signal.signal(sig, self._ShutdownOnSignal)
|
||||
|
||||
def main(argv):
|
||||
Emulator(None, True).Launch(True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv)
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
"""Enables dalvik vm asserts in the android device."""
|
||||
|
||||
from pylib import android_commands
|
||||
import optparse
|
||||
import sys
|
||||
|
||||
|
||||
def main(argv):
|
||||
option_parser = optparse.OptionParser()
|
||||
option_parser.add_option('--enable_asserts', dest='set_asserts',
|
||||
action='store_true', default=None,
|
||||
help='Sets the dalvik.vm.enableassertions property to "all"')
|
||||
option_parser.add_option('--disable_asserts', dest='set_asserts',
|
||||
action='store_false', default=None,
|
||||
help='Removes the dalvik.vm.enableassertions property')
|
||||
options, _ = option_parser.parse_args(argv)
|
||||
|
||||
commands = android_commands.AndroidCommands()
|
||||
if options.set_asserts != None:
|
||||
if commands.SetJavaAssertsEnabled(options.set_asserts):
|
||||
commands.Reboot(full_reboot=False)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv)
|
||||
@@ -1,133 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
# Sets up environment for building Chromium on Android. It can either be
|
||||
# compiled with the Android tree or using the Android SDK/NDK. To build with
|
||||
# NDK/SDK: ". build/android/envsetup.sh --sdk". Environment variable
|
||||
# ANDROID_SDK_BUILD=1 will then be defined and used in the rest of the setup to
|
||||
# specifiy build type.
|
||||
|
||||
# When building WebView as part of Android we can't use the SDK. Other builds
|
||||
# default to using the SDK.
|
||||
# NOTE(yfriedman): This looks unnecessary but downstream the default value
|
||||
# should be 0 until all builds switch to SDK/NDK.
|
||||
if [[ "${CHROME_ANDROID_BUILD_WEBVIEW}" -eq 1 ]]; then
|
||||
export ANDROID_SDK_BUILD=0
|
||||
else
|
||||
export ANDROID_SDK_BUILD=1
|
||||
fi
|
||||
# Loop over args in case we add more arguments in the future.
|
||||
while [ "$1" != "" ]; do
|
||||
case $1 in
|
||||
-s | --sdk ) export ANDROID_SDK_BUILD=1 ; shift ;;
|
||||
* ) shift ; break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "${ANDROID_SDK_BUILD}" -eq 1 ]]; then
|
||||
echo "Using SDK build"
|
||||
fi
|
||||
|
||||
host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
|
||||
|
||||
case "${host_os}" in
|
||||
"linux")
|
||||
toolchain_dir="linux-x86_64"
|
||||
;;
|
||||
"mac")
|
||||
toolchain_dir="darwin-x86"
|
||||
;;
|
||||
*)
|
||||
echo "Host platform ${host_os} is not supported" >& 2
|
||||
return 1
|
||||
esac
|
||||
|
||||
CURRENT_DIR="$(readlink -f "$(dirname $BASH_SOURCE)/../../")"
|
||||
if [[ -z "${CHROME_SRC}" ]]; then
|
||||
# If $CHROME_SRC was not set, assume current directory is CHROME_SRC.
|
||||
export CHROME_SRC="${CURRENT_DIR}"
|
||||
fi
|
||||
|
||||
if [[ "${CURRENT_DIR/"${CHROME_SRC}"/}" == "${CURRENT_DIR}" ]]; then
|
||||
# If current directory is not in $CHROME_SRC, it might be set for other
|
||||
# source tree. If $CHROME_SRC was set correctly and we are in the correct
|
||||
# directory, "${CURRENT_DIR/"${CHROME_SRC}"/}" will be "".
|
||||
# Otherwise, it will equal to "${CURRENT_DIR}"
|
||||
echo "Warning: Current directory is out of CHROME_SRC, it may not be \
|
||||
the one you want."
|
||||
echo "${CHROME_SRC}"
|
||||
fi
|
||||
|
||||
# Android sdk platform version to use
|
||||
export ANDROID_SDK_VERSION=16
|
||||
|
||||
# Source functions script. The file is in the same directory as this script.
|
||||
. "$(dirname $BASH_SOURCE)"/envsetup_functions.sh
|
||||
|
||||
if [[ "${ANDROID_SDK_BUILD}" -eq 1 ]]; then
|
||||
sdk_build_init
|
||||
# Sets up environment for building Chromium for Android with source. Expects
|
||||
# android environment setup and lunch.
|
||||
elif [[ -z "$ANDROID_BUILD_TOP" || \
|
||||
-z "$ANDROID_TOOLCHAIN" || \
|
||||
-z "$ANDROID_PRODUCT_OUT" ]]; then
|
||||
echo "Android build environment variables must be set."
|
||||
echo "Please cd to the root of your Android tree and do: "
|
||||
echo " . build/envsetup.sh"
|
||||
echo " lunch"
|
||||
echo "Then try this again."
|
||||
echo "Or did you mean NDK/SDK build. Run envsetup.sh with --sdk argument."
|
||||
return 1
|
||||
elif [[ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]]; then
|
||||
webview_build_init
|
||||
else
|
||||
non_sdk_build_init
|
||||
fi
|
||||
|
||||
# Workaround for valgrind build
|
||||
if [[ -n "$CHROME_ANDROID_VALGRIND_BUILD" ]]; then
|
||||
# arm_thumb=0 is a workaround for https://bugs.kde.org/show_bug.cgi?id=270709
|
||||
DEFINES+=" arm_thumb=0 release_extra_cflags='-fno-inline\
|
||||
-fno-omit-frame-pointer -fno-builtin' release_valgrind_build=1\
|
||||
release_optimize=1"
|
||||
fi
|
||||
|
||||
# Source a bunch of helper functions
|
||||
. ${CHROME_SRC}/build/android/adb_device_functions.sh
|
||||
|
||||
ANDROID_GOMA_WRAPPER=""
|
||||
if [[ -d $GOMA_DIR ]]; then
|
||||
ANDROID_GOMA_WRAPPER="$GOMA_DIR/gomacc"
|
||||
fi
|
||||
export ANDROID_GOMA_WRAPPER
|
||||
|
||||
# Declare Android are cross compile.
|
||||
export GYP_CROSSCOMPILE=1
|
||||
|
||||
export CXX_target="${ANDROID_GOMA_WRAPPER} \
|
||||
$(echo -n ${ANDROID_TOOLCHAIN}/*-g++)"
|
||||
|
||||
# Performs a gyp_chromium run to convert gyp->Makefile for android code.
|
||||
android_gyp() {
|
||||
echo "GYP_GENERATORS set to '$GYP_GENERATORS'"
|
||||
# http://crbug.com/143889.
|
||||
# In case we are doing a Clang build, we have to unset CC_target and
|
||||
# CXX_target. Otherwise GYP ends up generating a gcc build (although we set
|
||||
# 'clang' to 1). This behavior was introduced by
|
||||
# 54d2f6fe6d8a7b9d9786bd1f8540df6b4f46b83f in GYP.
|
||||
(
|
||||
# Fork to avoid side effects on the user's environment variables.
|
||||
if echo "$GYP_DEFINES" | grep -qE '(clang|asan)'; then
|
||||
if echo "$CXX_target" | grep -q g++; then
|
||||
unset CXX_target
|
||||
fi
|
||||
fi
|
||||
"${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" --check "$@"
|
||||
)
|
||||
}
|
||||
|
||||
# FLOCK needs to be null on system that has no flock
|
||||
which flock > /dev/null || export FLOCK=
|
||||
@@ -1,334 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
# Defines functions for envsetup.sh which sets up environment for building
|
||||
# Chromium on Android. The build can be either use the Android NDK/SDK or
|
||||
# android source tree. Each has a unique init function which calls functions
|
||||
# prefixed with "common_" that is common for both environment setups.
|
||||
|
||||
################################################################################
|
||||
# Check to make sure the toolchain exists for the NDK version.
|
||||
################################################################################
|
||||
common_check_toolchain() {
|
||||
if [[ ! -d "${ANDROID_TOOLCHAIN}" ]]; then
|
||||
echo "Can not find Android toolchain in ${ANDROID_TOOLCHAIN}." >& 2
|
||||
echo "The NDK version might be wrong." >& 2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Exports environment variables common to both sdk and non-sdk build (e.g. PATH)
|
||||
# based on CHROME_SRC and ANDROID_TOOLCHAIN, along with DEFINES for GYP_DEFINES.
|
||||
################################################################################
|
||||
common_vars_defines() {
|
||||
|
||||
# Set toolchain path according to product architecture.
|
||||
toolchain_arch="arm-linux-androideabi"
|
||||
if [[ "${TARGET_PRODUCT}" =~ .*x86.* ]]; then
|
||||
toolchain_arch="x86"
|
||||
fi
|
||||
|
||||
toolchain_version="4.6"
|
||||
toolchain_target=$(basename \
|
||||
${ANDROID_NDK_ROOT}/toolchains/${toolchain_arch}-${toolchain_version})
|
||||
toolchain_path="${ANDROID_NDK_ROOT}/toolchains/${toolchain_target}"\
|
||||
"/prebuilt/${toolchain_dir}/bin/"
|
||||
|
||||
# Set only if not already set.
|
||||
# Don't override ANDROID_TOOLCHAIN if set by Android configuration env.
|
||||
export ANDROID_TOOLCHAIN=${ANDROID_TOOLCHAIN:-${toolchain_path}}
|
||||
|
||||
common_check_toolchain
|
||||
|
||||
# Add Android SDK/NDK tools to system path.
|
||||
export PATH=$PATH:${ANDROID_NDK_ROOT}
|
||||
export PATH=$PATH:${ANDROID_SDK_ROOT}/tools
|
||||
export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools
|
||||
|
||||
# This must be set before ANDROID_TOOLCHAIN, so that clang could find the
|
||||
# gold linker.
|
||||
# TODO(michaelbai): Remove this path once the gold linker become the default
|
||||
# linker.
|
||||
export PATH=$PATH:${CHROME_SRC}/build/android/${toolchain_arch}-gold
|
||||
|
||||
# Must have tools like arm-linux-androideabi-gcc on the path for ninja
|
||||
export PATH=$PATH:${ANDROID_TOOLCHAIN}
|
||||
|
||||
# Add Chromium Android development scripts to system path.
|
||||
# Must be after CHROME_SRC is set.
|
||||
export PATH=$PATH:${CHROME_SRC}/build/android
|
||||
|
||||
# TODO(beverloo): Remove these once all consumers updated to --strip-binary.
|
||||
export OBJCOPY=$(echo ${ANDROID_TOOLCHAIN}/*-objcopy)
|
||||
export STRIP=$(echo ${ANDROID_TOOLCHAIN}/*-strip)
|
||||
|
||||
# The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories
|
||||
# to canonicalize them (remove double '/', remove trailing '/', etc).
|
||||
DEFINES="OS=android"
|
||||
DEFINES+=" host_os=${host_os}"
|
||||
|
||||
if [[ -n "$CHROME_ANDROID_OFFICIAL_BUILD" ]]; then
|
||||
DEFINES+=" branding=Chrome"
|
||||
DEFINES+=" buildtype=Official"
|
||||
|
||||
# These defines are used by various chrome build scripts to tag the binary's
|
||||
# version string as 'official' in linux builds (e.g. in
|
||||
# chrome/trunk/src/chrome/tools/build/version.py).
|
||||
export OFFICIAL_BUILD=1
|
||||
export CHROMIUM_BUILD="_google_chrome"
|
||||
export CHROME_BUILD_TYPE="_official"
|
||||
|
||||
# Used by chrome_version_info_posix.cc to display the channel name.
|
||||
# Valid values: "unstable", "stable", "dev", "beta".
|
||||
export CHROME_VERSION_EXTRA="beta"
|
||||
fi
|
||||
|
||||
# The order file specifies the order of symbols in the .text section of the
|
||||
# shared library, libchromeview.so. The file is an order list of section
|
||||
# names and the library is linked with option
|
||||
# --section-ordering-file=<orderfile>. The order file is updated by profiling
|
||||
# startup after compiling with the order_profiling=1 GYP_DEFINES flag.
|
||||
ORDER_DEFINES="order_text_section=${CHROME_SRC}/orderfiles/orderfile.out"
|
||||
|
||||
# The following defines will affect ARM code generation of both C/C++ compiler
|
||||
# and V8 mksnapshot.
|
||||
case "${TARGET_PRODUCT}" in
|
||||
"passion"|"soju"|"sojua"|"sojus"|"yakju"|"mysid"|"nakasi")
|
||||
DEFINES+=" arm_neon=1 armv7=1 arm_thumb=1"
|
||||
DEFINES+=" ${ORDER_DEFINES}"
|
||||
TARGET_ARCH="arm"
|
||||
;;
|
||||
"trygon"|"tervigon")
|
||||
DEFINES+=" arm_neon=0 armv7=1 arm_thumb=1 arm_fpu=vfpv3-d16"
|
||||
DEFINES+=" ${ORDER_DEFINES}"
|
||||
TARGET_ARCH="arm"
|
||||
;;
|
||||
"full")
|
||||
DEFINES+=" arm_neon=0 armv7=0 arm_thumb=1 arm_fpu=vfp"
|
||||
TARGET_ARCH="arm"
|
||||
;;
|
||||
*x86*)
|
||||
# TODO(tedbo): The ia32 build fails on ffmpeg, so we disable it here.
|
||||
DEFINES+=" use_libffmpeg=0"
|
||||
|
||||
host_arch=$(uname -m | sed -e \
|
||||
's/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/')
|
||||
DEFINES+=" host_arch=${host_arch}"
|
||||
TARGET_ARCH="x86"
|
||||
;;
|
||||
*)
|
||||
echo "TARGET_PRODUCT: ${TARGET_PRODUCT} is not supported." >& 2
|
||||
return 1
|
||||
esac
|
||||
|
||||
case "${TARGET_ARCH}" in
|
||||
"arm")
|
||||
DEFINES+=" target_arch=arm"
|
||||
;;
|
||||
"x86")
|
||||
DEFINES+=" target_arch=ia32"
|
||||
;;
|
||||
*)
|
||||
echo "TARGET_ARCH: ${TARGET_ARCH} is not supported." >& 2
|
||||
return 1
|
||||
esac
|
||||
|
||||
DEFINES+=" android_gdbserver=${ANDROID_NDK_ROOT}/prebuilt/\
|
||||
android-${TARGET_ARCH}/gdbserver/gdbserver"
|
||||
}
|
||||
|
||||
|
||||
################################################################################
|
||||
# Exports common GYP variables based on variable DEFINES and CHROME_SRC.
|
||||
################################################################################
|
||||
common_gyp_vars() {
|
||||
export GYP_DEFINES="${DEFINES}"
|
||||
|
||||
# Set GYP_GENERATORS to make-android if it's currently unset or null.
|
||||
export GYP_GENERATORS="${GYP_GENERATORS:-make-android}"
|
||||
|
||||
# Use our All target as the default
|
||||
export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All"
|
||||
|
||||
# We want to use our version of "all" targets.
|
||||
export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android.gyp"
|
||||
}
|
||||
|
||||
|
||||
################################################################################
|
||||
# Initializes environment variables for NDK/SDK build. Only Android NDK Revision
|
||||
# 7 on Linux or Mac is offically supported. To run this script, the system
|
||||
# environment ANDROID_NDK_ROOT must be set to Android NDK's root path. The
|
||||
# ANDROID_SDK_ROOT only needs to be set to override the default SDK which is in
|
||||
# the tree under $ROOT/src/third_party/android_tools/sdk.
|
||||
# TODO(navabi): Add NDK to $ROOT/src/third_party/android_tools/ndk.
|
||||
# To build Chromium for Android with NDK/SDK follow the steps below:
|
||||
# > export ANDROID_NDK_ROOT=<android ndk root>
|
||||
# > export ANDROID_SDK_ROOT=<android sdk root> # to override the default sdk
|
||||
# > . build/android/envsetup.sh --sdk
|
||||
# > make
|
||||
################################################################################
|
||||
sdk_build_init() {
|
||||
# If ANDROID_NDK_ROOT is set when envsetup is run, use the ndk pointed to by
|
||||
# the environment variable. Otherwise, use the default ndk from the tree.
|
||||
if [[ -z "${ANDROID_NDK_ROOT}" || ! -d "${ANDROID_NDK_ROOT}" ]]; then
|
||||
export ANDROID_NDK_ROOT="${CHROME_SRC}/third_party/android_tools/ndk/"
|
||||
fi
|
||||
|
||||
# If ANDROID_SDK_ROOT is set when envsetup is run, and if it has the
|
||||
# right SDK-compatible directory layout, use the sdk pointed to by the
|
||||
# environment variable. Otherwise, use the default sdk from the tree.
|
||||
local sdk_suffix=platforms/android-${ANDROID_SDK_VERSION}
|
||||
if [[ -z "${ANDROID_SDK_ROOT}" || \
|
||||
! -d "${ANDROID_SDK_ROOT}/${sdk_suffix}" ]]; then
|
||||
export ANDROID_SDK_ROOT="${CHROME_SRC}/third_party/android_tools/sdk/"
|
||||
fi
|
||||
|
||||
# Makes sure ANDROID_BUILD_TOP is unset if build has option --sdk
|
||||
unset ANDROID_BUILD_TOP
|
||||
|
||||
# Set default target.
|
||||
export TARGET_PRODUCT="${TARGET_PRODUCT:-trygon}"
|
||||
|
||||
# Unset toolchain so that it can be set based on TARGET_PRODUCT.
|
||||
# This makes it easy to switch between architectures.
|
||||
unset ANDROID_TOOLCHAIN
|
||||
|
||||
common_vars_defines
|
||||
|
||||
DEFINES+=" sdk_build=1"
|
||||
# If we are building NDK/SDK, and in the upstream (open source) tree,
|
||||
# define a special variable for bringup purposes.
|
||||
case "${ANDROID_BUILD_TOP-undefined}" in
|
||||
"undefined")
|
||||
DEFINES+=" android_upstream_bringup=1"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Sets android specific directories to NOT_SDK_COMPLIANT. This will allow
|
||||
# android_gyp to generate make files, but will cause errors when (and only
|
||||
# when) building targets that depend on these directories.
|
||||
DEFINES+=" android_src='NOT_SDK_COMPLIANT'"
|
||||
DEFINES+=" android_product_out=${CHROME_SRC}/out/android"
|
||||
DEFINES+=" android_lib='NOT_SDK_COMPLIANT'"
|
||||
DEFINES+=" android_static_lib='NOT_SDK_COMPLIANT'"
|
||||
DEFINES+=" android_sdk=${ANDROID_SDK_ROOT}/${sdk_suffix}"
|
||||
DEFINES+=" android_sdk_root=${ANDROID_SDK_ROOT}"
|
||||
DEFINES+=" android_sdk_tools=${ANDROID_SDK_ROOT}/platform-tools"
|
||||
DEFINES+=" android_sdk_version=${ANDROID_SDK_VERSION}"
|
||||
DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}"
|
||||
|
||||
common_gyp_vars
|
||||
|
||||
if [[ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]]; then
|
||||
# Can not build WebView with NDK/SDK because it needs the Android build
|
||||
# system and build inside an Android source tree.
|
||||
echo "Can not build WebView with NDK/SDK. Requires android source tree." \
|
||||
>& 2
|
||||
echo "Try . build/android/envsetup.sh instead." >& 2
|
||||
return 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Initializes environment variables for build with android source. This expects
|
||||
# android environment to be set up along with lunch. To build:
|
||||
# > . build/envsetup.sh
|
||||
# > lunch <lunch-type>
|
||||
# > . build/android/envsetup.sh
|
||||
# > make
|
||||
#############################################################################
|
||||
non_sdk_build_init() {
|
||||
# We export "TOP" here so that "mmm" can be run to build Java code without
|
||||
# having to cd to $ANDROID_BUILD_TOP.
|
||||
export TOP="$ANDROID_BUILD_TOP"
|
||||
|
||||
# Set "ANDROID_NDK_ROOT" as checked-in version, if it was not set.
|
||||
if [[ "${ANDROID_NDK_ROOT}" || ! -d "$ANDROID_NDK_ROOT" ]] ; then
|
||||
export ANDROID_NDK_ROOT="${CHROME_SRC}/third_party/android_tools/ndk/"
|
||||
fi
|
||||
if [[ ! -d "${ANDROID_NDK_ROOT}" ]] ; then
|
||||
echo "Can not find Android NDK root ${ANDROID_NDK_ROOT}." >& 2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# We export "ANDROID_SDK_ROOT" for building Java source with the SDK.
|
||||
export ANDROID_SDK_ROOT=${ANDROID_BUILD_TOP}/prebuilts/sdk/\
|
||||
${ANDROID_SDK_VERSION}
|
||||
# Needed by android antfiles when creating apks.
|
||||
export ANDROID_SDK_HOME=${ANDROID_SDK_ROOT}
|
||||
|
||||
# Unset ANDROID_TOOLCHAIN, so it could be set to checked-in 64-bit toolchain.
|
||||
# in common_vars_defines
|
||||
unset ANDROID_TOOLCHAIN
|
||||
|
||||
common_vars_defines
|
||||
|
||||
DEFINES+=" sdk_build=0"
|
||||
DEFINES+=" android_product_out=${ANDROID_PRODUCT_OUT}"
|
||||
|
||||
if [[ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]]; then
|
||||
webview_build_init
|
||||
return
|
||||
fi
|
||||
|
||||
# The non-SDK build currently requires the SDK path to build the framework
|
||||
# Java aidl files. TODO(steveblock): Investigate avoiding this requirement.
|
||||
DEFINES+=" android_sdk=${ANDROID_SDK_ROOT}"
|
||||
DEFINES+=" android_sdk_root=${ANDROID_SDK_ROOT}"
|
||||
DEFINES+=" android_sdk_tools=${ANDROID_SDK_ROOT}/../tools/linux"
|
||||
DEFINES+=" android_sdk_version=${ANDROID_SDK_VERSION}"
|
||||
DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}"
|
||||
|
||||
common_gyp_vars
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# To build WebView, we use the Android build system and build inside an Android
|
||||
# source tree. This method is called from non_sdk_build_init() and adds to the
|
||||
# settings specified there.
|
||||
#############################################################################
|
||||
webview_build_init() {
|
||||
# For the WebView build we always use the NDK and SDK in the Android tree,
|
||||
# and we don't touch ANDROID_TOOLCHAIN which is already set by Android.
|
||||
export ANDROID_NDK_ROOT=${ANDROID_BUILD_TOP}/prebuilts/ndk/8
|
||||
export ANDROID_SDK_ROOT=${ANDROID_BUILD_TOP}/prebuilts/sdk/\
|
||||
${ANDROID_SDK_VERSION}
|
||||
|
||||
common_vars_defines
|
||||
|
||||
# We need to supply SDK paths relative to the top of the Android tree to make
|
||||
# sure the generated Android makefiles are portable, as they will be checked
|
||||
# into the Android tree.
|
||||
ANDROID_SDK=$(python -c \
|
||||
"import os.path; print os.path.relpath('${ANDROID_SDK_ROOT}', \
|
||||
'${ANDROID_BUILD_TOP}')")
|
||||
ANDROID_SDK_TOOLS=$(python -c \
|
||||
"import os.path; \
|
||||
print os.path.relpath('${ANDROID_SDK_ROOT}/../tools/linux', \
|
||||
'${ANDROID_BUILD_TOP}')")
|
||||
DEFINES+=" android_build_type=1"
|
||||
DEFINES+=" sdk_build=0"
|
||||
DEFINES+=" android_src=\$(GYP_ABS_ANDROID_TOP_DIR)"
|
||||
DEFINES+=" android_product_out=NOT_USED_ON_WEBVIEW"
|
||||
DEFINES+=" android_upstream_bringup=1"
|
||||
DEFINES+=" android_sdk=\$(GYP_ABS_ANDROID_TOP_DIR)/${ANDROID_SDK}"
|
||||
DEFINES+=" android_sdk_root=\$(GYP_ABS_ANDROID_TOP_DIR)/${ANDROID_SDK}"
|
||||
DEFINES+=" android_sdk_tools=\$(GYP_ABS_ANDROID_TOP_DIR)/${ANDROID_SDK_TOOLS}"
|
||||
DEFINES+=" android_sdk_version=${ANDROID_SDK_VERSION}"
|
||||
DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}"
|
||||
export GYP_DEFINES="${DEFINES}"
|
||||
|
||||
export GYP_GENERATORS="android"
|
||||
|
||||
export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All"
|
||||
export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} limit_to_target_all=1"
|
||||
export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} auto_regeneration=0"
|
||||
|
||||
export CHROMIUM_GYP_FILE="${CHROME_SRC}/android_webview/all_webview.gyp"
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2012 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.
|
||||
#
|
||||
# Attach gdb to a running android application. Similar to ndk-gdb.
|
||||
# Run with --annotate=3 if running under emacs (M-x gdb).
|
||||
#
|
||||
# By default it is used to debug content shell, if it is used to
|
||||
# debug other piceces, '-p' and '-l' options are needed.
|
||||
# For *unittests_apk (like base_unittests_apk), run with:
|
||||
# "gdb_apk -p org.chromium.native_test -l out/Release/lib.target -r"
|
||||
|
||||
# Run a command through adb shell, strip the extra \r from the output
|
||||
# and return the correct status code to detect failures. This assumes
|
||||
# that the adb shell command prints a final \n to stdout.
|
||||
# args: command to run
|
||||
# Prints the command's stdout on stdout
|
||||
# Returns the command's status
|
||||
# Note: the command's stderr is lost
|
||||
adb_shell () {
|
||||
local TMPOUT="$(mktemp)"
|
||||
local LASTLINE RET
|
||||
local ADB=${ADB:-adb}
|
||||
|
||||
# The weird sed rule is to strip the final \r on each output line
|
||||
# Since 'adb shell' never returns the command's proper exit/status code,
|
||||
# we force it to print it as '%%<status>' in the temporary output file,
|
||||
# which we will later strip from it.
|
||||
$ADB shell $@ ";" echo "%%\$?" 2>/dev/null | sed -e 's![[:cntrl:]]!!g' > $TMPOUT
|
||||
# Get last line in log, which contains the exit code from the command
|
||||
LASTLINE=$(sed -e '$!d' $TMPOUT)
|
||||
# Extract the status code from the end of the line, which must be '%%<code>'
|
||||
RET=$(echo "$LASTLINE" | awk '{ if (match($0, "%%[0-9]+$")) { print substr($0,RSTART+2); } }')
|
||||
# Remove the status code from the last line. Note that this may result in an empty line
|
||||
LASTLINE=$(echo "$LASTLINE" | awk '{ if (match($0, "%%[0-9]+$")) { print substr($0,1,RSTART-1); } }')
|
||||
# The output itself: all lines except the status code
|
||||
sed -e '$d' $TMPOUT && echo -n "$LASTLINE"
|
||||
# Remove temp file
|
||||
rm -f $TMPOUT
|
||||
# Exit with the appropriate status
|
||||
return $RET
|
||||
}
|
||||
|
||||
adb=$(which adb)
|
||||
if [[ "$adb" = "" ]] ; then
|
||||
echo "Need adb in your path"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
usage() {
|
||||
echo "usage: ${0##*/} [-p package_name] [-l shared_lib_dir] [-g gdb] [-r]"
|
||||
echo "-p package_name the android APK package to be debugged"
|
||||
echo "-l shared_lib_dir directory containes native shared library"
|
||||
echo "-g gdb_args agruments for gdb, eg: -g '-n -write'"
|
||||
echo "-r the target device is rooted"
|
||||
}
|
||||
|
||||
process_options() {
|
||||
local OPTNAME OPTIND OPTERR OPTARG
|
||||
while getopts ":p:l:g:r" OPTNAME; do
|
||||
case "$OPTNAME" in
|
||||
p)
|
||||
package_name="$OPTARG"
|
||||
;;
|
||||
l)
|
||||
shared_lib_dir="$OPTARG"
|
||||
;;
|
||||
g)
|
||||
gdb_args="$OPTARG"
|
||||
;;
|
||||
r)
|
||||
rooted_phone=1
|
||||
;;
|
||||
\:)
|
||||
echo "'-$OPTARG' needs an argument."
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo "invalid command line option: $OPTARG"
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $# -ge ${OPTIND} ]; then
|
||||
eval echo "Unexpected command line argument: \${${OPTIND}}"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
rooted_phone=0
|
||||
|
||||
root=$(dirname $0)/../..
|
||||
package_name=org.chromium.content_shell
|
||||
shared_lib_dir=$root/out/${BUILDTYPE:-Debug}/lib.target
|
||||
gdb_args=''
|
||||
|
||||
#process options
|
||||
process_options "$@"
|
||||
echo "Debug package $package_name"
|
||||
echo "Assume native shared library is under $shared_lib_dir"
|
||||
|
||||
data_dir=/data/data/$package_name
|
||||
gdb_server_on_device=$data_dir/lib/gdbserver
|
||||
|
||||
# Kill any running gdbserver
|
||||
pid=$(adb shell ps | awk '/gdbserver/ {print $2}')
|
||||
if [[ "$pid" != "" ]] ; then
|
||||
if [[ $rooted_phone -eq 1 ]] ; then
|
||||
adb shell kill $pid
|
||||
else
|
||||
adb shell run-as $package_name kill $pid
|
||||
fi
|
||||
fi
|
||||
|
||||
pid=$(adb_shell ps | awk "/$package_name$/ {print \$2}")
|
||||
if [[ "$pid" = "" ]] ; then
|
||||
echo "No $package_name running?"
|
||||
echo "Try this: adb shell am start -a android.intent.action.VIEW " \
|
||||
"-n $package_name/.SomethingActivity (Something might be ContentShell)"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
no_gdb_server=$(adb shell ls $gdb_server_on_device | grep 'No such file')
|
||||
if [[ "$no_gdb_server" != "" ]] ; then
|
||||
echo "No gdb server on device at $gdb_server_on_device"
|
||||
echo "Please install a debug build."
|
||||
exit 3
|
||||
fi
|
||||
|
||||
if [[ $rooted_phone -eq 1 ]] ; then
|
||||
adb shell $gdb_server_on_device :4321 --attach $pid &
|
||||
adb forward tcp:4321 tcp:4321
|
||||
else
|
||||
adb shell run-as $package_name lib/gdbserver +debug-socket --attach $pid &
|
||||
adb forward tcp:4321 localfilesystem:$data_dir/debug-socket
|
||||
fi
|
||||
sleep 2
|
||||
|
||||
# Pull app_process and C libraries from device if needed
|
||||
app_process=${shared_lib_dir}/app_process
|
||||
if [[ ! -f ${app_process} ]] ; then
|
||||
adb pull /system/bin/app_process ${app_process}
|
||||
adb pull /system/lib/libc.so ${shared_lib_dir}
|
||||
fi
|
||||
|
||||
# gdb commands
|
||||
cmdfile=$(mktemp /tmp/gdb_android_XXXXXXXX)
|
||||
cat >$cmdfile<<EOF
|
||||
# set solib-absolute-prefix null
|
||||
set solib-search-path ${shared_lib_dir}
|
||||
file ${app_process}
|
||||
target remote :4321
|
||||
EOF
|
||||
|
||||
gdb=$(echo $ANDROID_TOOLCHAIN/../../linux-x86/bin/*gdb)
|
||||
if [[ ! -f ${gdb} ]] ; then
|
||||
echo "Wow no gdb in env var ANDROID_TOOLCHAIN which is $ANDROID_TOOLCHAIN"
|
||||
exit 4
|
||||
else
|
||||
echo Using $gdb
|
||||
fi
|
||||
|
||||
# ${gdb} -x $cmdfile $* $app_process
|
||||
${gdb} -x $cmdfile $gdb_args
|
||||
rm $cmdfile
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2012 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.
|
||||
#
|
||||
# Attach gdb to a running content shell. Redirect to the shell gdb_apk
|
||||
|
||||
ROOT=$(cd "$(dirname $0)"; pwd)
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
exec ${ROOT}/gdb_apk -r -g "$*"
|
||||
else
|
||||
exec ${ROOT}/gdb_apk -r -p org.chromium.content_shell
|
||||
fi
|
||||
@@ -1,29 +0,0 @@
|
||||
# List of suppressions
|
||||
|
||||
# Android will not support StackTrace.
|
||||
StackTrace.*
|
||||
#
|
||||
# Sometimes this is automatically generated by run_tests.py
|
||||
VerifyPathControlledByUserTest.Symlinks
|
||||
|
||||
# http://crbug.com/138845
|
||||
MessagePumpLibeventTest.TestWatchingFromBadThread
|
||||
|
||||
StringPrintfTest.StringPrintfMisc
|
||||
StringPrintfTest.StringAppendfString
|
||||
StringPrintfTest.StringAppendfInt
|
||||
StringPrintfTest.StringPrintfBounds
|
||||
ProcessUtilTest.GetAppOutputRestrictedSIGPIPE
|
||||
# TODO(jrg): Fails on bots. Works locally. Figure out why. 2/6/12
|
||||
FieldTrialTest.*
|
||||
# TODO(zhenghao): Fail from build 6102 r123270. http://crbug.com/115612
|
||||
StackContainer.BufferAlignment
|
||||
# Failed on bot since it was first introduced.
|
||||
FileUtilProxyTest.Touch
|
||||
# Failing because FD remapping not supported in multiprocess_test_android.cc yet.
|
||||
ProcessUtilTest.FDRemapping
|
||||
# Flaky?
|
||||
ScopedJavaRefTest.RefCounts
|
||||
# Death tests are not supported with apks.
|
||||
*DeathTest*
|
||||
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
# Addtional list of suppressions from emulator
|
||||
#
|
||||
# Automatically generated by run_tests.py
|
||||
PathServiceTest.Get
|
||||
SharedMemoryTest.OpenClose
|
||||
StringPrintfTest.StringAppendfInt
|
||||
StringPrintfTest.StringAppendfString
|
||||
StringPrintfTest.StringPrintfBounds
|
||||
StringPrintfTest.StringPrintfMisc
|
||||
VerifyPathControlledByUserTest.Symlinks
|
||||
@@ -1,21 +0,0 @@
|
||||
# List of suppressions
|
||||
|
||||
AudioRendererHostTest.CreateAndClose
|
||||
AudioRendererHostTest.CreateAndShutdown
|
||||
AudioRendererHostTest.CreatePlayAndClose
|
||||
AudioRendererHostTest.CreatePlayPauseAndClose
|
||||
AudioRendererHostTest.SetVolume
|
||||
AudioRendererHostTest.CreatePlayAndShutdown
|
||||
AudioRendererHostTest.CreatePlayPauseAndShutdown
|
||||
AudioRendererHostTest.SimulateError
|
||||
AudioRendererHostTest.SimulateErrorAndClose
|
||||
# crbug.com/104950
|
||||
DeviceOrientationProviderTest.ObserverNotRemoved
|
||||
DeviceOrientationProviderTest.StartFailing
|
||||
# crbug.com/138930
|
||||
SkCanvasVideoRendererTest.*
|
||||
# crbug.com/139095
|
||||
RenderWidgetTest.OnMsgPaintAtSize
|
||||
# crbug.com/147549
|
||||
GamepadProviderTest.PollingAccess
|
||||
PepperGamepadHostTest.WaitForReply
|
||||
@@ -1,14 +0,0 @@
|
||||
# Times out
|
||||
IPCSyncChannelTest.ChattyServer
|
||||
|
||||
# MultiProcessTest related failures. These tests fail if DCHECK is enabled.
|
||||
IPCChannelPosixTest.AdvancedConnected
|
||||
IPCChannelPosixTest.ResetState
|
||||
IPCChannelPosixTest.MultiConnection
|
||||
IPCFuzzingTest.SanityTest
|
||||
IPCFuzzingTest.MsgBadPayloadArgs
|
||||
IPCChannelTest.DescriptorTest
|
||||
IPCChannelTest.ChannelTest
|
||||
IPCChannelTest.ChannelProxyTest
|
||||
IPCChannelTest.SendMessageInChannelConnected
|
||||
SyncSocketTest.SanityTest
|
||||
@@ -1,11 +0,0 @@
|
||||
# List of suppressions
|
||||
|
||||
# crbug.com/136720
|
||||
CrossProcessNotificationMultiProcessTest.Basic
|
||||
|
||||
# Death tests are not supported on APK
|
||||
# http://crbug.com/138855
|
||||
CompositeFilterDeathTest.*
|
||||
|
||||
# http://crbug.com/138833
|
||||
AesDecryptorTest.*
|
||||
@@ -1,124 +0,0 @@
|
||||
# List of suppressions.
|
||||
# Generated by hand to get net_unittests running initially.
|
||||
# Likely too aggressive disabling.
|
||||
DiskCacheBackendTest.*
|
||||
TransportSecurityStateTest.ParseSidePins*
|
||||
# TODO(jnd): The following tests are disabled because test server spawner is not
|
||||
# enabled on Chromium Android. Once the net upstreaming is done, test server
|
||||
# spawner can be enabled and those tests should pass.
|
||||
# BUG=135165
|
||||
X509CertificateTest.*
|
||||
X509CertificateParseTest.*
|
||||
HttpNetworkTransactionSpdy2Test.SOCKS4_HTTP_GET
|
||||
HttpNetworkTransactionSpdy2Test.SOCKS4_SSL_GET
|
||||
HttpNetworkTransactionSpdy21Test.SOCKS4_HTTP_GET
|
||||
HttpNetworkTransactionSpdy21Test.SOCKS4_SSL_GET
|
||||
HttpNetworkTransactionSpdy3Test.SOCKS4_HTTP_GET
|
||||
HttpNetworkTransactionSpdy3Test.SOCKS4_SSL_GET
|
||||
HttpNetworkTransactionTest.SOCKS4_HTTP_GET
|
||||
HttpNetworkTransactionTest.SOCKS4_SSL_GET
|
||||
HttpNetworkTransactionTest.UploadUnreadableFile
|
||||
HttpNetworkTransactionTest.UnreadableUploadFileAfterAuthRestart
|
||||
ProxyResolverJSBindingsTest.MyIpAddress
|
||||
ProxyScriptFetcherImplTest.*
|
||||
SOCKSClientSocketTest.*
|
||||
SSLClientSocketTest.*
|
||||
PythonUtils.PythonRunTime
|
||||
URLRequestTestHTTP.*
|
||||
URLRequestTestFTP.*
|
||||
HTTPSRequestTest.HTTPSMismatchedTest
|
||||
HTTPSRequestTest.HTTPSExpiredTest
|
||||
HTTPSRequestTest.HTTPSPreloadedHSTSTest
|
||||
HTTPSRequestTest.ClientAuthTest
|
||||
URLRequestTest.DelayedCookieCallback
|
||||
URLRequestTest.DoNotSendCookies
|
||||
URLRequestTest.DoNotSaveCookies
|
||||
URLRequestTest.DoNotSendCookies_ViaPolicy
|
||||
URLRequestTest.DoNotSaveCookies_ViaPolicy
|
||||
URLRequestTest.DoNotSaveEmptyCookies
|
||||
URLRequestTest.DoNotSendCookies_ViaPolicy_Async
|
||||
URLRequestTest.DoNotSaveCookies_ViaPolicy_Async
|
||||
URLRequestTest.DoNotOverrideReferrer
|
||||
WebSocketJobSpdy2Test.ThrottlingWebSocket
|
||||
WebSocketJobSpdy2Test.ThrottlingWebSocketSpdyEnabled
|
||||
WebSocketJobSpdy2Test.ThrottlingSpdy
|
||||
WebSocketJobSpdy2Test.ThrottlingSpdySpdyEnabled
|
||||
WebSocketJobSpdy3Test.ThrottlingWebSocket
|
||||
WebSocketJobSpdy3Test.ThrottlingWebSocketSpdyEnabled
|
||||
WebSocketJobSpdy3Test.ThrottlingSpdy
|
||||
WebSocketJobSpdy3Test.ThrottlingSpdySpdyEnabled
|
||||
WebSocketJobTest.ThrottlingWebSocket
|
||||
WebSocketJobTest.ThrottlingWebSocketSpdyEnabled
|
||||
WebSocketJobTest.ThrottlingSpdy
|
||||
WebSocketJobTest.ThrottlingSpdySpdyEnabled
|
||||
X509CertificateWeakDigestTest.*
|
||||
*/X509CertificateWeakDigestTest.*
|
||||
TransportSecurityStateTest.BogusPinsHeaders
|
||||
TransportSecurityStateTest.ValidPinsHeadersSHA1
|
||||
TransportSecurityStateTest.ValidPinsHeadersSHA256
|
||||
HTTPSRequestTest.ResumeTest
|
||||
HTTPSRequestTest.SSLSessionCacheShardTest
|
||||
HTTPSRequestTest.HTTPSErrorsNoClobberTSSTest
|
||||
HttpNetworkTransactionSpdy3Test.UploadUnreadableFile
|
||||
HttpNetworkTransactionSpdy2Test.UploadUnreadableFile
|
||||
HTTPSRequestTest.SSLv3Fallback
|
||||
HTTPSEVCRLSetTest.FreshCRLSet
|
||||
HTTPSCRLSetTest.ExpiredCRLSet
|
||||
URLFetcherTest.SameThreadsTest
|
||||
URLFetcherTest.DifferentThreadsTest
|
||||
URLFetcherTest.CancelAll
|
||||
URLFetcherPostTest.Basic
|
||||
URLFetcherUploadProgressTest.Basic
|
||||
URLFetcherDownloadProgressTest.Basic
|
||||
URLFetcherDownloadProgressCancelTest.CancelWhileProgressReport
|
||||
URLFetcherHeadersTest.Headers
|
||||
URLFetcherSocketAddressTest.SocketAddress
|
||||
URLFetcherStopOnRedirectTest.StopOnRedirect
|
||||
URLFetcherProtectTest.Overload
|
||||
URLFetcherProtectTest.ServerUnavailable
|
||||
URLFetcherProtectTestPassedThrough.ServerUnavailablePropagateResponse
|
||||
URLFetcherBadHTTPSTest.BadHTTPSTest
|
||||
URLFetcherCancelTest.ReleasesContext
|
||||
URLFetcherCancelTest.CancelWhileDelayedStartTaskPending
|
||||
URLFetcherMultipleAttemptTest.SameData
|
||||
URLFetcherFileTest.SmallGet
|
||||
URLFetcherFileTest.LargeGet
|
||||
URLFetcherFileTest.CantakeOfFile
|
||||
URLFetcherFileTest.OverwriteExistingFile
|
||||
URLFetcherFileTest.TryToOverwriteDirectory
|
||||
URLFetcherFileTest.SmallGetToTempFile
|
||||
URLFetcherFileTest.LargeGetToTempFile
|
||||
URLFetcherFileTest.CantakeOfTempFile
|
||||
URLFetcherEmptyPostTest.Basic
|
||||
# TODO(jrg): Fails on bots. Works locally. Figure out why. 2/6/12
|
||||
HttpCache.TypicalGET_ConditionalRequest
|
||||
HttpCache.RangeGET_OK
|
||||
HttpCache.RangeGET_SyncOK
|
||||
HttpCache.RangeGET_Revalidate2
|
||||
HttpCache.RangeGET_Previous200
|
||||
HttpCache.RangeGET_Cancel2
|
||||
# crbug.com/139144
|
||||
UDPSocketTest.Broadcast
|
||||
|
||||
UDPSocketTest.ConnectRandomBind
|
||||
UDPSocketTest.ClientGetLocalPeerAddresses
|
||||
# Disabled 4/13/12 by jrg. More CertVerifyProcTest.* tests fail on
|
||||
# the bot than locally; disabling them all for now.
|
||||
CertVerifyProcTest.*
|
||||
# Runs fine locally but not on the bot.
|
||||
VerifyRoot/CertVerifyProcWeakDigestTest.*
|
||||
# Relies on TestServer which isn't yet configured upstream.
|
||||
URLRequestContextBuilderTest.*
|
||||
|
||||
# All cert_verify_proc_unittest.cc failing since JNI was enabled.
|
||||
VerifyIntermediate/CertVerifyProcWeakDigestTest.*
|
||||
VerifyEndEntity/CertVerifyProcWeakDigestTest.*
|
||||
VerifyIncompleteIntermediate/CertVerifyProcWeakDigestTest.*
|
||||
VerifyIncompleteEndEntity/CertVerifyProcWeakDigestTest.*
|
||||
VerifyMixed/CertVerifyProcWeakDigestTest.*
|
||||
|
||||
# Death tests are not supported with apks.
|
||||
*DeathTest*
|
||||
# These are death tests and thus also disabled.
|
||||
PrioritizedDispatcherTest.CancelNull
|
||||
PrioritizedDispatcherTest.CancelMissing
|
||||
@@ -1,4 +0,0 @@
|
||||
SyncHttpBridgeTest.*
|
||||
|
||||
# crbug.com/144422
|
||||
OnDiskSyncableDirectory.FailInitialWrite
|
||||
@@ -1,44 +0,0 @@
|
||||
# List of suppressions
|
||||
# This file was automatically generated by build/android/run_tests.py
|
||||
BytesFormattingTest.FormatBytes
|
||||
CanvasTest.StringSizeEmptyString
|
||||
CanvasTest.StringWidth
|
||||
ClipboardTest.RTFTest
|
||||
FontListTest.FontDescString_FromFont
|
||||
FontListTest.FontDescString_FromFontVector
|
||||
FontListTest.FontDescString_FromFontWithNonNormalStyle
|
||||
FontListTest.Fonts_DeriveFontList
|
||||
FontListTest.Fonts_DeriveFontListWithSize
|
||||
FontListTest.Fonts_DescStringWithStyleInFlexibleFormat_RoundTrip
|
||||
FontListTest.Fonts_FontVector_RoundTrip
|
||||
FontListTest.Fonts_FromDescString
|
||||
FontListTest.Fonts_FromDescStringInFlexibleFormat
|
||||
FontListTest.Fonts_FromDescStringWithStyleInFlexibleFormat
|
||||
FontListTest.Fonts_FromFont
|
||||
FontListTest.Fonts_FromFontVector
|
||||
FontListTest.Fonts_FromFontWithNonNormalStyle
|
||||
FontListTest.Fonts_GetStyle
|
||||
FontTest.Ascent
|
||||
FontTest.AvgCharWidth
|
||||
FontTest.AvgWidths
|
||||
FontTest.Height
|
||||
FontTest.LoadArial
|
||||
FontTest.LoadArialBold
|
||||
FontTest.Widths
|
||||
L10nUtilTest.GetDisplayNameForCountry
|
||||
L10nUtilTest.GetDisplayNameForLocale
|
||||
ResourceBundle.DelegateGetFont
|
||||
TextEliderTest.ElideEmail
|
||||
TextEliderTest.ElideEmailMoreSpace
|
||||
TextEliderTest.ElideRectangleText
|
||||
TextEliderTest.ElideRectangleTextLongWords
|
||||
TextEliderTest.ElideRectangleTextPunctuation
|
||||
TextEliderTest.ElideTextLongStrings
|
||||
TextEliderTest.ElideTextSurrogatePairs
|
||||
TextEliderTest.ElideTextTruncate
|
||||
TextEliderTest.TestFileURLEliding
|
||||
TextEliderTest.TestFilenameEliding
|
||||
TextEliderTest.TestGeneralEliding
|
||||
TextEliderTest.TestMoreEliding
|
||||
TextEliderTest.TestTrailingEllipsisSlashEllipsisHack
|
||||
TreeNodeIteratorPruneTest.Test
|
||||
@@ -1,149 +0,0 @@
|
||||
# List of suppressions
|
||||
|
||||
# crbug.com/139429
|
||||
BrowserMainTest.WarmConnectionFieldTrial_Invalid
|
||||
BrowserMainTest.WarmConnectionFieldTrial_Random
|
||||
BrowserMainTest.WarmConnectionFieldTrial_WarmestSocket
|
||||
|
||||
# crbug.com/139431
|
||||
ChromePaths.UserCacheDir
|
||||
|
||||
# The UDP related tests currently do not work on Android because
|
||||
# we lack a UDP forwarder tool.
|
||||
NetworkStatsTestUDP.*
|
||||
|
||||
# Missing test resource of 16MB.
|
||||
HistoryProfileTest.TypicalProfileVersion
|
||||
|
||||
# crbug.com/139408
|
||||
SQLitePersistentCookieStoreTest.TestDontLoadOldSessionCookies
|
||||
SQLitePersistentCookieStoreTest.PersistIsPersistent
|
||||
|
||||
# http://crbug.com/117940
|
||||
TemplateURLTest.*
|
||||
TemplateURLPrepopulateDataTest.*
|
||||
TemplateURLServiceSyncTest.*
|
||||
SearchHostToURLsMapTest.*
|
||||
|
||||
# crbug.com/139427
|
||||
TemplateURLFetcherTest.*
|
||||
|
||||
# crbug.com/139433
|
||||
AutofillTableTest.AutofillProfile*
|
||||
AutofillTableTest.UpdateAutofillProfile
|
||||
|
||||
# crbug.com/139400
|
||||
AutofillProfileTest.*
|
||||
CreditCardTest.SetInfoExpirationMonth
|
||||
|
||||
# crbug.com/139398
|
||||
DownloadItemModelTest.InterruptTooltip
|
||||
|
||||
# Tests crashing in the APK
|
||||
# DEATH test, forking and doing bad stuff, not supported yet.
|
||||
IncognitoModePrefsDeathTest.GetAvailabilityBadValue
|
||||
# l10n_util.cc(655)] Check failed: std::string::npos != pos
|
||||
DownloadItemModelTest.InterruptStatus
|
||||
# l10n_util.cc(655)] Check failed: std::string::npos != pos
|
||||
WebsiteSettingsTest.OnSiteDataAccessed
|
||||
# Tests failing in the APK (mostly failing to create files out of the Application dir).
|
||||
DiagnosticsModelTest.RunAll
|
||||
FirstRunTest.RemoveSentinel
|
||||
GoogleUpdateTest.StatsConsent
|
||||
URLFixerUpperTest.FixupFile
|
||||
URLFixerUpperTest.FixupRelativeFile
|
||||
DownloadPathReservationTrackerTest.CreateDefaultDownloadPath
|
||||
|
||||
# crbug.com/139423
|
||||
ValueStoreFrontendTest.GetExistingData
|
||||
|
||||
# crbug.com/139421
|
||||
ChromeSelectFilePolicyTest.ExpectAsynchronousListenerCall
|
||||
|
||||
# http://crbug.com/139033
|
||||
ChromeDownloadManagerDelegateTest.StartDownload_PromptAlways
|
||||
|
||||
# http://crbug.com/139165
|
||||
KeywordEditorControllerTest.*
|
||||
|
||||
# Extension support is limited on Android.
|
||||
# Some of these can be enabled if we register extension related prefs in
|
||||
# browser_prefs.cc
|
||||
ExtensionTest.*
|
||||
ExtensionAPI.*
|
||||
ExtensionFileUtil.*
|
||||
ExtensionPermissionsTest.*
|
||||
ExtensionUnpackerTest.*
|
||||
ActiveTabTest.*
|
||||
ExtensionAppsPromo.*
|
||||
ComponentLoaderTest.*
|
||||
ExtensionFromUserScript.*
|
||||
ExtensionFromWebApp.*
|
||||
ExtensionIconManagerTest.*
|
||||
ExtensionServiceTest.*
|
||||
ExtensionServiceTestSimple.*
|
||||
ExtensionSourcePriorityTest.*
|
||||
ExtensionSpecialStoragePolicyTest.*
|
||||
ExternalPolicyProviderTest.*
|
||||
MenuManagerTest.*
|
||||
PageActionControllerTest.*
|
||||
PermissionsUpdaterTest.*
|
||||
ImageLoadingTrackerTest.*
|
||||
ScriptBadgeControllerTest.*
|
||||
ExtensionSettingsFrontendTest.*
|
||||
ExtensionSettingsSyncTest.*
|
||||
ExtensionUpdaterTest.*
|
||||
UserScriptListenerTest.*
|
||||
WebApplicationTest.GetShortcutInfoForTab
|
||||
ExtensionActionIconFactoryTest.*
|
||||
|
||||
# crbug.com/139411
|
||||
AutocompleteProviderTest.*
|
||||
HistoryContentsProviderBodyOnlyTest.*
|
||||
HistoryContentsProviderTest.*
|
||||
HQPOrderingTest.*
|
||||
SearchProviderTest.*
|
||||
|
||||
# Test server and forwarder and not ready yet.
|
||||
ProtocolHandlerRegistryTest.TestOSRegistrationFailure
|
||||
ConnectionTesterTest.*
|
||||
HttpPipeliningCompatibilityClientTest.*
|
||||
NetworkStatsTestTCP.*
|
||||
ConnectionTesterTest.RunAllTests
|
||||
|
||||
# crbug.com/139418
|
||||
SQLiteServerBoundCertStoreTest.TestUpgradeV1
|
||||
SQLiteServerBoundCertStoreTest.TestUpgradeV2
|
||||
|
||||
ProfileSyncComponentsFactoryImplTest.*
|
||||
PermissionsTest.GetWarningMessages_Plugins
|
||||
ImageOperations.ResizeShouldAverageColors
|
||||
|
||||
# crbug.com/138275
|
||||
PrerenderTest.*
|
||||
RenderWidgetTest.OnMsgPaintAtSize
|
||||
|
||||
# crbug.com/146857
|
||||
TopSitesTest.Blacklisting
|
||||
|
||||
# crbug.com/139643
|
||||
VariationsUtilTest.DisableAfterInitialization
|
||||
VariationsUtilTest.AssociateGoogleVariationID
|
||||
VariationsUtilTest.NoAssociation
|
||||
|
||||
# crbug.com/141473
|
||||
AutofillManagerTest.UpdatePasswordSyncState
|
||||
AutofillManagerTest.UpdatePasswordGenerationState
|
||||
|
||||
# crbug.com/144227
|
||||
ExtensionIconImageTest.*
|
||||
|
||||
# crbug.com/145843
|
||||
EntropyProviderTest.UseOneTimeRandomizationSHA1
|
||||
EntropyProviderTest.UseOneTimeRandomizationPermuted
|
||||
|
||||
# crbug.com/147500
|
||||
ManifestTest.RestrictedKeys
|
||||
|
||||
# crbug.com/152599
|
||||
SyncSearchEngineDataTypeControllerTest.*
|
||||
@@ -1,253 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
"""Provides a convenient wrapper for spawning a test lighttpd instance.
|
||||
|
||||
Usage:
|
||||
lighttpd_server PATH_TO_DOC_ROOT
|
||||
"""
|
||||
|
||||
import codecs
|
||||
import contextlib
|
||||
import http.client
|
||||
import os
|
||||
import random
|
||||
import shutil
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
from pylib import constants
|
||||
from pylib import pexpect
|
||||
|
||||
class LighttpdServer(object):
|
||||
"""Wraps lighttpd server, providing robust startup.
|
||||
|
||||
Args:
|
||||
document_root: Path to root of this server's hosted files.
|
||||
port: TCP port on the _host_ machine that the server will listen on. If
|
||||
ommitted it will attempt to use 9000, or if unavailable it will find
|
||||
a free port from 8001 - 8999.
|
||||
lighttpd_path, lighttpd_module_path: Optional paths to lighttpd binaries.
|
||||
base_config_path: If supplied this file will replace the built-in default
|
||||
lighttpd config file.
|
||||
extra_config_contents: If specified, this string will be appended to the
|
||||
base config (default built-in, or from base_config_path).
|
||||
config_path, error_log, access_log: Optional paths where the class should
|
||||
place temprary files for this session.
|
||||
"""
|
||||
|
||||
def __init__(self, document_root, port=None,
|
||||
lighttpd_path=None, lighttpd_module_path=None,
|
||||
base_config_path=None, extra_config_contents=None,
|
||||
config_path=None, error_log=None, access_log=None):
|
||||
self.temp_dir = tempfile.mkdtemp(prefix='lighttpd_for_chrome_android')
|
||||
self.document_root = os.path.abspath(document_root)
|
||||
self.fixed_port = port
|
||||
self.port = port or constants.LIGHTTPD_DEFAULT_PORT
|
||||
self.server_tag = 'LightTPD ' + str(random.randint(111111, 999999))
|
||||
self.lighttpd_path = lighttpd_path or '/usr/sbin/lighttpd'
|
||||
self.lighttpd_module_path = lighttpd_module_path or '/usr/lib/lighttpd'
|
||||
self.base_config_path = base_config_path
|
||||
self.extra_config_contents = extra_config_contents
|
||||
self.config_path = config_path or self._Mktmp('config')
|
||||
self.error_log = error_log or self._Mktmp('error_log')
|
||||
self.access_log = access_log or self._Mktmp('access_log')
|
||||
self.pid_file = self._Mktmp('pid_file')
|
||||
self.process = None
|
||||
|
||||
def _Mktmp(self, name):
|
||||
return os.path.join(self.temp_dir, name)
|
||||
|
||||
def _GetRandomPort(self):
|
||||
# The ports of test server is arranged in constants.py.
|
||||
return random.randint(constants.LIGHTTPD_RANDOM_PORT_FIRST,
|
||||
constants.LIGHTTPD_RANDOM_PORT_LAST)
|
||||
|
||||
def StartupHttpServer(self):
|
||||
"""Starts up a http server with specified document root and port."""
|
||||
# If we want a specific port, make sure no one else is listening on it.
|
||||
if self.fixed_port:
|
||||
self._KillProcessListeningOnPort(self.fixed_port)
|
||||
while True:
|
||||
if self.base_config_path:
|
||||
# Read the config
|
||||
with codecs.open(self.base_config_path, 'r', 'utf-8') as f:
|
||||
config_contents = f.read()
|
||||
else:
|
||||
config_contents = self._GetDefaultBaseConfig()
|
||||
if self.extra_config_contents:
|
||||
config_contents += self.extra_config_contents
|
||||
# Write out the config, filling in placeholders from the members of |self|
|
||||
with codecs.open(self.config_path, 'w', 'utf-8') as f:
|
||||
f.write(config_contents % self.__dict__)
|
||||
if (not os.path.exists(self.lighttpd_path) or
|
||||
not os.access(self.lighttpd_path, os.X_OK)):
|
||||
raise EnvironmentError(
|
||||
'Could not find lighttpd at %s.\n'
|
||||
'It may need to be installed (e.g. sudo apt-get install lighttpd)'
|
||||
% self.lighttpd_path)
|
||||
self.process = pexpect.spawn(self.lighttpd_path,
|
||||
['-D', '-f', self.config_path,
|
||||
'-m', self.lighttpd_module_path],
|
||||
cwd=self.temp_dir)
|
||||
client_error, server_error = self._TestServerConnection()
|
||||
if not client_error:
|
||||
assert int(open(self.pid_file, 'r').read()) == self.process.pid
|
||||
break
|
||||
self.process.close()
|
||||
|
||||
if self.fixed_port or not 'in use' in server_error:
|
||||
print('Client error:', client_error)
|
||||
print('Server error:', server_error)
|
||||
return False
|
||||
self.port = self._GetRandomPort()
|
||||
return True
|
||||
|
||||
def ShutdownHttpServer(self):
|
||||
"""Shuts down our lighttpd processes."""
|
||||
if self.process:
|
||||
self.process.terminate()
|
||||
shutil.rmtree(self.temp_dir, ignore_errors=True)
|
||||
|
||||
def _TestServerConnection(self):
|
||||
# Wait for server to start
|
||||
server_msg = ''
|
||||
for timeout in range(1, 5):
|
||||
client_error = None
|
||||
try:
|
||||
with contextlib.closing(http.client.HTTPConnection(
|
||||
'127.0.0.1', self.port, timeout=timeout)) as http:
|
||||
http.set_debuglevel(timeout > 3)
|
||||
http.request('HEAD', '/')
|
||||
r = http.getresponse()
|
||||
r.read()
|
||||
if (r.status == 200 and r.reason == 'OK' and
|
||||
r.getheader('Server') == self.server_tag):
|
||||
return (None, server_msg)
|
||||
client_error = ('Bad response: %s %s version %s\n ' %
|
||||
(r.status, r.reason, r.version) +
|
||||
'\n '.join([': '.join(h) for h in r.getheaders()]))
|
||||
except (http.client.HTTPException, socket.error) as client_error:
|
||||
pass # Probably too quick connecting: try again
|
||||
# Check for server startup error messages
|
||||
ix = self.process.expect([pexpect.TIMEOUT, pexpect.EOF, '.+'],
|
||||
timeout=timeout)
|
||||
if ix == 2: # stdout spew from the server
|
||||
server_msg += self.process.match.group(0)
|
||||
elif ix == 1: # EOF -- server has quit so giveup.
|
||||
client_error = client_error or 'Server exited'
|
||||
break
|
||||
return (client_error or 'Timeout', server_msg)
|
||||
|
||||
def _KillProcessListeningOnPort(self, port):
|
||||
"""Checks if there is a process listening on port number |port| and
|
||||
terminates it if found.
|
||||
|
||||
Args:
|
||||
port: Port number to check.
|
||||
"""
|
||||
if subprocess.call(['fuser', '-kv', '%d/tcp' % port]) == 0:
|
||||
# Give the process some time to terminate and check that it is gone.
|
||||
time.sleep(2)
|
||||
assert subprocess.call(['fuser', '-v', '%d/tcp' % port]) != 0, \
|
||||
'Unable to kill process listening on port %d.' % port
|
||||
|
||||
def _GetDefaultBaseConfig(self):
|
||||
return """server.tag = "%(server_tag)s"
|
||||
server.modules = ( "mod_access",
|
||||
"mod_accesslog",
|
||||
"mod_alias",
|
||||
"mod_cgi",
|
||||
"mod_rewrite" )
|
||||
|
||||
# default document root required
|
||||
#server.document-root = "."
|
||||
|
||||
# files to check for if .../ is requested
|
||||
index-file.names = ( "index.php", "index.pl", "index.cgi",
|
||||
"index.html", "index.htm", "default.htm" )
|
||||
# mimetype mapping
|
||||
mimetype.assign = (
|
||||
".gif" => "image/gif",
|
||||
".jpg" => "image/jpeg",
|
||||
".jpeg" => "image/jpeg",
|
||||
".png" => "image/png",
|
||||
".svg" => "image/svg+xml",
|
||||
".css" => "text/css",
|
||||
".html" => "text/html",
|
||||
".htm" => "text/html",
|
||||
".xhtml" => "application/xhtml+xml",
|
||||
".xhtmlmp" => "application/vnd.wap.xhtml+xml",
|
||||
".js" => "application/x-javascript",
|
||||
".log" => "text/plain",
|
||||
".conf" => "text/plain",
|
||||
".text" => "text/plain",
|
||||
".txt" => "text/plain",
|
||||
".dtd" => "text/xml",
|
||||
".xml" => "text/xml",
|
||||
".manifest" => "text/cache-manifest",
|
||||
)
|
||||
|
||||
# Use the "Content-Type" extended attribute to obtain mime type if possible
|
||||
mimetype.use-xattr = "enable"
|
||||
|
||||
##
|
||||
# which extensions should not be handle via static-file transfer
|
||||
#
|
||||
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
|
||||
static-file.exclude-extensions = ( ".php", ".pl", ".cgi" )
|
||||
|
||||
server.bind = "127.0.0.1"
|
||||
server.port = %(port)s
|
||||
|
||||
## virtual directory listings
|
||||
dir-listing.activate = "enable"
|
||||
#dir-listing.encoding = "iso-8859-2"
|
||||
#dir-listing.external-css = "style/oldstyle.css"
|
||||
|
||||
## enable debugging
|
||||
#debug.log-request-header = "enable"
|
||||
#debug.log-response-header = "enable"
|
||||
#debug.log-request-handling = "enable"
|
||||
#debug.log-file-not-found = "enable"
|
||||
|
||||
#### SSL engine
|
||||
#ssl.engine = "enable"
|
||||
#ssl.pemfile = "server.pem"
|
||||
|
||||
# Autogenerated test-specific config follows.
|
||||
|
||||
cgi.assign = ( ".cgi" => "/usr/bin/env",
|
||||
".pl" => "/usr/bin/env",
|
||||
".asis" => "/bin/cat",
|
||||
".php" => "/usr/bin/php-cgi" )
|
||||
|
||||
server.errorlog = "%(error_log)s"
|
||||
accesslog.filename = "%(access_log)s"
|
||||
server.upload-dirs = ( "/tmp" )
|
||||
server.pid-file = "%(pid_file)s"
|
||||
server.document-root = "%(document_root)s"
|
||||
|
||||
"""
|
||||
|
||||
|
||||
def main(argv):
|
||||
server = LighttpdServer(*argv[1:])
|
||||
try:
|
||||
if server.StartupHttpServer():
|
||||
input('Server running at http://127.0.0.1:%s -'
|
||||
' press Enter to exit it.' % server.port)
|
||||
else:
|
||||
print('Server exit code:', server.process.exitstatus)
|
||||
finally:
|
||||
server.ShutdownHttpServer()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
||||
@@ -1,4 +0,0 @@
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Loaded 100 of 656 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user