forked from sailfishos/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1566288 - Port libGraphite usage in libThebes to use the RLBox AP…
…I. r=froydnj,jfkthame Differential Revision: https://phabricator.services.mozilla.com/D39593 --HG-- extra : moz-landing-system : lando
- Loading branch information
Showing
12 changed files
with
438 additions
and
96 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
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 |
---|---|---|
|
@@ -8,6 +8,7 @@ external_dirs = [] | |
|
||
DIRS += [ | ||
'lgpllibs', | ||
'rlbox', | ||
'sqlite', | ||
] | ||
if not CONFIG['MOZ_SYSTEM_JPEG']: | ||
|
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,22 @@ | ||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- | ||
# vim: set filetype=python: | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
EXPORTS.mozilla.rlbox += [ | ||
'/third_party/rlbox/include/rlbox.hpp', | ||
'/third_party/rlbox/include/rlbox_conversion.hpp', | ||
'/third_party/rlbox/include/rlbox_helpers.hpp', | ||
'/third_party/rlbox/include/rlbox_noop_sandbox.hpp', | ||
'/third_party/rlbox/include/rlbox_policy_types.hpp', | ||
'/third_party/rlbox/include/rlbox_range.hpp', | ||
'/third_party/rlbox/include/rlbox_sandbox.hpp', | ||
'/third_party/rlbox/include/rlbox_stdlib.hpp', | ||
'/third_party/rlbox/include/rlbox_stdlib_polyfill.hpp', | ||
'/third_party/rlbox/include/rlbox_struct_support.hpp', | ||
'/third_party/rlbox/include/rlbox_type_traits.hpp', | ||
'/third_party/rlbox/include/rlbox_types.hpp', | ||
'/third_party/rlbox/include/rlbox_unwrap.hpp', | ||
'/third_party/rlbox/include/rlbox_wrapper_traits.hpp', | ||
] |
58 changes: 58 additions & 0 deletions
58
gfx/graphite2/geckoextra/include/GraphiteStructsForRLBox.h
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,58 @@ | ||
// -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- | ||
// vim: set ts=2 et sw=2 tw=80: | ||
// This Source Code is subject to the terms of the Mozilla Public License | ||
// version 2.0 (the "License"). You can obtain a copy of the License at | ||
// http://mozilla.org/MPL/2.0/. | ||
|
||
#ifndef GraphiteStructsForRLBox_h__ | ||
#define GraphiteStructsForRLBox_h__ | ||
|
||
#if defined(__clang__) | ||
# pragma clang diagnostic push | ||
# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" | ||
#elif defined(__GNUC__) || defined(__GNUG__) | ||
// Can't turn off the variadic macro warning emitted from -pedantic | ||
# pragma GCC system_header | ||
#elif defined(_MSC_VER) | ||
// Doesn't seem to emit the warning | ||
#else | ||
// Don't know the compiler... just let it go through | ||
#endif | ||
|
||
#define sandbox_fields_reflection_graphite_class_gr_font_ops(f, g, ...) \ | ||
f(size_t, size, FIELD_NORMAL, ##__VA_ARGS__) g() \ | ||
f(float (*)(const void*, unsigned short), glyph_advance_x, FIELD_NORMAL, ##__VA_ARGS__) g() \ | ||
f(float (*)(const void*, unsigned short), glyph_advance_y, FIELD_NORMAL, ##__VA_ARGS__) g() | ||
|
||
#define sandbox_fields_reflection_graphite_class_gr_face_ops(f, g, ...) \ | ||
f(size_t, size, FIELD_NORMAL, ##__VA_ARGS__) g() \ | ||
f(const void* (*)(const void*, unsigned int, size_t*), get_table, FIELD_NORMAL, ##__VA_ARGS__) g() \ | ||
f(void (*)(const void*, const void*), release_table, FIELD_NORMAL, ##__VA_ARGS__) g() | ||
|
||
#define sandbox_fields_reflection_graphite_class_gr_glyph_to_char_cluster(f, g, ...) \ | ||
f(unsigned int, baseChar, FIELD_NORMAL, ##__VA_ARGS__) g() \ | ||
f(unsigned int, baseGlyph, FIELD_NORMAL, ##__VA_ARGS__) g() \ | ||
f(unsigned int, nChars, FIELD_NORMAL, ##__VA_ARGS__) g() \ | ||
f(unsigned int, nGlyphs, FIELD_NORMAL, ##__VA_ARGS__) g() | ||
|
||
#define sandbox_fields_reflection_graphite_class_gr_glyph_to_char_association(f, g, ...) \ | ||
f(gr_glyph_to_char_cluster*, clusters, FIELD_NORMAL, ##__VA_ARGS__) g() \ | ||
f(unsigned short*, gids, FIELD_NORMAL, ##__VA_ARGS__) g() \ | ||
f(float*, xLocs, FIELD_NORMAL, ##__VA_ARGS__) g() \ | ||
f(float*, yLocs, FIELD_NORMAL, ##__VA_ARGS__) g() \ | ||
f(unsigned int, cIndex, FIELD_NORMAL, ##__VA_ARGS__) g() | ||
|
||
#define sandbox_fields_reflection_graphite_allClasses(f, ...) \ | ||
f(gr_font_ops, graphite, ##__VA_ARGS__) \ | ||
f(gr_face_ops, graphite, ##__VA_ARGS__) \ | ||
f(gr_glyph_to_char_cluster, graphite, ##__VA_ARGS__) \ | ||
f(gr_glyph_to_char_association, graphite, ##__VA_ARGS__) | ||
|
||
#if defined(__clang__) | ||
# pragma clang diagnostic pop | ||
#elif defined(__GNUC__) || defined(__GNUG__) | ||
#elif defined(_MSC_VER) | ||
#else | ||
#endif | ||
|
||
#endif |
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
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,44 @@ | ||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef THEBES_RLBOX | ||
#define THEBES_RLBOX | ||
|
||
#include "ThebesRLBoxTypes.h" | ||
|
||
// RLBox uses c++17's shared_locks by default, even for the noop_sandbox | ||
// However c++17 shared_lock is not supported on macOS 10.9 to 10.11 | ||
// Thus we use Firefox's shared lock implementation | ||
// This can be removed if macOS 10.9 to 10.11 support is dropped | ||
#include "mozilla/RWLock.h" | ||
namespace rlbox { | ||
struct rlbox_shared_lock { | ||
mozilla::RWLock rwlock; | ||
rlbox_shared_lock() : rwlock("rlbox") {} | ||
}; | ||
} // namespace rlbox | ||
#define RLBOX_USE_CUSTOM_SHARED_LOCK | ||
#define RLBOX_SHARED_LOCK(name) rlbox::rlbox_shared_lock name | ||
#define RLBOX_ACQUIRE_SHARED_GUARD(name, ...) \ | ||
mozilla::AutoReadLock name((__VA_ARGS__).rwlock) | ||
#define RLBOX_ACQUIRE_UNIQUE_GUARD(name, ...) \ | ||
mozilla::AutoWriteLock name((__VA_ARGS__).rwlock) | ||
|
||
#define RLBOX_SINGLE_THREADED_INVOCATIONS | ||
|
||
#define RLBOX_USE_STATIC_CALLS() rlbox_noop_sandbox_lookup_symbol | ||
|
||
#include "mozilla/rlbox/rlbox.hpp" | ||
#include "mozilla/rlbox/rlbox_noop_sandbox.hpp" | ||
|
||
// Struct info needed for rlbox_load_structs_from_library | ||
#include "graphite2/Font.h" | ||
#include "graphite2/GraphiteExtra.h" | ||
#include "graphite2/Segment.h" | ||
|
||
#include "graphite2/GraphiteStructsForRLBox.h" | ||
rlbox_load_structs_from_library(graphite); | ||
|
||
#endif |
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,22 @@ | ||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef THEBES_RLBOX_TYPES | ||
#define THEBES_RLBOX_TYPES | ||
|
||
#include "mozilla/rlbox/rlbox_types.hpp" | ||
|
||
using rlbox_gr_sandbox_type = rlbox::rlbox_noop_sandbox; | ||
using rlbox_sandbox_gr = rlbox::rlbox_sandbox<rlbox_gr_sandbox_type>; | ||
template <typename T> | ||
using sandbox_callback_gr = rlbox::sandbox_callback<T, rlbox_gr_sandbox_type>; | ||
template <typename T> | ||
using tainted_gr = rlbox::tainted<T, rlbox_gr_sandbox_type>; | ||
template <typename T> | ||
using tainted_opaque_gr = rlbox::tainted_opaque<T, rlbox_gr_sandbox_type>; | ||
template <typename T> | ||
using tainted_volatile_gr = rlbox::tainted_volatile<T, rlbox_gr_sandbox_type>; | ||
|
||
#endif |
Oops, something went wrong.