Commit 73d45a8b authored by tasak@google.com's avatar tasak@google.com

Make classes and structures in core/editing fast-allocated.

Added STATIC_ONLY, STACK_ALLOCATED, DISALLOW_ALLOCATION, or ALLOW_ONLY_INLINE_ALLOCATION
instead of WTF_MAKE_FAST_ALLOCATED(_WILL_BE_REMOVED) if possible.

BUG=523249

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

git-svn-id: svn://svn.chromium.org/blink/trunk@200988 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 6fb78300
...@@ -27,10 +27,12 @@ ...@@ -27,10 +27,12 @@
#define CompositionUnderline_h #define CompositionUnderline_h
#include "platform/graphics/Color.h" #include "platform/graphics/Color.h"
#include "wtf/Allocator.h"
namespace blink { namespace blink {
struct CompositionUnderline { struct CompositionUnderline {
ALLOW_ONLY_INLINE_ALLOCATION();
CompositionUnderline() CompositionUnderline()
: startOffset(0) : startOffset(0)
, endOffset(0) , endOffset(0)
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "core/editing/CompositionUnderline.h" #include "core/editing/CompositionUnderline.h"
#include "wtf/Allocator.h"
#include "wtf/NotFound.h" #include "wtf/NotFound.h"
#include "wtf/Vector.h" #include "wtf/Vector.h"
...@@ -16,9 +17,11 @@ namespace blink { ...@@ -16,9 +17,11 @@ namespace blink {
// underlines, visiting only elements that intersect with specified *inclusive* // underlines, visiting only elements that intersect with specified *inclusive*
// range [indexLo, indexHi]. // range [indexLo, indexHi].
class CORE_EXPORT CompositionUnderlineRangeFilter { class CORE_EXPORT CompositionUnderlineRangeFilter {
DISALLOW_ALLOCATION();
WTF_MAKE_NONCOPYABLE(CompositionUnderlineRangeFilter); WTF_MAKE_NONCOPYABLE(CompositionUnderlineRangeFilter);
public: public:
class ConstIterator { class ConstIterator {
DISALLOW_ALLOCATION();
public: public:
ConstIterator(): m_filter(nullptr), m_index(0) { } ConstIterator(): m_filter(nullptr), m_index(0) { }
const CompositionUnderline& operator*() const CompositionUnderline& operator*()
......
...@@ -23,12 +23,13 @@ ...@@ -23,12 +23,13 @@
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "core/editing/EditingBehaviorTypes.h" #include "core/editing/EditingBehaviorTypes.h"
#include "wtf/Allocator.h"
namespace blink { namespace blink {
class KeyboardEvent; class KeyboardEvent;
class CORE_EXPORT EditingBehavior { class CORE_EXPORT EditingBehavior {
STACK_ALLOCATED();
public: public:
explicit EditingBehavior(EditingBehaviorType type) explicit EditingBehavior(EditingBehaviorType type)
: m_type(type) : m_type(type)
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "core/dom/NodeTraversal.h" #include "core/dom/NodeTraversal.h"
#include "core/dom/shadow/ComposedTreeTraversal.h" #include "core/dom/shadow/ComposedTreeTraversal.h"
#include "wtf/Allocator.h"
namespace blink { namespace blink {
...@@ -20,6 +21,7 @@ class PositionIteratorAlgorithm; ...@@ -20,6 +21,7 @@ class PositionIteratorAlgorithm;
// Editing algorithm defined on node traversal. // Editing algorithm defined on node traversal.
template <typename Traversal> template <typename Traversal>
class CORE_TEMPLATE_CLASS_EXPORT EditingAlgorithm : public Traversal { class CORE_TEMPLATE_CLASS_EXPORT EditingAlgorithm : public Traversal {
STATIC_ONLY(EditingAlgorithm);
public: public:
static int caretMaxOffset(const Node&); static int caretMaxOffset(const Node&);
// TODO(yosin) We should make following functions to take |Node&| instead // TODO(yosin) We should make following functions to take |Node&| instead
......
...@@ -169,6 +169,7 @@ private: ...@@ -169,6 +169,7 @@ private:
}; };
class StyleChange { class StyleChange {
DISALLOW_ALLOCATION();
public: public:
StyleChange() StyleChange()
: m_applyBold(false) : m_applyBold(false)
......
...@@ -15,6 +15,7 @@ namespace blink { ...@@ -15,6 +15,7 @@ namespace blink {
class DummyPageHolder; class DummyPageHolder;
class EditingTestBase : public ::testing::Test { class EditingTestBase : public ::testing::Test {
WTF_MAKE_FAST_ALLOCATED(EditingTestBase);
protected: protected:
EditingTestBase(); EditingTestBase();
~EditingTestBase() override; ~EditingTestBase() override;
......
...@@ -60,6 +60,7 @@ enum EditorCommandSource { CommandFromMenuOrKeyBinding, CommandFromDOM }; ...@@ -60,6 +60,7 @@ enum EditorCommandSource { CommandFromMenuOrKeyBinding, CommandFromDOM };
enum EditorParagraphSeparator { EditorParagraphSeparatorIsDiv, EditorParagraphSeparatorIsP }; enum EditorParagraphSeparator { EditorParagraphSeparatorIsDiv, EditorParagraphSeparatorIsP };
class CORE_EXPORT Editor final : public NoBaseWillBeGarbageCollectedFinalized<Editor> { class CORE_EXPORT Editor final : public NoBaseWillBeGarbageCollectedFinalized<Editor> {
WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(Editor);
WTF_MAKE_NONCOPYABLE(Editor); WTF_MAKE_NONCOPYABLE(Editor);
public: public:
static PassOwnPtrWillBeRawPtr<Editor> create(LocalFrame&); static PassOwnPtrWillBeRawPtr<Editor> create(LocalFrame&);
......
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
#include "core/editing/SelectionStrategy.h" #include "core/editing/SelectionStrategy.h"
#include "core/editing/VisibleSelection.h" #include "core/editing/VisibleSelection.h"
#include "wtf/Allocator.h"
namespace blink { namespace blink {
class GranularityStrategy { class GranularityStrategy {
WTF_MAKE_FAST_ALLOCATED(GranularityStrategy);
public: public:
virtual ~GranularityStrategy(); virtual ~GranularityStrategy();
virtual SelectionStrategy GetType() const = 0; virtual SelectionStrategy GetType() const = 0;
......
...@@ -41,6 +41,7 @@ class Range; ...@@ -41,6 +41,7 @@ class Range;
class Text; class Text;
class CORE_EXPORT InputMethodController final : public NoBaseWillBeGarbageCollectedFinalized<InputMethodController> { class CORE_EXPORT InputMethodController final : public NoBaseWillBeGarbageCollectedFinalized<InputMethodController> {
WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(InputMethodController);
WTF_MAKE_NONCOPYABLE(InputMethodController); WTF_MAKE_NONCOPYABLE(InputMethodController);
public: public:
enum ConfirmCompositionBehavior { enum ConfirmCompositionBehavior {
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "core/editing/EphemeralRange.h" #include "core/editing/EphemeralRange.h"
#include "platform/heap/Handle.h" #include "platform/heap/Handle.h"
#include "wtf/Allocator.h"
#include "wtf/NotFound.h" #include "wtf/NotFound.h"
#include "wtf/PassRefPtr.h" #include "wtf/PassRefPtr.h"
...@@ -38,6 +39,7 @@ class ContainerNode; ...@@ -38,6 +39,7 @@ class ContainerNode;
class Range; class Range;
class CORE_EXPORT PlainTextRange { class CORE_EXPORT PlainTextRange {
STACK_ALLOCATED();
public: public:
PlainTextRange(); PlainTextRange();
PlainTextRange(const PlainTextRange&); PlainTextRange(const PlainTextRange&);
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "core/editing/Position.h" #include "core/editing/Position.h"
#include "core/layout/line/InlineBox.h" #include "core/layout/line/InlineBox.h"
#include "wtf/Allocator.h"
namespace blink { namespace blink {
...@@ -43,6 +44,7 @@ class VisiblePosition; ...@@ -43,6 +44,7 @@ class VisiblePosition;
struct CompositedSelectionBound; struct CompositedSelectionBound;
class RenderedPosition { class RenderedPosition {
STACK_ALLOCATED();
public: public:
RenderedPosition(); RenderedPosition();
explicit RenderedPosition(const VisiblePosition&); explicit RenderedPosition(const VisiblePosition&);
......
...@@ -41,6 +41,7 @@ namespace blink { ...@@ -41,6 +41,7 @@ namespace blink {
class Range; class Range;
class CORE_EXPORT SurroundingText { class CORE_EXPORT SurroundingText {
WTF_MAKE_FAST_ALLOCATED(SurroundingText);
WTF_MAKE_NONCOPYABLE(SurroundingText); WTF_MAKE_NONCOPYABLE(SurroundingText);
public: public:
SurroundingText(const Range&, unsigned maxLength); SurroundingText(const Range&, unsigned maxLength);
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "core/editing/TextGranularity.h" #include "core/editing/TextGranularity.h"
#include "core/editing/VisiblePosition.h" #include "core/editing/VisiblePosition.h"
#include "core/editing/VisibleUnits.h" #include "core/editing/VisibleUnits.h"
#include "wtf/Allocator.h"
namespace blink { namespace blink {
...@@ -48,6 +49,7 @@ class CORE_EXPORT VisibleSelection { ...@@ -48,6 +49,7 @@ class CORE_EXPORT VisibleSelection {
DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(VisibleSelection); DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(VisibleSelection);
public: public:
class InDOMTree { class InDOMTree {
STATIC_ONLY(InDOMTree);
public: public:
using PositionType = Position; using PositionType = Position;
using Strategy = EditingStrategy; using Strategy = EditingStrategy;
...@@ -65,6 +67,7 @@ public: ...@@ -65,6 +67,7 @@ public:
}; };
class InComposedTree { class InComposedTree {
STATIC_ONLY(InComposedTree);
public: public:
using PositionType = PositionInComposedTree; using PositionType = PositionInComposedTree;
using Strategy = EditingInComposedTreeStrategy; using Strategy = EditingInComposedTreeStrategy;
......
...@@ -41,6 +41,8 @@ class LocalFrame; ...@@ -41,6 +41,8 @@ class LocalFrame;
class UndoStep; class UndoStep;
class UndoStack final : public NoBaseWillBeGarbageCollected<UndoStack> { class UndoStack final : public NoBaseWillBeGarbageCollected<UndoStack> {
WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(UndoStack);
WTF_MAKE_NONCOPYABLE(UndoStack);
DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(UndoStack) DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(UndoStack)
public: public:
static PassOwnPtrWillBeRawPtr<UndoStack> create(); static PassOwnPtrWillBeRawPtr<UndoStack> create();
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#define BitStack_h #define BitStack_h
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "wtf/Allocator.h"
#include "wtf/Vector.h" #include "wtf/Vector.h"
namespace blink { namespace blink {
...@@ -34,6 +35,7 @@ namespace blink { ...@@ -34,6 +35,7 @@ namespace blink {
class Node; class Node;
class CORE_EXPORT BitStack { class CORE_EXPORT BitStack {
STACK_ALLOCATED();
public: public:
BitStack(); BitStack();
~BitStack(); ~BitStack();
......
...@@ -7,11 +7,13 @@ ...@@ -7,11 +7,13 @@
#include "core/editing/EditingStrategy.h" #include "core/editing/EditingStrategy.h"
#include "core/editing/iterators/BitStack.h" #include "core/editing/iterators/BitStack.h"
#include "wtf/Allocator.h"
namespace blink { namespace blink {
template<typename Strategy> template<typename Strategy>
class FullyClippedStateStackAlgorithm : public BitStack { class FullyClippedStateStackAlgorithm final : public BitStack {
STACK_ALLOCATED();
public: public:
FullyClippedStateStackAlgorithm(); FullyClippedStateStackAlgorithm();
~FullyClippedStateStackAlgorithm(); ~FullyClippedStateStackAlgorithm();
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "core/editing/EphemeralRange.h" #include "core/editing/EphemeralRange.h"
#include "core/editing/FindOptions.h" #include "core/editing/FindOptions.h"
#include "wtf/Allocator.h"
#include "wtf/Vector.h" #include "wtf/Vector.h"
namespace blink { namespace blink {
...@@ -41,6 +42,7 @@ namespace blink { ...@@ -41,6 +42,7 @@ namespace blink {
// inside a word are permitted if TreatMedialCapitalAsWordStart is specified as // inside a word are permitted if TreatMedialCapitalAsWordStart is specified as
// well. // well.
class SearchBuffer { class SearchBuffer {
STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(SearchBuffer); WTF_MAKE_NONCOPYABLE(SearchBuffer);
public: public:
SearchBuffer(const String& target, FindOptions); SearchBuffer(const String& target, FindOptions);
......
...@@ -44,6 +44,7 @@ class TextCheckingParagraph; ...@@ -44,6 +44,7 @@ class TextCheckingParagraph;
struct TextCheckingResult; struct TextCheckingResult;
class CORE_EXPORT SpellChecker final : public NoBaseWillBeGarbageCollectedFinalized<SpellChecker> { class CORE_EXPORT SpellChecker final : public NoBaseWillBeGarbageCollectedFinalized<SpellChecker> {
WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(SpellChecker);
WTF_MAKE_NONCOPYABLE(SpellChecker); WTF_MAKE_NONCOPYABLE(SpellChecker);
public: public:
static PassOwnPtrWillBeRawPtr<SpellChecker> create(LocalFrame&); static PassOwnPtrWillBeRawPtr<SpellChecker> create(LocalFrame&);
......
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