Commit b174c4c8 authored by haraken@chromium.org's avatar haraken@chromium.org

Oilpan: Remove Document* pointers in objects

This CL replaces Document* pointers in objects with Member<Document>s.

- Move TextAutosizer to oilpan's heap.
- Move FastTextAutosizer to oilpan's heap.
- Make FastBulider STACK_ALLOCATED.
- Make ViewportStyleResolver::m_document a Member.

BUG=340522

Review URL: https://codereview.chromium.org/420273005

git-svn-id: svn://svn.chromium.org/blink/trunk@179066 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ffeebb21
......@@ -39,6 +39,7 @@ namespace blink {
// FIXME: This scoping class is a short-term fix to minimize the changes in
// Font-constructing logic.
class FontDescriptionChangeScope {
STACK_ALLOCATED();
public:
FontDescriptionChangeScope(FontBuilder* fontBuilder)
: m_fontBuilder(fontBuilder)
......@@ -56,12 +57,12 @@ public:
}
private:
FontBuilder* m_fontBuilder;
RawPtrWillBeMember<FontBuilder> m_fontBuilder;
FontDescription m_fontDescription;
};
FontBuilder::FontBuilder()
: m_document(0)
: m_document(nullptr)
, m_fontSizehasViewportUnits(false)
, m_style(0)
, m_fontDirty(false)
......
......@@ -38,7 +38,8 @@ class RenderStyle;
class FontDescriptionChangeScope;
class FontBuilder {
WTF_MAKE_NONCOPYABLE(FontBuilder); WTF_MAKE_FAST_ALLOCATED;
STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(FontBuilder);
public:
FontBuilder();
......@@ -112,7 +113,7 @@ private:
float getComputedSizeFromSpecifiedSize(FontDescription&, float effectiveZoom, float specifiedSize);
const Document* m_document;
RawPtrWillBeMember<const Document> m_document;
bool m_fontSizehasViewportUnits;
// FIXME: This member is here on a short-term lease. The plan is to remove
// any notion of RenderStyle from here, allowing FontBuilder to build Font objects
......
......@@ -200,6 +200,7 @@ Length ViewportStyleResolver::viewportLengthValue(CSSPropertyID id) const
void ViewportStyleResolver::trace(Visitor* visitor)
{
visitor->trace(m_propertySet);
visitor->trace(m_document);
}
} // namespace blink
......@@ -66,7 +66,7 @@ private:
float viewportArgumentValue(CSSPropertyID) const;
Length viewportLengthValue(CSSPropertyID) const;
Document* m_document;
RawPtrWillBeMember<Document> m_document;
RefPtrWillBeMember<MutableStylePropertySet> m_propertySet;
bool m_hasAuthorStyle;
};
......
......@@ -5866,6 +5866,8 @@ void Document::trace(Visitor* visitor)
visitor->trace(m_styleSheetList);
visitor->trace(m_mediaQueryMatcher);
visitor->trace(m_scriptedAnimationController);
visitor->trace(m_textAutosizer);
visitor->trace(m_fastTextAutosizer);
visitor->trace(m_registrationContext);
visitor->trace(m_customElementMicrotaskRunQueue);
visitor->trace(m_elementDataCache);
......
......@@ -1357,8 +1357,8 @@ private:
RefPtrWillBeMember<ScriptedAnimationController> m_scriptedAnimationController;
OwnPtr<MainThreadTaskRunner> m_taskRunner;
OwnPtr<TextAutosizer> m_textAutosizer;
OwnPtr<FastTextAutosizer> m_fastTextAutosizer;
OwnPtrWillBeMember<TextAutosizer> m_textAutosizer;
OwnPtrWillBeMember<FastTextAutosizer> m_fastTextAutosizer;
RefPtrWillBeMember<CustomElementRegistrationContext> m_registrationContext;
RefPtrWillBeMember<CustomElementMicrotaskRunQueue> m_customElementMicrotaskRunQueue;
......
......@@ -1154,4 +1154,9 @@ float FastTextAutosizer::computeAutosizedFontSize(float specifiedSize, float mul
return computedSize;
}
void FastTextAutosizer::trace(Visitor* visitor)
{
visitor->trace(m_document);
}
} // namespace blink
......@@ -33,6 +33,7 @@
#include "core/rendering/RenderObject.h"
#include "core/rendering/RenderTable.h"
#include "platform/heap/Handle.h"
#include "wtf/HashMap.h"
#include "wtf/HashSet.h"
#include "wtf/Noncopyable.h"
......@@ -49,13 +50,12 @@ class RenderListMarker;
// Single-pass text autosizer. Documentation at:
// http://tinyurl.com/fasttextautosizer
class FastTextAutosizer FINAL {
class FastTextAutosizer FINAL : public NoBaseWillBeGarbageCollectedFinalized<FastTextAutosizer> {
WTF_MAKE_NONCOPYABLE(FastTextAutosizer);
public:
static PassOwnPtr<FastTextAutosizer> create(const Document* document)
static PassOwnPtrWillBeRawPtr<FastTextAutosizer> create(const Document* document)
{
return adoptPtr(new FastTextAutosizer(document));
return adoptPtrWillBeNoop(new FastTextAutosizer(document));
}
static float computeAutosizedFontSize(float specifiedSize, float multiplier);
......@@ -65,6 +65,8 @@ public:
void destroy(const RenderBlock*);
void inflateListItem(RenderListItem*, RenderListMarker*);
void trace(Visitor*);
class LayoutScope {
public:
explicit LayoutScope(RenderBlock*);
......@@ -287,7 +289,7 @@ private:
void writeClusterDebugInfo(Cluster*);
#endif
const Document* m_document;
RawPtrWillBeMember<const Document> m_document;
const RenderBlock* m_firstBlockToBeginLayout;
#if ENABLE(ASSERT)
BlockSet m_blocksThatHaveBegunLayout; // Used to ensure we don't compute properties of a block before beginLayout() is called on it.
......
......@@ -825,4 +825,9 @@ void TextAutosizer::getNarrowDescendantsGroupedByWidth(const TextAutosizingClust
}
}
void TextAutosizer::trace(Visitor* visitor)
{
visitor->trace(m_document);
}
} // namespace blink
......@@ -27,6 +27,7 @@
#define TextAutosizer_h
#include "core/HTMLNames.h"
#include "platform/heap/Handle.h"
#include "platform/text/WritingMode.h"
#include "wtf/HashMap.h"
#include "wtf/Noncopyable.h"
......@@ -61,15 +62,19 @@ struct TextAutosizingClusterInfo {
Vector<TextAutosizingClusterInfo> narrowDescendants;
};
class TextAutosizer FINAL {
class TextAutosizer FINAL : public NoBaseWillBeGarbageCollectedFinalized<TextAutosizer> {
WTF_MAKE_NONCOPYABLE(TextAutosizer);
public:
static PassOwnPtr<TextAutosizer> create(Document* document) { return adoptPtr(new TextAutosizer(document)); }
static PassOwnPtrWillBeRawPtr<TextAutosizer> create(Document* document)
{
return adoptPtrWillBeNoop(new TextAutosizer(document));
}
bool processSubtree(RenderObject* layoutRoot);
void recalculateMultipliers();
void trace(Visitor*);
private:
friend class FastTextAutosizer;
......@@ -126,7 +131,7 @@ private:
void secondPassProcessStaleNonAutosizedClusters();
void processStaleContainer(float multiplier, RenderBlock* cluster, TextAutosizingClusterInfo&);
Document* m_document;
RawPtrWillBeMember<Document> m_document;
HashMap<const RenderObject*, unsigned> m_hashCache;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment