summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2014-05-19 13:21:21 -0700
committerRaph Levien <raph@google.com>2014-05-19 14:01:37 -0700
commitc31e3883456e018d742e9f29815ba5ff8b315ea1 (patch)
treeca0e5d7f03ad7a06496c89c432220d5f08c0d80e /include
parenta3998d4f51e862f00b3dc6b8b99cfbeea2622b2d (diff)
downloadandroid_frameworks_minikin-c31e3883456e018d742e9f29815ba5ff8b315ea1.tar.gz
android_frameworks_minikin-c31e3883456e018d742e9f29815ba5ff8b315ea1.tar.bz2
android_frameworks_minikin-c31e3883456e018d742e9f29815ba5ff8b315ea1.zip
Fix incomplete refcounting and locking
These changes were supposed to be committed in the previous patch "Better refcounting and locking" but seem to have gotten lost in a rebase. It fixes a memory leak and some possible race conditions. Change-Id: I54ca1e37500ec49756fe317cc6d6d03da9911501
Diffstat (limited to 'include')
-rw-r--r--include/minikin/FontFamily.h2
-rw-r--r--include/minikin/Layout.h6
2 files changed, 8 insertions, 0 deletions
diff --git a/include/minikin/FontFamily.h b/include/minikin/FontFamily.h
index 3b59017..82fcfe9 100644
--- a/include/minikin/FontFamily.h
+++ b/include/minikin/FontFamily.h
@@ -56,6 +56,8 @@ public:
MinikinFont* getFont(size_t index) const;
FontStyle getStyle(size_t index) const;
private:
+ void addFontLocked(MinikinFont* typeface, FontStyle style);
+
class Font {
public:
Font(MinikinFont* typeface, FontStyle style) :
diff --git a/include/minikin/Layout.h b/include/minikin/Layout.h
index 896478b..4fe9d87 100644
--- a/include/minikin/Layout.h
+++ b/include/minikin/Layout.h
@@ -55,8 +55,14 @@ struct LayoutGlyph {
float y;
};
+// Lifecycle and threading assumptions for Layout:
+// The object is assumed to be owned by a single thread; multiple threads
+// may not mutate it at the same time.
+// The lifetime of the FontCollection set through setFontCollection must
+// extend through the lifetime of the Layout object.
class Layout {
public:
+ ~Layout();
void dump() const;
void setFontCollection(const FontCollection* collection);