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