Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
195 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
From 46b9ab1170c9a34ab2208c1a9fd8b44ebc5922a1 Mon Sep 17 00:00:00 2001 | ||
From: Raine Makelainen <raine.makelainen@jolla.com> | ||
Date: Mon, 12 Oct 2015 16:18:14 +0300 | ||
Subject: [PATCH 1/4] Configure system sqlite to use jemalloc | ||
|
||
See bug 25229 | ||
--- | ||
embedding/embedlite/EmbedLiteApp.cpp | 66 ++++++++++++++++++++++++++++++++++++ | ||
1 file changed, 66 insertions(+) | ||
|
||
diff --git a/embedding/embedlite/EmbedLiteApp.cpp b/embedding/embedlite/EmbedLiteApp.cpp | ||
index 8879908..1ebd419 100644 | ||
--- a/embedding/embedlite/EmbedLiteApp.cpp | ||
+++ b/embedding/embedlite/EmbedLiteApp.cpp | ||
@@ -29,6 +29,68 @@ | ||
#include "EmbedLiteCompositorParent.h" | ||
#include "EmbedLiteAppProcessParent.h" | ||
|
||
+#include "sqlite3.h" | ||
+#include "mozmemory.h" | ||
+#include "mozilla/mozalloc.h" | ||
+ | ||
+// This anonymous namespace is a copy-paste from mozStorageService.cpp | ||
+// used to configure sqlite to use jemalloc. | ||
+namespace { | ||
+ | ||
+static void *sqliteMemMalloc(int n) | ||
+{ | ||
+ void* p = ::moz_malloc(n); | ||
+ return p; | ||
+} | ||
+ | ||
+static void sqliteMemFree(void *p) | ||
+{ | ||
+ ::moz_free(p); | ||
+} | ||
+ | ||
+static void *sqliteMemRealloc(void *p, int n) | ||
+{ | ||
+ return ::moz_realloc(p, n); | ||
+} | ||
+ | ||
+static int sqliteMemSize(void *p) | ||
+{ | ||
+ return ::moz_malloc_usable_size(p); | ||
+} | ||
+ | ||
+static int sqliteMemRoundup(int n) | ||
+{ | ||
+ n = malloc_good_size(n); | ||
+ | ||
+ // jemalloc can return blocks of size 2 and 4, but SQLite requires that all | ||
+ // allocations be 8-aligned. So we round up sub-8 requests to 8. This | ||
+ // wastes a small amount of memory but is obviously safe. | ||
+ return n <= 8 ? 8 : n; | ||
+} | ||
+ | ||
+static int sqliteMemInit(void *p) | ||
+{ | ||
+ return 0; | ||
+} | ||
+ | ||
+static void sqliteMemShutdown(void *p) | ||
+{ | ||
+} | ||
+ | ||
+const sqlite3_mem_methods memMethods = { | ||
+ &sqliteMemMalloc, | ||
+ &sqliteMemFree, | ||
+ &sqliteMemRealloc, | ||
+ &sqliteMemSize, | ||
+ &sqliteMemRoundup, | ||
+ &sqliteMemInit, | ||
+ &sqliteMemShutdown, | ||
+ nullptr | ||
+}; | ||
+ | ||
+} // anonymous namespace | ||
+ | ||
+ | ||
namespace mozilla { | ||
namespace startup { | ||
extern bool sIsEmbedlite; | ||
@@ -43,6 +105,10 @@ EmbedLiteApp* | ||
EmbedLiteApp::GetInstance() | ||
{ | ||
if (!sSingleton) { | ||
+ // configure sqlite3 | ||
+ int rc = ::sqlite3_config(SQLITE_CONFIG_MALLOC, &memMethods); | ||
+ NS_ASSERTION(rc == SQLITE_OK, "Can't configure sqlite!"); | ||
+ | ||
sSingleton = new EmbedLiteApp(); | ||
NS_ASSERTION(sSingleton, "not initialized"); | ||
} | ||
-- | ||
2.1.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
From be9de584dc5e41896556468fb5b1ccf143bcadf9 Mon Sep 17 00:00:00 2001 | ||
From: Dmitry Rozhkov <dmitry.rozhkov@jolla.com> | ||
Date: Mon, 11 May 2015 13:13:03 +0300 | ||
Subject: [PATCH 2/4] Define HAS_NEMO_RESOURCE in config | ||
|
||
See bugs 10947, 30305, and 30517 | ||
--- | ||
configure.in | 4 ++++ | ||
1 file changed, 4 insertions(+) | ||
|
||
diff --git a/configure.in b/configure.in | ||
index dd3b78c..c0177567 100644 | ||
--- a/configure.in | ||
+++ b/configure.in | ||
@@ -5717,6 +5717,9 @@ if test -n "$MOZ_GSTREAMER"; then | ||
AC_MSG_ERROR([gstreamer and gstreamer-plugins-base development packages are needed to build gstreamer backend. Install them or disable gstreamer support with --disable-gstreamer]) | ||
fi | ||
|
||
+ HAS_NEMO_RESOURCE=1 | ||
+ AC_DEFINE(HAS_NEMO_RESOURCE) | ||
+ | ||
_SAVE_LDFLAGS=$LDFLAGS | ||
LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION" | ||
AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=) | ||
@@ -5729,6 +5732,7 @@ if test -n "$MOZ_GSTREAMER"; then | ||
fi | ||
|
||
AC_SUBST(MOZ_GSTREAMER) | ||
+AC_SUBST(HAS_NEMO_RESOURCE) | ||
AC_SUBST(GST_API_VERSION) | ||
|
||
if test -n "$MOZ_GSTREAMER"; then | ||
-- | ||
2.1.4 | ||
|
29 changes: 29 additions & 0 deletions
29
rpm/0003-Limit-surface-area-rather-than-width-and-height.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
From 2cb4aad1cd477946b64d864b639d0da958d0b299 Mon Sep 17 00:00:00 2001 | ||
From: Dmitry Rozhkov <dmitry.rozhkov@jolla.com> | ||
Date: Mon, 11 May 2015 13:17:36 +0300 | ||
Subject: [PATCH 3/4] Limit surface area rather than width and height | ||
|
||
See bug 26935 | ||
--- | ||
gfx/cairo/cairo/src/cairo-image-surface.c | 5 +++-- | ||
1 file changed, 3 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/gfx/cairo/cairo/src/cairo-image-surface.c b/gfx/cairo/cairo/src/cairo-image-surface.c | ||
index a77f786..17c40a0 100644 | ||
--- a/gfx/cairo/cairo/src/cairo-image-surface.c | ||
+++ b/gfx/cairo/cairo/src/cairo-image-surface.c | ||
@@ -91,8 +91,9 @@ _pixman_image_for_solid (const cairo_solid_pattern_t *pattern); | ||
static cairo_bool_t | ||
_cairo_image_surface_is_size_valid (int width, int height) | ||
{ | ||
- return 0 <= width && width <= MAX_IMAGE_SIZE && | ||
- 0 <= height && height <= MAX_IMAGE_SIZE; | ||
+ const int area = width*height; | ||
+ return 0 <= width && 0 <= height && 0 <= area && | ||
+ area <= (MAX_IMAGE_SIZE*MAX_IMAGE_SIZE); | ||
} | ||
|
||
cairo_format_t | ||
-- | ||
2.1.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
From ecbdc3e671fbf86ca5556f9c6c995a45e103dec8 Mon Sep 17 00:00:00 2001 | ||
From: Raine Makelainen <raine.makelainen@jolla.com> | ||
Date: Mon, 12 Oct 2015 16:22:59 +0300 | ||
Subject: [PATCH 4/4] Limit maximum scale to 4x. Fixes JB#25377 | ||
|
||
The default zoom contraints now matches to the EmbedContentController. | ||
--- | ||
gfx/layers/apz/src/AsyncPanZoomController.cpp | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp | ||
index 6c45588..6ec6a25 100644 | ||
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp | ||
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp | ||
@@ -397,7 +397,7 @@ StaticAutoPtr<ComputedTimingFunction> gVelocityCurveFunction; | ||
/** | ||
* Maximum zoom amount, always used, even if a page asks for higher. | ||
*/ | ||
-static const CSSToParentLayerScale MAX_ZOOM(8.0f); | ||
+static const CSSToParentLayerScale MAX_ZOOM(4.0f); | ||
|
||
/** | ||
* Minimum zoom amount, always used, even if a page asks for lower. | ||
-- | ||
2.1.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters