This commit is contained in:
Phil Ringnalda 2015-01-18 08:53:33 -08:00
Родитель 7f24f5379b 3e13a1e6c2
Коммит 8f39111a25
11 изменённых файлов: 108 добавлений и 52 удалений

Просмотреть файл

@ -145,13 +145,13 @@
<project name="platform/external/bluetooth/bluedroid" path="external/bluetooth/bluedroid" revision="30b96dfca99cb384bf520a16b81f3aba56f09907"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="5b71e40213f650459e95d35b6f14af7e88d8ab62"/>
<project name="platform_external_libnfc-nci" path="external/libnfc-nci" remote="t2m" revision="4186bdecb4dae911b39a8202252cc2310d91b0be"/>
<project name="platform/frameworks/av" path="frameworks/av" revision="c00de33ebfad57ae79ad5f93c2819ee2c40c8bcd"/>
<project name="platform/frameworks/base" path="frameworks/base" revision="6b58ab45e3e56c1fc20708cc39fa2264c52558df"/>
<project name="platform/frameworks/av" path="frameworks/av" revision="65f5144987afff35a932262c0c5fad6ecce0c04a"/>
<project name="platform/frameworks/base" path="frameworks/base" revision="da8e6bc53c8bc669da0bb627904d08aa293f2497"/>
<project name="platform/frameworks/native" path="frameworks/native" revision="a46a9f1ac0ed5662d614c277cbb14eb3f332f365"/>
<project name="platform/hardware/libhardware" path="hardware/libhardware" revision="7196881a0e9dd7bfbbcf0af64c8064e70f0fa094"/>
<project name="platform/hardware/qcom/audio" path="hardware/qcom/audio" revision="8d7676dfb68ee0cd069affedd5d1e97316a184ba"/>
<project name="platform/hardware/qcom/camera" path="hardware/qcom/camera" revision="2a1ded216a91bf62a72b1640cf01ab4998f37028"/>
<project name="platform/hardware/qcom/display" path="hardware/qcom/display" revision="f8bec8a61dc0f2581fa72a31d4144084b47ef7cf"/>
<project name="platform/hardware/qcom/display" path="hardware/qcom/display" revision="a74adcf8d88320d936daa8d20ce88ca0107fb916"/>
<project name="platform/hardware/qcom/gps" path="hardware/qcom/gps" revision="9883ea57b0668d8f60dba025d4522dfa69a1fbfa"/>
<project name="platform/hardware/qcom/media" path="hardware/qcom/media" revision="a558dc844bf5144fc38603fd8f4df8d9557052a5"/>
<project name="platform/hardware/qcom/wlan" path="hardware/qcom/wlan" revision="57ee1320ed7b4a1a1274d8f3f6c177cd6b9becb2"/>
@ -161,5 +161,5 @@
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="0c557e136bb615923aad0f5c69da4e869523efc5"/>
<project name="platform/system/qcom" path="system/qcom" revision="63e3f6f176caad587d42bba4c16b66d953fb23c2"/>
<project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="d8952a42771045fca73ec600e2b42a4c7129d723"/>
<project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="018b44e52b2bac5d3631d559550e88a4b68c6e67"/>
<project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="4c187c1f3a0dffd8e51a961735474ea703535b99"/>
</manifest>

Просмотреть файл

@ -835,7 +835,7 @@ protected:
float mAudioVolume;
// And these are the references between inner and outer windows.
nsPIDOMWindow *mInnerWindow;
nsPIDOMWindow* MOZ_NON_OWNING_REF mInnerWindow;
nsCOMPtr<nsPIDOMWindow> mOuterWindow;
// the element within the document that is currently focused when this

Просмотреть файл

@ -9,8 +9,8 @@
#include "mozilla/ModuleUtils.h"
#include "nsMimeTypes.h"
#include "DecodePool.h"
#include "ImageFactory.h"
#include "RasterImage.h"
#include "ShutdownTracker.h"
#include "SurfaceCache.h"
@ -92,7 +92,7 @@ mozilla::image::InitModule()
mozilla::image::ShutdownTracker::Initialize();
mozilla::image::ImageFactory::Initialize();
mozilla::image::RasterImage::Initialize();
mozilla::image::DecodePool::Initialize();
mozilla::image::SurfaceCache::Initialize();
imgLoader::GlobalInit();
sInitialized = true;

Просмотреть файл

@ -12,6 +12,7 @@
#include "nsCOMPtr.h"
#include "nsIObserverService.h"
#include "nsIThreadPool.h"
#include "nsThreadUtils.h"
#include "nsXPCOMCIDInternal.h"
#include "prsystem.h"
@ -127,35 +128,36 @@ private:
#ifdef MOZ_NUWA_PROCESS
class RIDThreadPoolListener MOZ_FINAL : public nsIThreadPoolListener
class DecodePoolNuwaListener MOZ_FINAL : public nsIThreadPoolListener
{
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSITHREADPOOLLISTENER
RIDThreadPoolListener() { }
private:
~RIDThreadPoolListener() { }
};
NS_IMPL_ISUPPORTS(RIDThreadPoolListener, nsIThreadPoolListener)
NS_IMETHODIMP
RIDThreadPoolListener::OnThreadCreated()
{
NS_IMETHODIMP OnThreadCreated()
{
if (IsNuwaProcess()) {
NuwaMarkCurrentThread(static_cast<void(*)(void*)>(nullptr), nullptr);
NuwaMarkCurrentThread(static_cast<void(*)(void*)>(nullptr), nullptr);
}
return NS_OK;
}
}
NS_IMETHODIMP
RIDThreadPoolListener::OnThreadShuttingDown()
NS_IMETHODIMP OnThreadShuttingDown() { return NS_OK; }
private:
~DecodePoolNuwaListener() { }
};
NS_IMPL_ISUPPORTS(DecodePoolNuwaListener, nsIThreadPoolListener)
class RegisterDecodeIOThreadWithNuwaRunnable : public nsRunnable
{
public:
NS_IMETHOD Run()
{
NuwaMarkCurrentThread(static_cast<void(*)(void*)>(nullptr), nullptr);
return NS_OK;
}
}
};
#endif // MOZ_NUWA_PROCESS
@ -167,6 +169,13 @@ RIDThreadPoolListener::OnThreadShuttingDown()
NS_IMPL_ISUPPORTS(DecodePool, nsIObserver)
/* static */ void
DecodePool::Initialize()
{
MOZ_ASSERT(NS_IsMainThread());
DecodePool::Singleton();
}
/* static */ DecodePool*
DecodePool::Singleton()
{
@ -180,8 +189,9 @@ DecodePool::Singleton()
}
DecodePool::DecodePool()
: mThreadPoolMutex("Thread Pool")
: mMutex("image::DecodePool")
{
// Initialize the thread pool.
mThreadPool = do_CreateInstance(NS_THREADPOOL_CONTRACTID);
MOZ_RELEASE_ASSERT(mThreadPool,
"Should succeed in creating image decoding thread pool");
@ -200,10 +210,22 @@ DecodePool::DecodePool()
#ifdef MOZ_NUWA_PROCESS
if (IsNuwaProcess()) {
mThreadPool->SetListener(new RIDThreadPoolListener());
mThreadPool->SetListener(new DecodePoolNuwaListener());
}
#endif
// Initialize the I/O thread.
nsresult rv = NS_NewNamedThread("ImageIO", getter_AddRefs(mIOThread));
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv) && mIOThread,
"Should successfully create image I/O thread");
#ifdef MOZ_NUWA_PROCESS
nsCOMPtr<nsIRunnable> worker = new RegisterDecodeIOThreadWithNuwaRunnable();
rv = mIOThread->Dispatch(worker, NS_DISPATCH_NORMAL);
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv),
"Should register decode IO thread with Nuwa process");
#endif
nsCOMPtr<nsIObserverService> obsSvc = services::GetObserverService();
if (obsSvc) {
obsSvc->AddObserver(this, "xpcom-shutdown-threads", false);
@ -221,17 +243,22 @@ DecodePool::Observe(nsISupports*, const char* aTopic, const char16_t*)
MOZ_ASSERT(strcmp(aTopic, "xpcom-shutdown-threads") == 0, "Unexpected topic");
nsCOMPtr<nsIThreadPool> threadPool;
nsCOMPtr<nsIThread> ioThread;
{
MutexAutoLock threadPoolLock(mThreadPoolMutex);
threadPool = mThreadPool;
mThreadPool = nullptr;
MutexAutoLock lock(mMutex);
threadPool.swap(mThreadPool);
ioThread.swap(mIOThread);
}
if (threadPool) {
threadPool->Shutdown();
}
if (ioThread) {
ioThread->Shutdown();
}
return NS_OK;
}
@ -244,7 +271,7 @@ DecodePool::AsyncDecode(Decoder* aDecoder)
// Dispatch to the thread pool if it exists. If it doesn't, we're currently
// shutting down, so it's OK to just drop the job on the floor.
MutexAutoLock threadPoolLock(mThreadPoolMutex);
MutexAutoLock threadPoolLock(mMutex);
if (mThreadPool) {
mThreadPool->Dispatch(worker, nsIEventTarget::DISPATCH_NORMAL);
}
@ -274,11 +301,19 @@ DecodePool::SyncDecodeIfPossible(Decoder* aDecoder)
already_AddRefed<nsIEventTarget>
DecodePool::GetEventTarget()
{
MutexAutoLock threadPoolLock(mThreadPoolMutex);
MutexAutoLock threadPoolLock(mMutex);
nsCOMPtr<nsIEventTarget> target = do_QueryInterface(mThreadPool);
return target.forget();
}
already_AddRefed<nsIEventTarget>
DecodePool::GetIOEventTarget()
{
MutexAutoLock threadPoolLock(mMutex);
nsCOMPtr<nsIEventTarget> target = do_QueryInterface(mIOThread);
return target.forget();
}
already_AddRefed<nsIRunnable>
DecodePool::CreateDecodeWorker(Decoder* aDecoder)
{

Просмотреть файл

@ -17,6 +17,7 @@
#include "nsIEventTarget.h"
#include "nsIObserver.h"
class nsIThread;
class nsIThreadPool;
namespace mozilla {
@ -41,6 +42,10 @@ public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIOBSERVER
/// Initializes the singleton instance. Should be called from the main thread.
static void Initialize();
/// Returns the singleton instance.
static DecodePool* Singleton();
/// Ask the DecodePool to run @aDecoder asynchronously and return immediately.
@ -69,6 +74,15 @@ public:
*/
already_AddRefed<nsIEventTarget> GetEventTarget();
/**
* Returns an event target interface to the DecodePool's I/O thread. Callers
* who want to deliver data to workers on the DecodePool can use this event
* target.
*
* @return An nsIEventTarget interface to the thread pool's I/O thread.
*/
already_AddRefed<nsIEventTarget> GetIOEventTarget();
/**
* Creates a worker which can be used to attempt further decoding using the
* provided decoder.
@ -91,11 +105,10 @@ private:
static StaticRefPtr<DecodePool> sSingleton;
// mThreadPoolMutex protects mThreadPool. For all RasterImages R,
// R::mDecodingMonitor must be acquired before mThreadPoolMutex
// if both are acquired; the other order may cause deadlock.
Mutex mThreadPoolMutex;
// mMutex protects mThreadPool and mIOThread.
Mutex mMutex;
nsCOMPtr<nsIThreadPool> mThreadPool;
nsCOMPtr<nsIThread> mIOThread;
};
} // namespace image

Просмотреть файл

@ -297,14 +297,6 @@ RasterImage::~RasterImage()
SurfaceCache::RemoveImage(ImageKey(this));
}
/* static */ void
RasterImage::Initialize()
{
// Create our singletons now, so we don't have to worry about what thread
// they're created on.
DecodePool::Singleton();
}
nsresult
RasterImage::Init(const char* aMimeType,
uint32_t aFlags)

Просмотреть файл

@ -280,8 +280,6 @@ public:
return spec;
}
static void Initialize();
private:
void DrawWithPreDownscaleIfNeeded(DrawableFrameRef&& aFrameRef,
gfxContext* aContext,

Просмотреть файл

@ -699,10 +699,9 @@ NS_IMETHODIMP imgRequest::OnStartRequest(nsIRequest *aRequest, nsISupports *ctxt
nsAutoCString mimeType;
nsresult rv = httpChannel->GetContentType(mimeType);
if (NS_SUCCEEDED(rv) && !mimeType.EqualsLiteral(IMAGE_SVG_XML)) {
// Image object not created until OnDataAvailable, so forward to static
// DecodePool directly.
// Retarget OnDataAvailable to the DecodePool's IO thread.
nsCOMPtr<nsIEventTarget> target =
DecodePool::Singleton()->GetEventTarget();
DecodePool::Singleton()->GetIOEventTarget();
rv = retargetable->RetargetDeliveryTo(target);
}
PR_LOG(GetImgLog(), PR_LOG_WARNING,

Просмотреть файл

@ -1677,8 +1677,10 @@ js_fun_bind(JSContext *cx, HandleObject target, HandleValue thisArg,
/* Step 4-6, 10-11. */
RootedAtom name(cx, target->is<JSFunction>() ? target->as<JSFunction>().atom() : nullptr);
JSFunction::Flags flags = target->isConstructor() ? JSFunction::NATIVE_CTOR
: JSFunction::NATIVE_FUN;
RootedObject funobj(cx, NewFunction(cx, js::NullPtr(), CallOrConstructBoundFunction, length,
JSFunction::NATIVE_CTOR, target, name));
flags, target, name));
if (!funobj)
return nullptr;

Просмотреть файл

@ -0,0 +1,17 @@
var objects = [
Math.sin.bind(null),
new Proxy(Math.sin.bind(null), {}),
Function.prototype.bind.call(new Proxy(Math.sin, {}))
]
for (var obj of objects) {
// Target is not constructable, so a new array should be created internally.
assertDeepEq(Array.from.call(obj, [1, 2, 3]), [1, 2, 3]);
assertDeepEq(Array.of.call(obj, 1, 2, 3), [1, 2, 3]);
// Make sure they are callable, but not constructable.
obj();
assertThrowsInstanceOf(() => new obj, TypeError);
}
reportCompare(0, 0, 'ok');

Просмотреть файл

@ -3792,7 +3792,7 @@ pref("image.mem.decode_bytes_at_a_time", 16384);
// Minimum timeout for expiring unused images from the surface cache, in
// milliseconds. This controls how long we store cached temporary surfaces.
pref("image.mem.surfacecache.min_expiration_ms", 60000); // 60ms
pref("image.mem.surfacecache.min_expiration_ms", 60000); // 60s
// Maximum size for the surface cache, in kilobytes.
pref("image.mem.surfacecache.max_size_kb", 1048576); // 1GB