Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bring back 4 old patches
  • Loading branch information
rainemak committed Oct 14, 2015
1 parent 7f20b1e commit 2e6b50b
Show file tree
Hide file tree
Showing 5 changed files with 195 additions and 0 deletions.
97 changes: 97 additions & 0 deletions rpm/0001-Configure-system-sqlite-to-use-jemalloc.patch
@@ -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

35 changes: 35 additions & 0 deletions rpm/0002-Define-HAS_NEMO_RESOURCE-in-config.patch
@@ -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 rpm/0003-Limit-surface-area-rather-than-width-and-height.patch
@@ -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

26 changes: 26 additions & 0 deletions rpm/0004-Limit-maximum-scale-to-4x.-Fixes-JB-25377.patch
@@ -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

8 changes: 8 additions & 0 deletions rpm/xulrunner-qt5.spec
Expand Up @@ -42,6 +42,10 @@ Group: Applications/Internet
License: Mozilla License
URL: http://hg.mozilla.org/mozilla-central
Source0: %{name}-%{version}.tar.bz2
Patch1: 0001-Configure-system-sqlite-to-use-jemalloc.patch
Patch2: 0002-Define-HAS_NEMO_RESOURCE-in-config.patch
Patch3: 0003-Limit-surface-area-rather-than-width-and-height.patch
Patch4: 0004-Limit-maximum-scale-to-4x.-Fixes-JB-25377.patch
BuildRequires: pkgconfig(Qt5Quick)
BuildRequires: pkgconfig(Qt5Network)
BuildRequires: pkgconfig(pango)
Expand Down Expand Up @@ -119,6 +123,10 @@ Tests and misc files for xulrunner.

%prep
%setup -q -n %{name}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1

mkdir -p "%BUILD_DIR"
cp -rf "%BASE_CONFIG" "%BUILD_DIR"/mozconfig
Expand Down

0 comments on commit 2e6b50b

Please sign in to comment.