mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Merge last green PGO from inbound to central
This commit is contained in:
commit
9d8f91ffd1
@ -64,17 +64,20 @@ nsresult
|
||||
PluginPRLibrary::NP_Initialize(NPNetscapeFuncs* bFuncs,
|
||||
NPPluginFuncs* pFuncs, NPError* error)
|
||||
{
|
||||
JNIEnv* env = GetJNIForThread();
|
||||
if (!env)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (mNP_Initialize) {
|
||||
*error = mNP_Initialize(bFuncs, pFuncs, GetJNIForThread());
|
||||
*error = mNP_Initialize(bFuncs, pFuncs, env);
|
||||
} else {
|
||||
NP_InitializeFunc pfNP_Initialize = (NP_InitializeFunc)
|
||||
PR_FindFunctionSymbol(mLibrary, "NP_Initialize");
|
||||
if (!pfNP_Initialize)
|
||||
return NS_ERROR_FAILURE;
|
||||
*error = pfNP_Initialize(bFuncs, pFuncs, GetJNIForThread());
|
||||
*error = pfNP_Initialize(bFuncs, pFuncs, env);
|
||||
}
|
||||
|
||||
|
||||
// Save pointers to functions that get called through PluginLibrary itself.
|
||||
mNPP_New = pFuncs->newp;
|
||||
mNPP_GetValue = pFuncs->getvalue;
|
||||
|
@ -140,6 +140,8 @@ NS_IMETHODIMP
|
||||
AudioRunnable::Run()
|
||||
{
|
||||
JNIEnv* jenv = GetJNIForThread();
|
||||
if (!jenv)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (jenv->PushLocalFrame(128)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -309,6 +311,9 @@ anp_audio_start(ANPAudioTrack* s)
|
||||
}
|
||||
|
||||
JNIEnv *jenv = GetJNIForThread();
|
||||
if (!jenv)
|
||||
return;
|
||||
|
||||
jenv->CallVoidMethod(s->output_unit, at.play);
|
||||
|
||||
s->isStopped = false;
|
||||
@ -329,6 +334,8 @@ anp_audio_pause(ANPAudioTrack* s)
|
||||
}
|
||||
|
||||
JNIEnv *jenv = GetJNIForThread();
|
||||
if (!jenv)
|
||||
return;
|
||||
jenv->CallVoidMethod(s->output_unit, at.pause);
|
||||
}
|
||||
|
||||
@ -341,6 +348,8 @@ anp_audio_stop(ANPAudioTrack* s)
|
||||
|
||||
s->isStopped = true;
|
||||
JNIEnv *jenv = GetJNIForThread();
|
||||
if (!jenv)
|
||||
return;
|
||||
jenv->CallVoidMethod(s->output_unit, at.stop);
|
||||
}
|
||||
|
||||
|
@ -66,14 +66,21 @@ void
|
||||
anp_event_postEvent(NPP inst, const ANPEvent* event)
|
||||
{
|
||||
LOG("%s", __PRETTY_FUNCTION__);
|
||||
|
||||
JNIEnv* env = GetJNIForThread();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
if (!mozilla::AndroidBridge::Bridge()) {
|
||||
LOG("no bridge in %s!!!!", __PRETTY_FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(inst->ndata);
|
||||
NPPluginFuncs* pluginFunctions = pinst->GetPlugin()->PluginFuncs();
|
||||
mozilla::AndroidBridge::Bridge()->PostToJavaThread(
|
||||
new PluginEventRunnable(inst, const_cast<ANPEvent*>(event), pluginFunctions), true);
|
||||
mozilla::AndroidBridge::Bridge()->PostToJavaThread(env,
|
||||
new PluginEventRunnable(inst, const_cast<ANPEvent*>(event), pluginFunctions),
|
||||
true);
|
||||
LOG("returning from %s", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,9 @@ jclass anp_system_loadJavaClass(NPP instance, const char* className)
|
||||
LOG("%s", __PRETTY_FUNCTION__);
|
||||
|
||||
JNIEnv* env = GetJNIForThread();
|
||||
if (!env)
|
||||
return nsnull;
|
||||
|
||||
jclass cls = env->FindClass("org/mozilla/gecko/GeckoAppShell");
|
||||
jmethodID method = env->GetStaticMethodID(cls,
|
||||
"loadPluginClass",
|
||||
|
@ -2383,7 +2383,10 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
|
||||
case kJavaContext_ANPGetValue: {
|
||||
LOG("get context");
|
||||
JNIEnv* env = GetJNIForThread();
|
||||
JNIEnv* env = GetJNIForThread();
|
||||
if (!env)
|
||||
return NPERR_GENERIC_ERROR;
|
||||
|
||||
jclass cls = env->FindClass("org/mozilla/gecko/GeckoApp");
|
||||
jfieldID field = env->GetStaticFieldID(cls, "mAppContext",
|
||||
"Lorg/mozilla/gecko/GeckoApp;");
|
||||
|
@ -750,7 +750,15 @@ public:
|
||||
return NS_OK;
|
||||
}
|
||||
void RequestSurface() {
|
||||
mozilla::AndroidBridge::Bridge()->PostToJavaThread(this);
|
||||
JNIEnv* env = GetJNIForThread();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
if (!mozilla::AndroidBridge::Bridge()) {
|
||||
PLUGIN_LOG(PLUGIN_LOG_BASIC, ("nsNPAPIPluginInstance null AndroidBridge"));
|
||||
return;
|
||||
}
|
||||
mozilla::AndroidBridge::Bridge()->PostToJavaThread(env, this);
|
||||
}
|
||||
private:
|
||||
nsNPAPIPluginInstance* mInstance;
|
||||
|
@ -1736,33 +1736,32 @@ bool nsPluginInstanceOwner::AddPluginView(const gfxRect& aRect)
|
||||
|
||||
void nsPluginInstanceOwner::RemovePluginView()
|
||||
{
|
||||
if (mInstance && mObjectFrame && mPluginViewAdded) {
|
||||
mPluginViewAdded = false;
|
||||
if (!mInstance || !mObjectFrame | !mPluginViewAdded)
|
||||
return;
|
||||
|
||||
void* surface = mInstance->GetJavaSurface();
|
||||
if (!surface)
|
||||
return;
|
||||
mPluginViewAdded = false;
|
||||
|
||||
JNIEnv* env = GetJNIForThread();
|
||||
if (!env)
|
||||
return;
|
||||
void* surface = mInstance->GetJavaSurface();
|
||||
if (!surface)
|
||||
return;
|
||||
|
||||
AndroidBridge::AutoLocalJNIFrame frame(env, 1);
|
||||
JNIEnv* env = GetJNIForThread();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
jclass cls = env->FindClass("org/mozilla/gecko/GeckoAppShell");
|
||||
jmethodID method = env->GetStaticMethodID(cls,
|
||||
"removePluginView",
|
||||
"(Landroid/view/View;)V");
|
||||
env->CallStaticVoidMethod(cls, method, surface);
|
||||
AndroidBridge::AutoLocalJNIFrame frame(env, 1);
|
||||
|
||||
{
|
||||
ANPEvent event;
|
||||
event.inSize = sizeof(ANPEvent);
|
||||
event.eventType = kLifecycle_ANPEventType;
|
||||
event.data.lifecycle.action = kOffScreen_ANPLifecycleAction;
|
||||
mInstance->HandleEvent(&event, nsnull);
|
||||
}
|
||||
}
|
||||
jclass cls = env->FindClass("org/mozilla/gecko/GeckoAppShell");
|
||||
jmethodID method = env->GetStaticMethodID(cls,
|
||||
"removePluginView",
|
||||
"(Landroid/view/View;)V");
|
||||
env->CallStaticVoidMethod(cls, method, surface);
|
||||
|
||||
ANPEvent event;
|
||||
event.inSize = sizeof(ANPEvent);
|
||||
event.eventType = kLifecycle_ANPEventType;
|
||||
event.data.lifecycle.action = kOffScreen_ANPLifecycleAction;
|
||||
mInstance->HandleEvent(&event, nsnull);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -68,6 +68,7 @@ enum SurfaceFormat
|
||||
|
||||
enum BackendType
|
||||
{
|
||||
BACKEND_NONE,
|
||||
BACKEND_DIRECT2D,
|
||||
BACKEND_COREGRAPHICS,
|
||||
BACKEND_CAIRO,
|
||||
|
380
gfx/skia/fix-comma-end-enum-list.patch
Normal file
380
gfx/skia/fix-comma-end-enum-list.patch
Normal file
@ -0,0 +1,380 @@
|
||||
diff --git a/gfx/skia/include/core/SkAdvancedTypefaceMetrics.h b/gfx/skia/include/core/SkAdvancedTypefaceMetrics.h
|
||||
--- a/gfx/skia/include/core/SkAdvancedTypefaceMetrics.h
|
||||
+++ b/gfx/skia/include/core/SkAdvancedTypefaceMetrics.h
|
||||
@@ -29,17 +29,17 @@ public:
|
||||
SkString fFontName;
|
||||
|
||||
enum FontType {
|
||||
kType1_Font,
|
||||
kType1CID_Font,
|
||||
kCFF_Font,
|
||||
kTrueType_Font,
|
||||
kOther_Font,
|
||||
- kNotEmbeddable_Font,
|
||||
+ kNotEmbeddable_Font
|
||||
};
|
||||
// The type of the underlying font program. This field determines which
|
||||
// of the following fields are valid. If it is kOther_Font or
|
||||
// kNotEmbeddable_Font, the per glyph information will never be populated.
|
||||
FontType fType;
|
||||
|
||||
// fMultiMaster may be true for Type1_Font or CFF_Font.
|
||||
bool fMultiMaster;
|
||||
@@ -51,17 +51,17 @@ public:
|
||||
kFixedPitch_Style = 0x00001,
|
||||
kSerif_Style = 0x00002,
|
||||
kSymbolic_Style = 0x00004,
|
||||
kScript_Style = 0x00008,
|
||||
kNonsymbolic_Style = 0x00020,
|
||||
kItalic_Style = 0x00040,
|
||||
kAllCaps_Style = 0x10000,
|
||||
kSmallCaps_Style = 0x20000,
|
||||
- kForceBold_Style = 0x40000,
|
||||
+ kForceBold_Style = 0x40000
|
||||
};
|
||||
uint16_t fStyle; // Font style characteristics.
|
||||
int16_t fItalicAngle; // Counterclockwise degrees from vertical of the
|
||||
// dominant vertical stroke for an Italic face.
|
||||
// The following fields are all in font units.
|
||||
int16_t fAscent; // Max height above baseline, not including accents.
|
||||
int16_t fDescent; // Max depth below baseline (negative).
|
||||
int16_t fStemV; // Thickness of dominant vertical stem.
|
||||
@@ -70,26 +70,26 @@ public:
|
||||
SkIRect fBBox; // The bounding box of all glyphs (in font units).
|
||||
|
||||
// The type of advance data wanted.
|
||||
enum PerGlyphInfo {
|
||||
kNo_PerGlyphInfo = 0x0, // Don't populate any per glyph info.
|
||||
kHAdvance_PerGlyphInfo = 0x1, // Populate horizontal advance data.
|
||||
kVAdvance_PerGlyphInfo = 0x2, // Populate vertical advance data.
|
||||
kGlyphNames_PerGlyphInfo = 0x4, // Populate glyph names (Type 1 only).
|
||||
- kToUnicode_PerGlyphInfo = 0x8, // Populate ToUnicode table, ignored
|
||||
+ kToUnicode_PerGlyphInfo = 0x8 // Populate ToUnicode table, ignored
|
||||
// for Type 1 fonts
|
||||
};
|
||||
|
||||
template <typename Data>
|
||||
struct AdvanceMetric {
|
||||
enum MetricType {
|
||||
kDefault, // Default advance: fAdvance.count = 1
|
||||
kRange, // Advances for a range: fAdvance.count = fEndID-fStartID
|
||||
- kRun, // fStartID-fEndID have same advance: fAdvance.count = 1
|
||||
+ kRun // fStartID-fEndID have same advance: fAdvance.count = 1
|
||||
};
|
||||
MetricType fType;
|
||||
uint16_t fStartId;
|
||||
uint16_t fEndId;
|
||||
SkTDArray<Data> fAdvance;
|
||||
SkTScopedPtr<AdvanceMetric<Data> > fNext;
|
||||
};
|
||||
|
||||
diff --git a/gfx/skia/include/core/SkBlitRow.h b/gfx/skia/include/core/SkBlitRow.h
|
||||
--- a/gfx/skia/include/core/SkBlitRow.h
|
||||
+++ b/gfx/skia/include/core/SkBlitRow.h
|
||||
@@ -44,17 +44,17 @@ public:
|
||||
|
||||
//! Public entry-point to return a blit function ptr
|
||||
static Proc Factory(unsigned flags, SkBitmap::Config);
|
||||
|
||||
///////////// D32 version
|
||||
|
||||
enum Flags32 {
|
||||
kGlobalAlpha_Flag32 = 1 << 0,
|
||||
- kSrcPixelAlpha_Flag32 = 1 << 1,
|
||||
+ kSrcPixelAlpha_Flag32 = 1 << 1
|
||||
};
|
||||
|
||||
/** Function pointer that blends 32bit colors onto a 32bit destination.
|
||||
@param dst array of dst 32bit colors
|
||||
@param src array of src 32bit colors (w/ or w/o alpha)
|
||||
@param count number of colors to blend
|
||||
@param alpha global alpha to be applied to all src colors
|
||||
*/
|
||||
diff --git a/gfx/skia/include/core/SkCanvas.h b/gfx/skia/include/core/SkCanvas.h
|
||||
--- a/gfx/skia/include/core/SkCanvas.h
|
||||
+++ b/gfx/skia/include/core/SkCanvas.h
|
||||
@@ -132,17 +132,17 @@ public:
|
||||
* low byte to high byte: B, G, R, A.
|
||||
*/
|
||||
kBGRA_Premul_Config8888,
|
||||
kBGRA_Unpremul_Config8888,
|
||||
/**
|
||||
* low byte to high byte: R, G, B, A.
|
||||
*/
|
||||
kRGBA_Premul_Config8888,
|
||||
- kRGBA_Unpremul_Config8888,
|
||||
+ kRGBA_Unpremul_Config8888
|
||||
};
|
||||
|
||||
/**
|
||||
* On success (returns true), copy the canvas pixels into the bitmap.
|
||||
* On failure, the bitmap parameter is left unchanged and false is
|
||||
* returned.
|
||||
*
|
||||
* The canvas' pixels are converted to the bitmap's config. The only
|
||||
diff --git a/gfx/skia/include/core/SkDevice.h b/gfx/skia/include/core/SkDevice.h
|
||||
--- a/gfx/skia/include/core/SkDevice.h
|
||||
+++ b/gfx/skia/include/core/SkDevice.h
|
||||
@@ -134,17 +134,17 @@ public:
|
||||
* Return the device's origin: its offset in device coordinates from
|
||||
* the default origin in its canvas' matrix/clip
|
||||
*/
|
||||
const SkIPoint& getOrigin() const { return fOrigin; }
|
||||
|
||||
protected:
|
||||
enum Usage {
|
||||
kGeneral_Usage,
|
||||
- kSaveLayer_Usage, // <! internal use only
|
||||
+ kSaveLayer_Usage // <! internal use only
|
||||
};
|
||||
|
||||
struct TextFlags {
|
||||
uint32_t fFlags; // SkPaint::getFlags()
|
||||
SkPaint::Hinting fHinting;
|
||||
};
|
||||
|
||||
/**
|
||||
diff --git a/gfx/skia/include/core/SkFlattenable.h b/gfx/skia/include/core/SkFlattenable.h
|
||||
--- a/gfx/skia/include/core/SkFlattenable.h
|
||||
+++ b/gfx/skia/include/core/SkFlattenable.h
|
||||
@@ -216,17 +216,17 @@ public:
|
||||
SkFactorySet* setFactoryRecorder(SkFactorySet*);
|
||||
|
||||
enum Flags {
|
||||
kCrossProcess_Flag = 0x01,
|
||||
/**
|
||||
* Instructs the writer to inline Factory names as there are seen the
|
||||
* first time (after that we store an index). The pipe code uses this.
|
||||
*/
|
||||
- kInlineFactoryNames_Flag = 0x02,
|
||||
+ kInlineFactoryNames_Flag = 0x02
|
||||
};
|
||||
Flags getFlags() const { return (Flags)fFlags; }
|
||||
void setFlags(Flags flags) { fFlags = flags; }
|
||||
|
||||
bool isCrossProcess() const {
|
||||
return SkToBool(fFlags & kCrossProcess_Flag);
|
||||
}
|
||||
bool inlineFactoryNames() const {
|
||||
diff --git a/gfx/skia/include/core/SkFontHost.h b/gfx/skia/include/core/SkFontHost.h
|
||||
--- a/gfx/skia/include/core/SkFontHost.h
|
||||
+++ b/gfx/skia/include/core/SkFontHost.h
|
||||
@@ -245,17 +245,17 @@ public:
|
||||
vertically. When rendering subpixel glyphs we need to know which way
|
||||
round they are.
|
||||
|
||||
Note, if you change this after startup, you'll need to flush the glyph
|
||||
cache because it'll have the wrong type of masks cached.
|
||||
*/
|
||||
enum LCDOrientation {
|
||||
kHorizontal_LCDOrientation = 0, //!< this is the default
|
||||
- kVertical_LCDOrientation = 1,
|
||||
+ kVertical_LCDOrientation = 1
|
||||
};
|
||||
|
||||
static void SetSubpixelOrientation(LCDOrientation orientation);
|
||||
static LCDOrientation GetSubpixelOrientation();
|
||||
|
||||
/** LCD color elements can vary in order. For subpixel text we need to know
|
||||
the order which the LCDs uses so that the color fringes are in the
|
||||
correct place.
|
||||
@@ -264,17 +264,17 @@ public:
|
||||
cache because it'll have the wrong type of masks cached.
|
||||
|
||||
kNONE_LCDOrder means that the subpixel elements are not spatially
|
||||
separated in any usable fashion.
|
||||
*/
|
||||
enum LCDOrder {
|
||||
kRGB_LCDOrder = 0, //!< this is the default
|
||||
kBGR_LCDOrder = 1,
|
||||
- kNONE_LCDOrder = 2,
|
||||
+ kNONE_LCDOrder = 2
|
||||
};
|
||||
|
||||
static void SetSubpixelOrder(LCDOrder order);
|
||||
static LCDOrder GetSubpixelOrder();
|
||||
|
||||
#ifdef SK_BUILD_FOR_ANDROID
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
diff --git a/gfx/skia/include/core/SkMaskFilter.h b/gfx/skia/include/core/SkMaskFilter.h
|
||||
--- a/gfx/skia/include/core/SkMaskFilter.h
|
||||
+++ b/gfx/skia/include/core/SkMaskFilter.h
|
||||
@@ -57,17 +57,17 @@ public:
|
||||
|
||||
virtual void flatten(SkFlattenableWriteBuffer& ) {}
|
||||
|
||||
enum BlurType {
|
||||
kNone_BlurType, //!< this maskfilter is not a blur
|
||||
kNormal_BlurType, //!< fuzzy inside and outside
|
||||
kSolid_BlurType, //!< solid inside, fuzzy outside
|
||||
kOuter_BlurType, //!< nothing inside, fuzzy outside
|
||||
- kInner_BlurType, //!< fuzzy inside, nothing outside
|
||||
+ kInner_BlurType //!< fuzzy inside, nothing outside
|
||||
};
|
||||
|
||||
struct BlurInfo {
|
||||
SkScalar fRadius;
|
||||
bool fIgnoreTransform;
|
||||
bool fHighQuality;
|
||||
};
|
||||
|
||||
diff --git a/gfx/skia/include/core/SkPaint.h b/gfx/skia/include/core/SkPaint.h
|
||||
--- a/gfx/skia/include/core/SkPaint.h
|
||||
+++ b/gfx/skia/include/core/SkPaint.h
|
||||
@@ -70,17 +70,17 @@ public:
|
||||
kFull_Hinting -> <same as kNormalHinting, unless we are rendering
|
||||
subpixel glyphs, in which case TARGET_LCD or
|
||||
TARGET_LCD_V is used>
|
||||
*/
|
||||
enum Hinting {
|
||||
kNo_Hinting = 0,
|
||||
kSlight_Hinting = 1,
|
||||
kNormal_Hinting = 2, //!< this is the default
|
||||
- kFull_Hinting = 3,
|
||||
+ kFull_Hinting = 3
|
||||
};
|
||||
|
||||
Hinting getHinting() const {
|
||||
return static_cast<Hinting>(fHinting);
|
||||
}
|
||||
|
||||
void setHinting(Hinting hintingLevel);
|
||||
|
||||
@@ -282,17 +282,17 @@ public:
|
||||
results may not appear the same as if it was drawn twice, filled and
|
||||
then stroked.
|
||||
*/
|
||||
enum Style {
|
||||
kFill_Style, //!< fill the geometry
|
||||
kStroke_Style, //!< stroke the geometry
|
||||
kStrokeAndFill_Style, //!< fill and stroke the geometry
|
||||
|
||||
- kStyleCount,
|
||||
+ kStyleCount
|
||||
};
|
||||
|
||||
/** Return the paint's style, used for controlling how primitives'
|
||||
geometries are interpreted (except for drawBitmap, which always assumes
|
||||
kFill_Style).
|
||||
@return the paint's Style
|
||||
*/
|
||||
Style getStyle() const { return (Style)fStyle; }
|
||||
diff --git a/gfx/skia/include/core/SkScalerContext.h b/gfx/skia/include/core/SkScalerContext.h
|
||||
--- a/gfx/skia/include/core/SkScalerContext.h
|
||||
+++ b/gfx/skia/include/core/SkScalerContext.h
|
||||
@@ -172,24 +172,24 @@ public:
|
||||
kHintingBit2_Flag = 0x0100,
|
||||
|
||||
// these should only ever be set if fMaskFormat is LCD16 or LCD32
|
||||
kLCD_Vertical_Flag = 0x0200, // else Horizontal
|
||||
kLCD_BGROrder_Flag = 0x0400, // else RGB order
|
||||
|
||||
// luminance : 0 for black text, kLuminance_Max for white text
|
||||
kLuminance_Shift = 11, // to shift into the other flags above
|
||||
- kLuminance_Bits = 3, // ensure Flags doesn't exceed 16bits
|
||||
+ kLuminance_Bits = 3 // ensure Flags doesn't exceed 16bits
|
||||
};
|
||||
|
||||
// computed values
|
||||
enum {
|
||||
kHinting_Mask = kHintingBit1_Flag | kHintingBit2_Flag,
|
||||
kLuminance_Max = (1 << kLuminance_Bits) - 1,
|
||||
- kLuminance_Mask = kLuminance_Max << kLuminance_Shift,
|
||||
+ kLuminance_Mask = kLuminance_Max << kLuminance_Shift
|
||||
};
|
||||
|
||||
struct Rec {
|
||||
uint32_t fOrigFontID;
|
||||
uint32_t fFontID;
|
||||
SkScalar fTextSize, fPreScaleX, fPreSkewX;
|
||||
SkScalar fPost2x2[2][2];
|
||||
SkScalar fFrameWidth, fMiterLimit;
|
||||
diff --git a/gfx/skia/include/core/SkTypes.h b/gfx/skia/include/core/SkTypes.h
|
||||
--- a/gfx/skia/include/core/SkTypes.h
|
||||
+++ b/gfx/skia/include/core/SkTypes.h
|
||||
@@ -433,17 +433,17 @@ public:
|
||||
*/
|
||||
kAlloc_OnShrink,
|
||||
|
||||
/**
|
||||
* If the requested size is smaller than the current size, and the
|
||||
* current block is dynamically allocated, just return the old
|
||||
* block.
|
||||
*/
|
||||
- kReuse_OnShrink,
|
||||
+ kReuse_OnShrink
|
||||
};
|
||||
|
||||
/**
|
||||
* Reallocates the block to a new size. The ptr may or may not change.
|
||||
*/
|
||||
void* reset(size_t size, OnShrink shrink = kAlloc_OnShrink) {
|
||||
if (size == fSize || (kReuse_OnShrink == shrink && size < fSize)) {
|
||||
return fPtr;
|
||||
diff --git a/gfx/skia/include/effects/SkLayerDrawLooper.h b/gfx/skia/include/effects/SkLayerDrawLooper.h
|
||||
--- a/gfx/skia/include/effects/SkLayerDrawLooper.h
|
||||
+++ b/gfx/skia/include/effects/SkLayerDrawLooper.h
|
||||
@@ -36,17 +36,17 @@ public:
|
||||
|
||||
/**
|
||||
* Use the layer's paint entirely, with these exceptions:
|
||||
* - We never override the draw's paint's text_encoding, since that is
|
||||
* used to interpret the text/len parameters in draw[Pos]Text.
|
||||
* - Flags and Color are always computed using the LayerInfo's
|
||||
* fFlagsMask and fColorMode.
|
||||
*/
|
||||
- kEntirePaint_Bits = -1,
|
||||
+ kEntirePaint_Bits = -1
|
||||
|
||||
};
|
||||
typedef int32_t BitFlags;
|
||||
|
||||
/**
|
||||
* Info for how to apply the layer's paint and offset.
|
||||
*
|
||||
* fFlagsMask selects which flags in the layer's paint should be applied.
|
||||
diff --git a/gfx/skia/src/core/SkBitmap.cpp b/gfx/skia/src/core/SkBitmap.cpp
|
||||
--- a/gfx/skia/src/core/SkBitmap.cpp
|
||||
+++ b/gfx/skia/src/core/SkBitmap.cpp
|
||||
@@ -1357,17 +1357,17 @@ bool SkBitmap::extractAlpha(SkBitmap* ds
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum {
|
||||
SERIALIZE_PIXELTYPE_NONE,
|
||||
SERIALIZE_PIXELTYPE_RAW_WITH_CTABLE,
|
||||
SERIALIZE_PIXELTYPE_RAW_NO_CTABLE,
|
||||
SERIALIZE_PIXELTYPE_REF_DATA,
|
||||
- SERIALIZE_PIXELTYPE_REF_PTR,
|
||||
+ SERIALIZE_PIXELTYPE_REF_PTR
|
||||
};
|
||||
|
||||
static void writeString(SkFlattenableWriteBuffer& buffer, const char str[]) {
|
||||
size_t len = strlen(str);
|
||||
buffer.write32(len);
|
||||
buffer.writePad(str, len);
|
||||
}
|
||||
|
||||
diff --git a/gfx/skia/src/core/SkMatrix.cpp b/gfx/skia/src/core/SkMatrix.cpp
|
||||
--- a/gfx/skia/src/core/SkMatrix.cpp
|
||||
+++ b/gfx/skia/src/core/SkMatrix.cpp
|
||||
@@ -1715,17 +1715,17 @@ SkScalar SkMatrix::getMaxStretch() const
|
||||
const SkMatrix& SkMatrix::I() {
|
||||
static SkMatrix gIdentity;
|
||||
static bool gOnce;
|
||||
if (!gOnce) {
|
||||
gIdentity.reset();
|
||||
gOnce = true;
|
||||
}
|
||||
return gIdentity;
|
||||
-};
|
||||
+}
|
||||
|
||||
const SkMatrix& SkMatrix::InvalidMatrix() {
|
||||
static SkMatrix gInvalid;
|
||||
static bool gOnce;
|
||||
if (!gOnce) {
|
||||
gInvalid.setAll(SK_ScalarMax, SK_ScalarMax, SK_ScalarMax,
|
||||
SK_ScalarMax, SK_ScalarMax, SK_ScalarMax,
|
||||
SK_ScalarMax, SK_ScalarMax, SK_ScalarMax);
|
@ -34,7 +34,7 @@ public:
|
||||
kCFF_Font,
|
||||
kTrueType_Font,
|
||||
kOther_Font,
|
||||
kNotEmbeddable_Font,
|
||||
kNotEmbeddable_Font
|
||||
};
|
||||
// The type of the underlying font program. This field determines which
|
||||
// of the following fields are valid. If it is kOther_Font or
|
||||
@ -56,7 +56,7 @@ public:
|
||||
kItalic_Style = 0x00040,
|
||||
kAllCaps_Style = 0x10000,
|
||||
kSmallCaps_Style = 0x20000,
|
||||
kForceBold_Style = 0x40000,
|
||||
kForceBold_Style = 0x40000
|
||||
};
|
||||
uint16_t fStyle; // Font style characteristics.
|
||||
int16_t fItalicAngle; // Counterclockwise degrees from vertical of the
|
||||
@ -75,7 +75,7 @@ public:
|
||||
kHAdvance_PerGlyphInfo = 0x1, // Populate horizontal advance data.
|
||||
kVAdvance_PerGlyphInfo = 0x2, // Populate vertical advance data.
|
||||
kGlyphNames_PerGlyphInfo = 0x4, // Populate glyph names (Type 1 only).
|
||||
kToUnicode_PerGlyphInfo = 0x8, // Populate ToUnicode table, ignored
|
||||
kToUnicode_PerGlyphInfo = 0x8 // Populate ToUnicode table, ignored
|
||||
// for Type 1 fonts
|
||||
};
|
||||
|
||||
@ -84,7 +84,7 @@ public:
|
||||
enum MetricType {
|
||||
kDefault, // Default advance: fAdvance.count = 1
|
||||
kRange, // Advances for a range: fAdvance.count = fEndID-fStartID
|
||||
kRun, // fStartID-fEndID have same advance: fAdvance.count = 1
|
||||
kRun // fStartID-fEndID have same advance: fAdvance.count = 1
|
||||
};
|
||||
MetricType fType;
|
||||
uint16_t fStartId;
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
|
||||
enum Flags32 {
|
||||
kGlobalAlpha_Flag32 = 1 << 0,
|
||||
kSrcPixelAlpha_Flag32 = 1 << 1,
|
||||
kSrcPixelAlpha_Flag32 = 1 << 1
|
||||
};
|
||||
|
||||
/** Function pointer that blends 32bit colors onto a 32bit destination.
|
||||
|
@ -137,7 +137,7 @@ public:
|
||||
* low byte to high byte: R, G, B, A.
|
||||
*/
|
||||
kRGBA_Premul_Config8888,
|
||||
kRGBA_Unpremul_Config8888,
|
||||
kRGBA_Unpremul_Config8888
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -139,7 +139,7 @@ public:
|
||||
protected:
|
||||
enum Usage {
|
||||
kGeneral_Usage,
|
||||
kSaveLayer_Usage, // <! internal use only
|
||||
kSaveLayer_Usage // <! internal use only
|
||||
};
|
||||
|
||||
struct TextFlags {
|
||||
|
@ -221,7 +221,7 @@ public:
|
||||
* Instructs the writer to inline Factory names as there are seen the
|
||||
* first time (after that we store an index). The pipe code uses this.
|
||||
*/
|
||||
kInlineFactoryNames_Flag = 0x02,
|
||||
kInlineFactoryNames_Flag = 0x02
|
||||
};
|
||||
Flags getFlags() const { return (Flags)fFlags; }
|
||||
void setFlags(Flags flags) { fFlags = flags; }
|
||||
|
@ -250,7 +250,7 @@ public:
|
||||
*/
|
||||
enum LCDOrientation {
|
||||
kHorizontal_LCDOrientation = 0, //!< this is the default
|
||||
kVertical_LCDOrientation = 1,
|
||||
kVertical_LCDOrientation = 1
|
||||
};
|
||||
|
||||
static void SetSubpixelOrientation(LCDOrientation orientation);
|
||||
@ -269,7 +269,7 @@ public:
|
||||
enum LCDOrder {
|
||||
kRGB_LCDOrder = 0, //!< this is the default
|
||||
kBGR_LCDOrder = 1,
|
||||
kNONE_LCDOrder = 2,
|
||||
kNONE_LCDOrder = 2
|
||||
};
|
||||
|
||||
static void SetSubpixelOrder(LCDOrder order);
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
kNormal_BlurType, //!< fuzzy inside and outside
|
||||
kSolid_BlurType, //!< solid inside, fuzzy outside
|
||||
kOuter_BlurType, //!< nothing inside, fuzzy outside
|
||||
kInner_BlurType, //!< fuzzy inside, nothing outside
|
||||
kInner_BlurType //!< fuzzy inside, nothing outside
|
||||
};
|
||||
|
||||
struct BlurInfo {
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
kNo_Hinting = 0,
|
||||
kSlight_Hinting = 1,
|
||||
kNormal_Hinting = 2, //!< this is the default
|
||||
kFull_Hinting = 3,
|
||||
kFull_Hinting = 3
|
||||
};
|
||||
|
||||
Hinting getHinting() const {
|
||||
@ -287,7 +287,7 @@ public:
|
||||
kStroke_Style, //!< stroke the geometry
|
||||
kStrokeAndFill_Style, //!< fill and stroke the geometry
|
||||
|
||||
kStyleCount,
|
||||
kStyleCount
|
||||
};
|
||||
|
||||
/** Return the paint's style, used for controlling how primitives'
|
||||
|
@ -177,14 +177,14 @@ public:
|
||||
|
||||
// luminance : 0 for black text, kLuminance_Max for white text
|
||||
kLuminance_Shift = 11, // to shift into the other flags above
|
||||
kLuminance_Bits = 3, // ensure Flags doesn't exceed 16bits
|
||||
kLuminance_Bits = 3 // ensure Flags doesn't exceed 16bits
|
||||
};
|
||||
|
||||
// computed values
|
||||
enum {
|
||||
kHinting_Mask = kHintingBit1_Flag | kHintingBit2_Flag,
|
||||
kLuminance_Max = (1 << kLuminance_Bits) - 1,
|
||||
kLuminance_Mask = kLuminance_Max << kLuminance_Shift,
|
||||
kLuminance_Mask = kLuminance_Max << kLuminance_Shift
|
||||
};
|
||||
|
||||
struct Rec {
|
||||
|
@ -438,7 +438,7 @@ public:
|
||||
* current block is dynamically allocated, just return the old
|
||||
* block.
|
||||
*/
|
||||
kReuse_OnShrink,
|
||||
kReuse_OnShrink
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
* - Flags and Color are always computed using the LayerInfo's
|
||||
* fFlagsMask and fColorMode.
|
||||
*/
|
||||
kEntirePaint_Bits = -1,
|
||||
kEntirePaint_Bits = -1
|
||||
|
||||
};
|
||||
typedef int32_t BitFlags;
|
||||
|
@ -1362,7 +1362,7 @@ enum {
|
||||
SERIALIZE_PIXELTYPE_RAW_WITH_CTABLE,
|
||||
SERIALIZE_PIXELTYPE_RAW_NO_CTABLE,
|
||||
SERIALIZE_PIXELTYPE_REF_DATA,
|
||||
SERIALIZE_PIXELTYPE_REF_PTR,
|
||||
SERIALIZE_PIXELTYPE_REF_PTR
|
||||
};
|
||||
|
||||
static void writeString(SkFlattenableWriteBuffer& buffer, const char str[]) {
|
||||
|
@ -1720,7 +1720,7 @@ const SkMatrix& SkMatrix::I() {
|
||||
gOnce = true;
|
||||
}
|
||||
return gIdentity;
|
||||
};
|
||||
}
|
||||
|
||||
const SkMatrix& SkMatrix::InvalidMatrix() {
|
||||
static SkMatrix gInvalid;
|
||||
|
@ -108,4 +108,5 @@ patch -p3 < skia_restrict_problem.patch
|
||||
patch -p3 < user-config.patch
|
||||
# Bug 715718 - Unitialized variable 'margin' in compute_bounds : SkDraw.cpp
|
||||
patch -p3 < uninitialized-margin.patch
|
||||
|
||||
# Bug 722011 - Fix comma at end of enum list
|
||||
patch -p3 < fix-comma-end-enum-list.patch
|
||||
|
@ -237,6 +237,12 @@ gfxPlatform::gfxPlatform()
|
||||
mGraphiteShapingEnabled = UNINITIALIZED_VALUE;
|
||||
#endif
|
||||
mBidiNumeralOption = UNINITIALIZED_VALUE;
|
||||
|
||||
if (Preferences::GetBool("gfx.canvas.azure.prefer-skia", false)) {
|
||||
mPreferredDrawTargetBackend = BACKEND_SKIA;
|
||||
} else {
|
||||
mPreferredDrawTargetBackend = BACKEND_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
gfxPlatform*
|
||||
|
@ -158,6 +158,8 @@ GetBackendName(mozilla::gfx::BackendType aBackend)
|
||||
return "cairo";
|
||||
case mozilla::gfx::BACKEND_SKIA:
|
||||
return "skia";
|
||||
case mozilla::gfx::BACKEND_NONE:
|
||||
return "none";
|
||||
default:
|
||||
NS_ERROR("Invalid backend type!");
|
||||
return "";
|
||||
@ -448,6 +450,9 @@ protected:
|
||||
// which scripts should be shaped with harfbuzz
|
||||
PRInt32 mUseHarfBuzzScripts;
|
||||
|
||||
// The preferred draw target backend to use
|
||||
mozilla::gfx::BackendType mPreferredDrawTargetBackend;
|
||||
|
||||
private:
|
||||
virtual qcms_profile* GetPlatformCMSOutputProfile();
|
||||
|
||||
|
@ -163,7 +163,12 @@ gfxPlatformMac::GetScaledFontForFont(gfxFont *aFont)
|
||||
bool
|
||||
gfxPlatformMac::SupportsAzure(BackendType& aBackend)
|
||||
{
|
||||
aBackend = BACKEND_COREGRAPHICS;
|
||||
if (mPreferredDrawTargetBackend != BACKEND_NONE) {
|
||||
aBackend = mPreferredDrawTargetBackend;
|
||||
} else {
|
||||
aBackend = BACKEND_COREGRAPHICS;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -552,10 +552,11 @@ gfxWindowsPlatform::SupportsAzure(BackendType& aBackend)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Preferences::GetBool("gfx.canvas.azure.prefer-skia", false)) {
|
||||
aBackend = BACKEND_SKIA;
|
||||
if (mPreferredDrawTargetBackend != BACKEND_NONE) {
|
||||
aBackend = mPreferredDrawTargetBackend;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -385,7 +385,7 @@ public:
|
||||
|
||||
scoped_refptr<base::MessagePump> pump_;
|
||||
|
||||
ObserverList<DestructionObserver> destruction_observers_;
|
||||
base::ObserverList<DestructionObserver> destruction_observers_;
|
||||
|
||||
// A recursion block that prevents accidentally running additonal tasks when
|
||||
// insider a (accidentally induced?) nested message pump.
|
||||
|
@ -16,6 +16,8 @@
|
||||
using _STLP_STD_NAME::find;
|
||||
#endif
|
||||
|
||||
namespace base {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OVERVIEW:
|
||||
@ -169,12 +171,14 @@ class ObserverList {
|
||||
DISALLOW_EVIL_CONSTRUCTORS(ObserverList);
|
||||
};
|
||||
|
||||
#define FOR_EACH_OBSERVER(ObserverType, observer_list, func) \
|
||||
do { \
|
||||
ObserverList<ObserverType>::Iterator it(observer_list); \
|
||||
ObserverType* obs; \
|
||||
while ((obs = it.GetNext()) != NULL) \
|
||||
obs->func; \
|
||||
} // namespace base
|
||||
|
||||
#define FOR_EACH_OBSERVER(ObserverType, observer_list, func) \
|
||||
do { \
|
||||
base::ObserverList<ObserverType>::Iterator it(observer_list); \
|
||||
ObserverType* obs; \
|
||||
while ((obs = it.GetNext()) != NULL) \
|
||||
obs->func; \
|
||||
} while (0)
|
||||
|
||||
#endif // BASE_OBSERVER_LIST_H__
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include "base/ref_counted.h"
|
||||
#include "base/task.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OVERVIEW:
|
||||
@ -196,4 +198,6 @@ class ObserverListThreadSafe
|
||||
DISALLOW_EVIL_CONSTRUCTORS(ObserverListThreadSafe);
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // BASE_OBSERVER_LIST_THREADSAFE_H_
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "base/ref_counted.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base;
|
||||
using base::Time;
|
||||
|
||||
namespace {
|
||||
|
@ -75,7 +75,7 @@ class NotificationService {
|
||||
static Details<void> NoDetails() { return Details<void>(NULL); }
|
||||
|
||||
private:
|
||||
typedef ObserverList<NotificationObserver> NotificationObserverList;
|
||||
typedef base::ObserverList<NotificationObserver> NotificationObserverList;
|
||||
typedef std::map<uintptr_t, NotificationObserverList*> NotificationSourceMap;
|
||||
|
||||
// Convenience function to determine whether a source has a
|
||||
|
@ -223,7 +223,7 @@ class PrefService : public NonThreadSafe {
|
||||
|
||||
// A map from pref names to a list of observers. Observers get fired in the
|
||||
// order they are added.
|
||||
typedef ObserverList<NotificationObserver> NotificationObserverList;
|
||||
typedef base::ObserverList<NotificationObserver> NotificationObserverList;
|
||||
typedef base::hash_map<std::wstring, NotificationObserverList*>
|
||||
PrefObserverMap;
|
||||
PrefObserverMap pref_observers_;
|
||||
|
@ -32,7 +32,7 @@ function getElement(id) {
|
||||
this.$ = this.getElement;
|
||||
|
||||
function sendMouseEvent(aEvent, aTarget, aWindow) {
|
||||
if (['click', 'mousedown', 'mouseup', 'mouseover', 'mouseout'].indexOf(aEvent.type) == -1) {
|
||||
if (['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mouseout'].indexOf(aEvent.type) == -1) {
|
||||
throw new Error("sendMouseEvent doesn't know about event type '" + aEvent.type + "'");
|
||||
}
|
||||
|
||||
@ -52,7 +52,8 @@ function sendMouseEvent(aEvent, aTarget, aWindow) {
|
||||
var viewArg = aWindow;
|
||||
var detailArg = aEvent.detail || (aEvent.type == 'click' ||
|
||||
aEvent.type == 'mousedown' ||
|
||||
aEvent.type == 'mouseup' ? 1 : 0);
|
||||
aEvent.type == 'mouseup' ? 1 :
|
||||
aEvent.type == 'dblclick'? 2 : 0);
|
||||
var screenXArg = aEvent.screenX || 0;
|
||||
var screenYArg = aEvent.screenY || 0;
|
||||
var clientXArg = aEvent.clientX || 0;
|
||||
|
@ -114,7 +114,7 @@ function test() {
|
||||
else if (aTopic == "domwindowopened") {
|
||||
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
|
||||
SimpleTest.waitForFocus(function() {
|
||||
EventUtils.synthesizeKey("VK_RETURN", {}, win)
|
||||
EventUtils.sendKey("RETURN", win);
|
||||
}, win);
|
||||
}
|
||||
});
|
||||
|
@ -124,7 +124,7 @@ function test() {
|
||||
else if (aTopic == "domwindowopened") {
|
||||
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
|
||||
SimpleTest.waitForFocus(function() {
|
||||
EventUtils.synthesizeKey("VK_RETURN", {}, win)
|
||||
EventUtils.sendKey("RETURN", win);
|
||||
}, win);
|
||||
}
|
||||
});
|
||||
|
@ -227,14 +227,10 @@
|
||||
<table>
|
||||
<tbody id="graphics-tbody">
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tbody id="graphics-info-properties">
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tbody id="graphics-failures-tbody">
|
||||
</tbody>
|
||||
</table>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -41,11 +41,13 @@
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
#include <cstdlib>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#include "AndroidJavaWrappers.h"
|
||||
|
||||
@ -62,6 +64,12 @@
|
||||
class nsWindow;
|
||||
class nsIDOMMozSmsMessage;
|
||||
|
||||
/* See the comment in AndroidBridge about this function before using it */
|
||||
extern "C" JNIEnv * GetJNIForThread();
|
||||
|
||||
extern bool mozilla_AndroidBridge_SetMainThread(void *);
|
||||
extern jclass GetGeckoAppShellClass();
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace hal {
|
||||
@ -108,18 +116,23 @@ public:
|
||||
return sBridge;
|
||||
}
|
||||
|
||||
static JavaVM *VM() {
|
||||
return sBridge->mJavaVM;
|
||||
}
|
||||
|
||||
static JNIEnv *JNI() {
|
||||
sBridge->EnsureJNIThread();
|
||||
return sBridge->mJNIEnv;
|
||||
}
|
||||
|
||||
static JNIEnv *JNIForThread() {
|
||||
static JavaVM *GetVM() {
|
||||
if (NS_LIKELY(sBridge))
|
||||
return sBridge->AttachThread();
|
||||
return sBridge->mJavaVM;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
static JNIEnv *GetJNIEnv() {
|
||||
if (NS_LIKELY(sBridge)) {
|
||||
if ((void*)pthread_self() != sBridge->mThread) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "AndroidBridge",
|
||||
"###!!!!!!! Something's grabbing the JNIEnv from the wrong thread! (thr %p should be %p)",
|
||||
(void*)pthread_self(), (void*)sBridge->mThread);
|
||||
return nsnull;
|
||||
}
|
||||
return sBridge->mJNIEnv;
|
||||
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
@ -134,8 +147,6 @@ public:
|
||||
// SetMainThread.
|
||||
bool SetMainThread(void *thr);
|
||||
|
||||
JNIEnv* AttachThread(bool asDaemon = true);
|
||||
|
||||
/* These are all implemented in Java */
|
||||
static void NotifyIME(int aType, int aState);
|
||||
|
||||
@ -242,15 +253,16 @@ public:
|
||||
public:
|
||||
AutoLocalJNIFrame(int nEntries = 128)
|
||||
: mEntries(nEntries)
|
||||
, mJNIEnv(JNI())
|
||||
{
|
||||
mJNIEnv = AndroidBridge::GetJNIEnv();
|
||||
Push();
|
||||
}
|
||||
|
||||
AutoLocalJNIFrame(JNIEnv* aJNIEnv, int nEntries = 128)
|
||||
: mEntries(nEntries)
|
||||
, mJNIEnv(aJNIEnv ? aJNIEnv : JNI())
|
||||
{
|
||||
mJNIEnv = aJNIEnv ? aJNIEnv : AndroidBridge::GetJNIEnv();
|
||||
|
||||
Push();
|
||||
}
|
||||
|
||||
@ -258,11 +270,16 @@ public:
|
||||
// the AutoLocalJNIFrame's scope INVALID; be sure that you locked down
|
||||
// any local refs that you need to keep around in global refs!
|
||||
void Purge() {
|
||||
mJNIEnv->PopLocalFrame(NULL);
|
||||
Push();
|
||||
if (mJNIEnv) {
|
||||
mJNIEnv->PopLocalFrame(NULL);
|
||||
Push();
|
||||
}
|
||||
}
|
||||
|
||||
~AutoLocalJNIFrame() {
|
||||
if (!mJNIEnv)
|
||||
return;
|
||||
|
||||
jthrowable exception = mJNIEnv->ExceptionOccurred();
|
||||
if (exception) {
|
||||
mJNIEnv->ExceptionDescribe();
|
||||
@ -274,6 +291,9 @@ public:
|
||||
|
||||
private:
|
||||
void Push() {
|
||||
if (!mJNIEnv)
|
||||
return;
|
||||
|
||||
// Make sure there is enough space to store a local ref to the
|
||||
// exception. I am not completely sure this is needed, but does
|
||||
// not hurt.
|
||||
@ -306,9 +326,9 @@ public:
|
||||
|
||||
void UnlockBitmap(jobject bitmap);
|
||||
|
||||
void PostToJavaThread(nsIRunnable* aRunnable, bool aMainThread = false);
|
||||
void PostToJavaThread(JNIEnv *aEnv, nsIRunnable* aRunnable, bool aMainThread = false);
|
||||
|
||||
void ExecuteNextRunnable();
|
||||
void ExecuteNextRunnable(JNIEnv *aEnv);
|
||||
|
||||
/* Copied from Android's native_window.h in newer (platform 9) NDK */
|
||||
enum {
|
||||
@ -378,8 +398,6 @@ protected:
|
||||
AndroidBridge() { }
|
||||
bool Init(JNIEnv *jEnv, jclass jGeckoApp);
|
||||
|
||||
void EnsureJNIThread();
|
||||
|
||||
bool mOpenedGraphicsLibraries;
|
||||
void OpenGraphicsLibraries();
|
||||
|
||||
@ -498,8 +516,5 @@ private:
|
||||
protected:
|
||||
};
|
||||
|
||||
extern "C" JNIEnv * GetJNIForThread();
|
||||
extern bool mozilla_AndroidBridge_SetMainThread(void *);
|
||||
extern jclass GetGeckoAppShellClass();
|
||||
|
||||
#endif /* AndroidBridge_h__ */
|
||||
|
@ -218,14 +218,14 @@ Java_org_mozilla_gecko_GeckoAppShell_reportJavaCrash(JNIEnv *jenv, jclass, jstri
|
||||
}
|
||||
|
||||
NS_EXPORT void JNICALL
|
||||
Java_org_mozilla_gecko_GeckoAppShell_executeNextRunnable(JNIEnv *, jclass)
|
||||
Java_org_mozilla_gecko_GeckoAppShell_executeNextRunnable(JNIEnv *jenv, jclass)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "GeckoJNI", "%s", __PRETTY_FUNCTION__);
|
||||
if (!AndroidBridge::Bridge()) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "GeckoJNI", "no bridge in %s!!!!", __PRETTY_FUNCTION__);
|
||||
return;
|
||||
}
|
||||
AndroidBridge::Bridge()->ExecuteNextRunnable();
|
||||
AndroidBridge::Bridge()->ExecuteNextRunnable(jenv);
|
||||
__android_log_print(ANDROID_LOG_INFO, "GeckoJNI", "leaving %s", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
|
@ -124,8 +124,6 @@ jmethodID AndroidGeckoSurfaceView::jGetSoftwareDrawBufferMethod = 0;
|
||||
jmethodID AndroidGeckoSurfaceView::jGetSurfaceMethod = 0;
|
||||
jmethodID AndroidGeckoSurfaceView::jGetHolderMethod = 0;
|
||||
|
||||
#define JNI() (AndroidBridge::JNI())
|
||||
|
||||
#define initInit() jclass jClass
|
||||
|
||||
// note that this also sets jClass
|
||||
@ -608,43 +606,68 @@ AndroidGeckoSurfaceView::BeginDrawing()
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "BeginDrawing called on null surfaceview!");
|
||||
|
||||
return JNI()->CallIntMethod(wrapped_obj, jBeginDrawingMethod);
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return 0;
|
||||
|
||||
return env->CallIntMethod(wrapped_obj, jBeginDrawingMethod);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoSurfaceView::EndDrawing()
|
||||
{
|
||||
JNI()->CallVoidMethod(wrapped_obj, jEndDrawingMethod);
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
env->CallVoidMethod(wrapped_obj, jEndDrawingMethod);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoSurfaceView::Draw2D(jobject bitmap, int width, int height)
|
||||
{
|
||||
JNI()->CallVoidMethod(wrapped_obj, jDraw2DBitmapMethod, bitmap, width, height);
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
env->CallVoidMethod(wrapped_obj, jDraw2DBitmapMethod, bitmap, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoSurfaceView::Draw2D(jobject buffer, int stride)
|
||||
{
|
||||
JNI()->CallVoidMethod(wrapped_obj, jDraw2DBufferMethod, buffer, stride);
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
env->CallVoidMethod(wrapped_obj, jDraw2DBufferMethod, buffer, stride);
|
||||
}
|
||||
|
||||
jobject
|
||||
AndroidGeckoSoftwareLayerClient::LockBuffer()
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "LockBuffer() called on null software layer client!");
|
||||
AndroidBridge::AutoLocalJNIFrame(1);
|
||||
return JNI()->CallObjectMethod(wrapped_obj, jLockBufferMethod);
|
||||
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return nsnull;
|
||||
|
||||
AndroidBridge::AutoLocalJNIFrame(env, 1);
|
||||
return env->CallObjectMethod(wrapped_obj, jLockBufferMethod);
|
||||
}
|
||||
|
||||
unsigned char *
|
||||
AndroidGeckoSoftwareLayerClient::LockBufferBits()
|
||||
{
|
||||
AndroidBridge::AutoLocalJNIFrame(1);
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return nsnull;
|
||||
|
||||
AndroidBridge::AutoLocalJNIFrame(env, 1);
|
||||
jobject bufferObject = LockBuffer();
|
||||
|
||||
if (bufferObject != nsnull)
|
||||
return reinterpret_cast<unsigned char *>(JNI()->GetDirectBufferAddress(bufferObject));
|
||||
return reinterpret_cast<unsigned char *>(env->GetDirectBufferAddress(bufferObject));
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
@ -653,14 +676,22 @@ void
|
||||
AndroidGeckoSoftwareLayerClient::UnlockBuffer()
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "UnlockBuffer() called on null software layer client!");
|
||||
AndroidBridge::AutoLocalJNIFrame(1);
|
||||
JNI()->CallVoidMethod(wrapped_obj, jUnlockBufferMethod);
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AndroidBridge::AutoLocalJNIFrame(env, 1);
|
||||
env->CallVoidMethod(wrapped_obj, jUnlockBufferMethod);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoSoftwareLayerClient::GetRenderOffset(nsIntPoint &aOffset)
|
||||
{
|
||||
AndroidPoint offset(JNI(), JNI()->CallObjectMethod(wrapped_obj, jGetRenderOffsetMethod));
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AndroidPoint offset(env, env->CallObjectMethod(wrapped_obj, jGetRenderOffsetMethod));
|
||||
aOffset.x = offset.X();
|
||||
aOffset.y = offset.Y();
|
||||
}
|
||||
@ -669,41 +700,65 @@ bool
|
||||
AndroidGeckoSoftwareLayerClient::BeginDrawing(int aWidth, int aHeight, int aTileWidth, int aTileHeight, const nsAString &aMetadata, bool aHasDirectTexture)
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "BeginDrawing() called on null software layer client!");
|
||||
AndroidBridge::AutoLocalJNIFrame(1);
|
||||
jstring jMetadata = JNI()->NewString(nsPromiseFlatString(aMetadata).get(), aMetadata.Length());
|
||||
return JNI()->CallBooleanMethod(wrapped_obj, jBeginDrawingMethod, aWidth, aHeight, aTileWidth, aTileHeight, jMetadata, aHasDirectTexture);
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return false;
|
||||
|
||||
AndroidBridge::AutoLocalJNIFrame(env, 1);
|
||||
jstring jMetadata = env->NewString(nsPromiseFlatString(aMetadata).get(), aMetadata.Length());
|
||||
return env->CallBooleanMethod(wrapped_obj, jBeginDrawingMethod, aWidth, aHeight, aTileWidth, aTileHeight, jMetadata, aHasDirectTexture);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoSoftwareLayerClient::EndDrawing(const nsIntRect &aRect)
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "EndDrawing() called on null software layer client!");
|
||||
AndroidBridge::AutoLocalJNIFrame(1);
|
||||
return JNI()->CallVoidMethod(wrapped_obj, jEndDrawingMethod, aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AndroidBridge::AutoLocalJNIFrame(env, 1);
|
||||
return env->CallVoidMethod(wrapped_obj, jEndDrawingMethod, aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
}
|
||||
|
||||
jobject
|
||||
AndroidGeckoSurfaceView::GetSoftwareDrawBitmap()
|
||||
{
|
||||
return JNI()->CallObjectMethod(wrapped_obj, jGetSoftwareDrawBitmapMethod);
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return nsnull;
|
||||
|
||||
return env->CallObjectMethod(wrapped_obj, jGetSoftwareDrawBitmapMethod);
|
||||
}
|
||||
|
||||
jobject
|
||||
AndroidGeckoSurfaceView::GetSoftwareDrawBuffer()
|
||||
{
|
||||
return JNI()->CallObjectMethod(wrapped_obj, jGetSoftwareDrawBufferMethod);
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return nsnull;
|
||||
|
||||
return env->CallObjectMethod(wrapped_obj, jGetSoftwareDrawBufferMethod);
|
||||
}
|
||||
|
||||
jobject
|
||||
AndroidGeckoSurfaceView::GetSurface()
|
||||
{
|
||||
return JNI()->CallObjectMethod(wrapped_obj, jGetSurfaceMethod);
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return nsnull;
|
||||
|
||||
return env->CallObjectMethod(wrapped_obj, jGetSurfaceMethod);
|
||||
}
|
||||
|
||||
jobject
|
||||
AndroidGeckoSurfaceView::GetSurfaceHolder()
|
||||
{
|
||||
return JNI()->CallObjectMethod(wrapped_obj, jGetHolderMethod);
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return nsnull;
|
||||
|
||||
return env->CallObjectMethod(wrapped_obj, jGetHolderMethod);
|
||||
}
|
||||
|
||||
void
|
||||
@ -734,7 +789,7 @@ nsJNIString::nsJNIString(jstring jstr, JNIEnv *jenv)
|
||||
}
|
||||
JNIEnv *jni = jenv;
|
||||
if (!jni)
|
||||
jni = JNI();
|
||||
jni = AndroidBridge::GetJNIEnv();
|
||||
const jchar* jCharPtr = jni->GetStringChars(jstr, NULL);
|
||||
|
||||
if (!jCharPtr) {
|
||||
|
@ -1352,8 +1352,12 @@ nsWindow::OnDraw(AndroidGeckoEvent *ae)
|
||||
return;
|
||||
}
|
||||
|
||||
void *buf = AndroidBridge::JNI()->GetDirectBufferAddress(bytebuf);
|
||||
int cap = AndroidBridge::JNI()->GetDirectBufferCapacity(bytebuf);
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
void *buf = env->GetDirectBufferAddress(bytebuf);
|
||||
int cap = env->GetDirectBufferCapacity(bytebuf);
|
||||
if (!buf || cap != (mBounds.width * mBounds.height * 2)) {
|
||||
ALOG("### Software drawing, but unexpected buffer size %d expected %d (or no buffer %p)!", cap, mBounds.width * mBounds.height * 2, buf);
|
||||
return;
|
||||
|
@ -1735,7 +1735,7 @@ GCGraphBuilder::NoteRoot(PRUint32 langID, void *root,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!participant->CanSkipThis(root)) {
|
||||
if (!participant->CanSkipThis(root) || WantAllTraces()) {
|
||||
AddNode(root, participant, langID);
|
||||
}
|
||||
}
|
||||
@ -1791,7 +1791,7 @@ GCGraphBuilder::NoteXPCOMChild(nsISupports *child)
|
||||
|
||||
nsXPCOMCycleCollectionParticipant *cp;
|
||||
ToParticipant(child, &cp);
|
||||
if (cp && !cp->CanSkipThis(child)) {
|
||||
if (cp && (!cp->CanSkipThis(child) || WantAllTraces())) {
|
||||
|
||||
PtrInfo *childPi = AddNode(child, cp, nsIProgrammingLanguage::CPLUSPLUS);
|
||||
if (!childPi)
|
||||
@ -1925,7 +1925,7 @@ AddPurpleRoot(GCGraphBuilder &builder, nsISupports *root)
|
||||
nsXPCOMCycleCollectionParticipant *cp;
|
||||
ToParticipant(root, &cp);
|
||||
|
||||
if (!cp->CanSkipInCC(root)) {
|
||||
if (builder.WantAllTraces() || !cp->CanSkipInCC(root)) {
|
||||
PtrInfo *pinfo = builder.AddNode(root, cp,
|
||||
nsIProgrammingLanguage::CPLUSPLUS);
|
||||
if (!pinfo) {
|
||||
@ -3732,7 +3732,13 @@ public:
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
mCollector->GCIfNeeded(false);
|
||||
// On a WantAllTraces CC, force a synchronous global GC to prevent
|
||||
// hijinks from ForgetSkippable and compartmental GCs.
|
||||
bool wantAllTraces = false;
|
||||
if (aListener) {
|
||||
aListener->GetWantAllTraces(&wantAllTraces);
|
||||
}
|
||||
mCollector->GCIfNeeded(wantAllTraces);
|
||||
|
||||
MutexAutoLock autoLock(mLock);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user