зеркало из https://github.com/mozilla/pjs.git
Bug 663259 - Part 2: Restore Synchronous plugin rendering, with preference for async rendering. r=smichaud
This commit is contained in:
Родитель
c7abdf138f
Коммит
8f2aba5bfb
|
@ -567,6 +567,7 @@ pref("plugins.hide_infobar_for_missing_plugin", false);
|
|||
pref("plugins.hide_infobar_for_outdated_plugin", false);
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
pref("plugins.use_layers", false);
|
||||
pref("plugins.hide_infobar_for_carbon_failure_plugin", false);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -252,6 +252,17 @@ PluginPRLibrary::GetImage(NPP instance, ImageContainer* aContainer, Image** aIma
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
nsresult
|
||||
PluginPRLibrary::IsRemoteDrawingCoreAnimation(NPP instance, PRBool *aDrawing)
|
||||
{
|
||||
nsNPAPIPluginInstance* inst = (nsNPAPIPluginInstance*)instance->ndata;
|
||||
NS_ENSURE_TRUE(inst, NS_ERROR_NULL_POINTER);
|
||||
*aDrawing = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
PluginPRLibrary::GetImageSize(NPP instance, nsIntSize* aSize)
|
||||
{
|
||||
|
|
|
@ -143,6 +143,9 @@ public:
|
|||
virtual nsresult GetImage(NPP instance, ImageContainer* aContainer, Image** aImage);
|
||||
virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize);
|
||||
NS_OVERRIDE virtual bool UseAsyncPainting() { return false; }
|
||||
#if defined(XP_MACOSX)
|
||||
virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, PRBool *aDrawing);
|
||||
#endif
|
||||
NS_OVERRIDE
|
||||
virtual nsresult SetBackgroundUnknown(NPP instance);
|
||||
NS_OVERRIDE
|
||||
|
|
|
@ -88,7 +88,7 @@ nsNPAPIPluginInstance::nsNPAPIPluginInstance(nsNPAPIPlugin* plugin)
|
|||
mMIMEType(nsnull),
|
||||
mOwner(nsnull),
|
||||
mCurrentPluginEvent(nsnull),
|
||||
#if defined(MOZ_X11) || defined(XP_WIN) || defined(XP_MACOSX)
|
||||
#if defined(MOZ_X11) || defined(XP_WIN)
|
||||
mUsePluginLayersPref(PR_TRUE)
|
||||
#else
|
||||
mUsePluginLayersPref(PR_FALSE)
|
||||
|
@ -722,6 +722,22 @@ nsresult nsNPAPIPluginInstance::GetDrawingModel(PRInt32* aModel)
|
|||
#endif
|
||||
}
|
||||
|
||||
nsresult nsNPAPIPluginInstance::IsRemoteDrawingCoreAnimation(PRBool* aDrawing)
|
||||
{
|
||||
#ifdef XP_MACOSX
|
||||
if (!mPlugin)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PluginLibrary* library = mPlugin->GetLibrary();
|
||||
if (!library)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return library->IsRemoteDrawingCoreAnimation(&mNPP, aDrawing);
|
||||
#else
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::GetJSObject(JSContext *cx, JSObject** outObject)
|
||||
{
|
||||
|
|
|
@ -259,7 +259,7 @@ nsPluginInstanceOwner::UseAsyncRendering()
|
|||
#endif
|
||||
|
||||
PRBool useAsyncRendering;
|
||||
return (mInstance &&
|
||||
PRBool result = (mInstance &&
|
||||
NS_SUCCEEDED(mInstance->UseAsyncPainting(&useAsyncRendering)) &&
|
||||
useAsyncRendering &&
|
||||
#ifdef XP_MACOSX
|
||||
|
@ -271,6 +271,8 @@ nsPluginInstanceOwner::UseAsyncRendering()
|
|||
mPluginWindow->type == NPWindowTypeDrawable)
|
||||
#endif
|
||||
);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
nsIntSize
|
||||
|
@ -1360,6 +1362,18 @@ NPDrawingModel nsPluginInstanceOwner::GetDrawingModel()
|
|||
return drawingModel;
|
||||
}
|
||||
|
||||
PRBool nsPluginInstanceOwner::IsRemoteDrawingCoreAnimation()
|
||||
{
|
||||
if (!mInstance)
|
||||
return PR_FALSE;
|
||||
|
||||
PRBool coreAnimation;
|
||||
if (!NS_SUCCEEDED(mInstance->IsRemoteDrawingCoreAnimation(&coreAnimation)))
|
||||
return PR_FALSE;
|
||||
|
||||
return coreAnimation;
|
||||
}
|
||||
|
||||
NPEventModel nsPluginInstanceOwner::GetEventModel()
|
||||
{
|
||||
return mEventModel;
|
||||
|
|
|
@ -179,6 +179,7 @@ public:
|
|||
enum { ePluginPaintEnable, ePluginPaintDisable };
|
||||
|
||||
NPDrawingModel GetDrawingModel();
|
||||
PRBool IsRemoteDrawingCoreAnimation();
|
||||
NPEventModel GetEventModel();
|
||||
static void CARefresh(nsITimer *aTimer, void *aClosure);
|
||||
static void AddToCARefreshTimer(nsPluginInstanceOwner *aPluginInstance);
|
||||
|
|
|
@ -616,7 +616,15 @@ nsresult
|
|||
PluginInstanceParent::GetImage(ImageContainer* aContainer, Image** aImage)
|
||||
{
|
||||
#ifdef XP_MACOSX
|
||||
if (!mFrontSurface && !mFrontIOSurface)
|
||||
nsIOSurface* ioSurface = NULL;
|
||||
|
||||
if (mFrontIOSurface) {
|
||||
ioSurface = mFrontIOSurface;
|
||||
} else if (mIOSurface) {
|
||||
ioSurface = mIOSurface;
|
||||
}
|
||||
|
||||
if (!mFrontSurface && !ioSurface)
|
||||
#else
|
||||
if (!mFrontSurface)
|
||||
#endif
|
||||
|
@ -624,7 +632,7 @@ PluginInstanceParent::GetImage(ImageContainer* aContainer, Image** aImage)
|
|||
|
||||
Image::Format format = Image::CAIRO_SURFACE;
|
||||
#ifdef XP_MACOSX
|
||||
if (mFrontIOSurface) {
|
||||
if (ioSurface) {
|
||||
format = Image::MAC_IO_SURFACE;
|
||||
if (!aContainer->Manager()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -639,11 +647,11 @@ PluginInstanceParent::GetImage(ImageContainer* aContainer, Image** aImage)
|
|||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
if (mFrontIOSurface) {
|
||||
if (ioSurface) {
|
||||
NS_ASSERTION(image->GetFormat() == Image::MAC_IO_SURFACE, "Wrong format?");
|
||||
MacIOSurfaceImage* ioImage = static_cast<MacIOSurfaceImage*>(image.get());
|
||||
MacIOSurfaceImage::Data ioData;
|
||||
ioData.mIOSurface = mFrontIOSurface;
|
||||
ioData.mIOSurface = ioSurface;
|
||||
ioImage->SetData(ioData);
|
||||
*aImage = image.forget().get();
|
||||
return NS_OK;
|
||||
|
@ -674,12 +682,25 @@ PluginInstanceParent::GetImageSize(nsIntSize* aSize)
|
|||
if (mFrontIOSurface) {
|
||||
*aSize = nsIntSize(mFrontIOSurface->GetWidth(), mFrontIOSurface->GetHeight());
|
||||
return NS_OK;
|
||||
} else if (mIOSurface) {
|
||||
*aSize = nsIntSize(mIOSurface->GetWidth(), mIOSurface->GetHeight());
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
nsresult
|
||||
PluginInstanceParent::IsRemoteDrawingCoreAnimation(PRBool *aDrawing)
|
||||
{
|
||||
*aDrawing = (NPDrawingModelCoreAnimation == (NPDrawingModel)mDrawingModel ||
|
||||
NPDrawingModelInvalidatingCoreAnimation == (NPDrawingModel)mDrawingModel);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
PluginInstanceParent::SetBackgroundUnknown()
|
||||
{
|
||||
|
|
|
@ -282,6 +282,9 @@ public:
|
|||
nsresult AsyncSetWindow(NPWindow* window);
|
||||
nsresult GetImage(mozilla::layers::ImageContainer* aContainer, mozilla::layers::Image** aImage);
|
||||
nsresult GetImageSize(nsIntSize* aSize);
|
||||
#ifdef XP_MACOSX
|
||||
nsresult IsRemoteDrawingCoreAnimation(PRBool *aDrawing);
|
||||
#endif
|
||||
nsresult SetBackgroundUnknown();
|
||||
nsresult BeginUpdateBackground(const nsIntRect& aRect,
|
||||
gfxContext** aCtx);
|
||||
|
|
|
@ -102,6 +102,10 @@ public:
|
|||
virtual nsresult GetImage(NPP instance, ImageContainer* aContainer, Image** aImage) = 0;
|
||||
virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize) = 0;
|
||||
virtual bool UseAsyncPainting() = 0;
|
||||
#if defined(XP_MACOSX)
|
||||
virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, PRBool *aDrawing) = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The next three methods are the third leg in the trip to
|
||||
* PluginInstanceParent. They approximately follow the ReadbackSink
|
||||
|
|
|
@ -959,6 +959,18 @@ PluginModuleParent::NPP_GetSitesWithData(InfallibleTArray<nsCString>& result)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
nsresult
|
||||
PluginModuleParent::IsRemoteDrawingCoreAnimation(NPP instance, PRBool *aDrawing)
|
||||
{
|
||||
PluginInstanceParent* i = InstCast(instance);
|
||||
if (!i)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return i->IsRemoteDrawingCoreAnimation(aDrawing);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
PluginModuleParent::AnswerNPN_GetValue_WithBoolReturn(const NPNVariable& aVariable,
|
||||
NPError* aError,
|
||||
|
|
|
@ -289,6 +289,10 @@ private:
|
|||
uint64_t maxAge);
|
||||
virtual nsresult NPP_GetSitesWithData(InfallibleTArray<nsCString>& result);
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, PRBool *aDrawing);
|
||||
#endif
|
||||
|
||||
private:
|
||||
void WritePluginExtraDataForMinidump(const nsAString& id);
|
||||
void WriteExtraDataForHang();
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
function paintCountIs(plugin, expected, msg) {
|
||||
var count = plugin.getPaintCount();
|
||||
var realExpected = expected;
|
||||
var isAsync = SimpleTest.testPluginIsOOP();
|
||||
var isAsync = SimpleTest.testPluginIsOOP() &&
|
||||
navigator.platform.indexOf("Mac") < 0;
|
||||
if (isAsync) {
|
||||
++realExpected; // extra paint at startup for all async-rendering plugins
|
||||
} else {
|
||||
|
|
|
@ -1492,7 +1492,7 @@ nsObjectFrame::GetImageContainer(LayerManager* aManager)
|
|||
if (!manager) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
|
||||
nsRefPtr<ImageContainer> container;
|
||||
|
||||
// XXX - in the future image containers will be manager independent and
|
||||
|
@ -1559,14 +1559,18 @@ nsObjectFrame::GetLayerState(nsDisplayListBuilder* aBuilder,
|
|||
return LAYER_NONE;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
if (aManager && aManager->GetBackendType() !=
|
||||
LayerManager::LAYERS_OPENGL) {
|
||||
return LAYER_NONE;
|
||||
if (aManager && aManager->GetBackendType() ==
|
||||
LayerManager::LAYERS_OPENGL &&
|
||||
!mInstanceOwner->UseAsyncRendering() &&
|
||||
mInstanceOwner->IsRemoteDrawingCoreAnimation() &&
|
||||
mInstanceOwner->GetEventModel() == NPEventModelCocoa) {
|
||||
return LAYER_ACTIVE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!mInstanceOwner->UseAsyncRendering())
|
||||
if (!mInstanceOwner->UseAsyncRendering()) {
|
||||
return LAYER_NONE;
|
||||
}
|
||||
|
||||
return LAYER_ACTIVE;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче