Commit 048e5748 authored by zerny@chromium.org's avatar zerny@chromium.org

Replace raw pointers to GC allocated objects by members in stack allocated objects.

R=haraken@chromium.org
BUG=

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

git-svn-id: svn://svn.chromium.org/blink/trunk@169847 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 2534eb35
...@@ -490,7 +490,7 @@ bool Dictionary::get(const String& key, RefPtr<SpeechRecognitionError>& value) c ...@@ -490,7 +490,7 @@ bool Dictionary::get(const String& key, RefPtr<SpeechRecognitionError>& value) c
return true; return true;
} }
bool Dictionary::get(const String& key, RefPtrWillBeRawPtr<SpeechRecognitionResult>& value) const bool Dictionary::get(const String& key, RefPtrWillBeMember<SpeechRecognitionResult>& value) const
{ {
v8::Local<v8::Value> v8Value; v8::Local<v8::Value> v8Value;
if (!getKey(key, v8Value)) if (!getKey(key, v8Value))
...@@ -500,7 +500,7 @@ bool Dictionary::get(const String& key, RefPtrWillBeRawPtr<SpeechRecognitionResu ...@@ -500,7 +500,7 @@ bool Dictionary::get(const String& key, RefPtrWillBeRawPtr<SpeechRecognitionResu
return true; return true;
} }
bool Dictionary::get(const String& key, RefPtrWillBeRawPtr<SpeechRecognitionResultList>& value) const bool Dictionary::get(const String& key, RefPtrWillBeMember<SpeechRecognitionResultList>& value) const
{ {
v8::Local<v8::Value> v8Value; v8::Local<v8::Value> v8Value;
if (!getKey(key, v8Value)) if (!getKey(key, v8Value))
...@@ -660,7 +660,7 @@ bool Dictionary::convert(ConversionContext& context, const String& key, ArrayVal ...@@ -660,7 +660,7 @@ bool Dictionary::convert(ConversionContext& context, const String& key, ArrayVal
return get(key, value); return get(key, value);
} }
bool Dictionary::get(const String& key, RefPtrWillBeRawPtr<DOMError>& value) const bool Dictionary::get(const String& key, RefPtrWillBeMember<DOMError>& value) const
{ {
v8::Local<v8::Value> v8Value; v8::Local<v8::Value> v8Value;
if (!getKey(key, v8Value)) if (!getKey(key, v8Value))
......
...@@ -59,6 +59,7 @@ class TrackBase; ...@@ -59,6 +59,7 @@ class TrackBase;
class VoidCallback; class VoidCallback;
class Dictionary { class Dictionary {
ALLOW_ONLY_INLINE_ALLOCATION();
public: public:
Dictionary(); Dictionary();
Dictionary(const v8::Handle<v8::Value>& options, v8::Isolate*); Dictionary(const v8::Handle<v8::Value>& options, v8::Isolate*);
...@@ -90,8 +91,8 @@ public: ...@@ -90,8 +91,8 @@ public:
bool get(const String&, RefPtr<MediaKeyError>&) const; bool get(const String&, RefPtr<MediaKeyError>&) const;
bool get(const String&, RefPtr<TrackBase>&) const; bool get(const String&, RefPtr<TrackBase>&) const;
bool get(const String&, RefPtr<SpeechRecognitionError>&) const; bool get(const String&, RefPtr<SpeechRecognitionError>&) const;
bool get(const String&, RefPtrWillBeRawPtr<SpeechRecognitionResult>&) const; bool get(const String&, RefPtrWillBeMember<SpeechRecognitionResult>&) const;
bool get(const String&, RefPtrWillBeRawPtr<SpeechRecognitionResultList>&) const; bool get(const String&, RefPtrWillBeMember<SpeechRecognitionResultList>&) const;
bool get(const String&, RefPtrWillBeMember<Gamepad>&) const; bool get(const String&, RefPtrWillBeMember<Gamepad>&) const;
bool get(const String&, RefPtr<MediaStream>&) const; bool get(const String&, RefPtr<MediaStream>&) const;
bool get(const String&, RefPtr<EventTarget>&) const; bool get(const String&, RefPtr<EventTarget>&) const;
...@@ -99,7 +100,7 @@ public: ...@@ -99,7 +100,7 @@ public:
bool get(const String&, Dictionary&) const; bool get(const String&, Dictionary&) const;
bool get(const String&, Vector<String>&) const; bool get(const String&, Vector<String>&) const;
bool get(const String&, ArrayValue&) const; bool get(const String&, ArrayValue&) const;
bool get(const String&, RefPtrWillBeRawPtr<DOMError>&) const; bool get(const String&, RefPtrWillBeMember<DOMError>&) const;
bool get(const String&, OwnPtr<VoidCallback>&) const; bool get(const String&, OwnPtr<VoidCallback>&) const;
bool get(const String&, v8::Local<v8::Value>&) const; bool get(const String&, v8::Local<v8::Value>&) const;
...@@ -178,13 +179,7 @@ public: ...@@ -178,13 +179,7 @@ public:
bool hasProperty(const String&) const; bool hasProperty(const String&) const;
// Only allow inline allocation.
void* operator new(size_t, NotNullTag, void* location) { return location; }
private: private:
// Disallow new allocation.
void* operator new(size_t);
bool getKey(const String& key, v8::Local<v8::Value>&) const; bool getKey(const String& key, v8::Local<v8::Value>&) const;
v8::Handle<v8::Value> m_options; v8::Handle<v8::Value> m_options;
......
...@@ -93,7 +93,7 @@ public: ...@@ -93,7 +93,7 @@ public:
CSSValue* second() const { return item(1); } CSSValue* second() const { return item(1); }
size_t length() const { return m_list ? m_list->length() : 0; } size_t length() const { return m_list ? m_list->length() : 0; }
private: private:
CSSValueList* m_list; RawPtrWillBeMember<CSSValueList> m_list;
}; };
// Wrapper that can be used to iterate over any CSSValue. Non-list values and 0 behave as zero-length lists. // Wrapper that can be used to iterate over any CSSValue. Non-list values and 0 behave as zero-length lists.
......
...@@ -5328,13 +5328,13 @@ public: ...@@ -5328,13 +5328,13 @@ public:
CSSPropertyID property; CSSPropertyID property;
CSSPropertyParser* m_parser; CSSPropertyParser* m_parser;
RefPtrWillBeRawPtr<CSSValueList> values; RefPtrWillBeMember<CSSValueList> values;
RefPtrWillBeRawPtr<CSSPrimitiveValue> x; RefPtrWillBeMember<CSSPrimitiveValue> x;
RefPtrWillBeRawPtr<CSSPrimitiveValue> y; RefPtrWillBeMember<CSSPrimitiveValue> y;
RefPtrWillBeRawPtr<CSSPrimitiveValue> blur; RefPtrWillBeMember<CSSPrimitiveValue> blur;
RefPtrWillBeRawPtr<CSSPrimitiveValue> spread; RefPtrWillBeMember<CSSPrimitiveValue> spread;
RefPtrWillBeRawPtr<CSSPrimitiveValue> style; RefPtrWillBeMember<CSSPrimitiveValue> style;
RefPtrWillBeRawPtr<CSSPrimitiveValue> color; RefPtrWillBeMember<CSSPrimitiveValue> color;
bool allowX; bool allowX;
bool allowY; bool allowY;
...@@ -5844,10 +5844,10 @@ private: ...@@ -5844,10 +5844,10 @@ private:
bool m_allowFill; bool m_allowFill;
bool m_allowFinalCommit; bool m_allowFinalCommit;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top; RefPtrWillBeMember<CSSPrimitiveValue> m_top;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right; RefPtrWillBeMember<CSSPrimitiveValue> m_right;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom; RefPtrWillBeMember<CSSPrimitiveValue> m_bottom;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left; RefPtrWillBeMember<CSSPrimitiveValue> m_left;
bool m_fill; bool m_fill;
}; };
...@@ -5961,10 +5961,10 @@ private: ...@@ -5961,10 +5961,10 @@ private:
bool m_allowNumber; bool m_allowNumber;
bool m_allowFinalCommit; bool m_allowFinalCommit;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top; RefPtrWillBeMember<CSSPrimitiveValue> m_top;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right; RefPtrWillBeMember<CSSPrimitiveValue> m_right;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom; RefPtrWillBeMember<CSSPrimitiveValue> m_bottom;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left; RefPtrWillBeMember<CSSPrimitiveValue> m_left;
}; };
bool CSSPropertyParser::parseBorderImageQuad(Units validUnits, RefPtrWillBeRawPtr<CSSPrimitiveValue>& result) bool CSSPropertyParser::parseBorderImageQuad(Units validUnits, RefPtrWillBeRawPtr<CSSPrimitiveValue>& result)
......
...@@ -382,7 +382,7 @@ private: ...@@ -382,7 +382,7 @@ private:
int m_inParseShorthand; int m_inParseShorthand;
CSSPropertyID m_currentShorthand; CSSPropertyID m_currentShorthand;
bool m_implicitShorthand; bool m_implicitShorthand;
RefPtrWillBeRawPtr<CSSCalcValue> m_parsedCalculation; RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation;
// FIXME: There is probably a small set of APIs we could expose for these // FIXME: There is probably a small set of APIs we could expose for these
// classes w/o needing to make them friends. // classes w/o needing to make them friends.
......
...@@ -99,7 +99,7 @@ public: ...@@ -99,7 +99,7 @@ public:
// Stores value=propertySet.getPropertyCSSValue(id).get(). // Stores value=propertySet.getPropertyCSSValue(id).get().
CSSPropertyValue(CSSPropertyID, const StylePropertySet&); CSSPropertyValue(CSSPropertyID, const StylePropertySet&);
CSSPropertyID property; CSSPropertyID property;
CSSValue* value; RawPtrWillBeMember<CSSValue> value;
}; };
// This class selects a RenderStyle for a given element based on a collection of stylesheets. // This class selects a RenderStyle for a given element based on a collection of stylesheets.
......
...@@ -37,9 +37,9 @@ StyleResolverState::StyleResolverState(Document& document, Element* element, Ren ...@@ -37,9 +37,9 @@ StyleResolverState::StyleResolverState(Document& document, Element* element, Ren
, m_parentStyle(parentStyle) , m_parentStyle(parentStyle)
, m_applyPropertyToRegularStyle(true) , m_applyPropertyToRegularStyle(true)
, m_applyPropertyToVisitedLinkStyle(false) , m_applyPropertyToVisitedLinkStyle(false)
, m_lineHeightValue(0) , m_lineHeightValue(nullptr)
, m_styleMap(*this, m_elementStyleResources) , m_styleMap(*this, m_elementStyleResources)
, m_currentRule(0) , m_currentRule(nullptr)
{ {
if (!parentStyle && m_elementContext.parentNode()) if (!parentStyle && m_elementContext.parentNode())
m_parentStyle = m_elementContext.parentNode()->renderStyle(); m_parentStyle = m_elementContext.parentNode()->renderStyle();
......
...@@ -42,8 +42,8 @@ class FontDescription; ...@@ -42,8 +42,8 @@ class FontDescription;
class StyleRule; class StyleRule;
class StyleResolverState { class StyleResolverState {
STACK_ALLOCATED(); STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(StyleResolverState); WTF_MAKE_NONCOPYABLE(StyleResolverState);
public: public:
StyleResolverState(Document&, Element*, RenderStyle* parentStyle = 0); StyleResolverState(Document&, Element*, RenderStyle* parentStyle = 0);
~StyleResolverState(); ~StyleResolverState();
...@@ -158,7 +158,7 @@ private: ...@@ -158,7 +158,7 @@ private:
bool m_applyPropertyToRegularStyle; bool m_applyPropertyToRegularStyle;
bool m_applyPropertyToVisitedLinkStyle; bool m_applyPropertyToVisitedLinkStyle;
CSSValue* m_lineHeightValue; RawPtrWillBeMember<CSSValue> m_lineHeightValue;
FontBuilder m_fontBuilder; FontBuilder m_fontBuilder;
...@@ -170,7 +170,7 @@ private: ...@@ -170,7 +170,7 @@ private:
CSSToStyleMap m_styleMap; CSSToStyleMap m_styleMap;
Vector<AtomicString> m_contentAttrValues; Vector<AtomicString> m_contentAttrValues;
StyleRule* m_currentRule; RawPtrWillBeMember<StyleRule> m_currentRule;
}; };
} // namespace WebCore } // namespace WebCore
......
...@@ -54,7 +54,7 @@ struct HelperResultType { ...@@ -54,7 +54,7 @@ struct HelperResultType {
DISALLOW_ALLOCATION(); DISALLOW_ALLOCATION();
public: public:
typedef PassRefPtrWillBeRawPtr<ResultType> ReturnType; typedef PassRefPtrWillBeRawPtr<ResultType> ReturnType;
typedef RefPtrWillBeRawPtr<ResultType> StorageType; typedef RefPtrWillBeMember<ResultType> StorageType;
static ReturnType createFromCallbackArg(CallbackArg argument) static ReturnType createFromCallbackArg(CallbackArg argument)
{ {
...@@ -154,7 +154,7 @@ private: ...@@ -154,7 +154,7 @@ private:
bool m_completed; bool m_completed;
}; };
struct EmptyType : public RefCounted<EmptyType> { struct EmptyType : public RefCountedWillBeGarbageCollected<EmptyType> {
static PassRefPtrWillBeRawPtr<EmptyType> create(EmptyType*) static PassRefPtrWillBeRawPtr<EmptyType> create(EmptyType*)
{ {
return nullptr; return nullptr;
......
...@@ -38,12 +38,11 @@ namespace WebCore { ...@@ -38,12 +38,11 @@ namespace WebCore {
class Document; class Document;
class SpeechRecognitionEventInit : public EventInit { class SpeechRecognitionEventInit : public EventInit {
DISALLOW_ALLOCATION();
public: public:
SpeechRecognitionEventInit(); SpeechRecognitionEventInit();
unsigned long resultIndex; unsigned long resultIndex;
RefPtrWillBeRawPtr<SpeechRecognitionResultList> results; RefPtrWillBeMember<SpeechRecognitionResultList> results;
}; };
class SpeechRecognitionEvent FINAL : public Event { class SpeechRecognitionEvent FINAL : public Event {
......
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