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
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;
if (!getKey(key, v8Value))
......@@ -500,7 +500,7 @@ bool Dictionary::get(const String& key, RefPtrWillBeRawPtr<SpeechRecognitionResu
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;
if (!getKey(key, v8Value))
......@@ -660,7 +660,7 @@ bool Dictionary::convert(ConversionContext& context, const String& key, ArrayVal
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;
if (!getKey(key, v8Value))
......
......@@ -59,6 +59,7 @@ class TrackBase;
class VoidCallback;
class Dictionary {
ALLOW_ONLY_INLINE_ALLOCATION();
public:
Dictionary();
Dictionary(const v8::Handle<v8::Value>& options, v8::Isolate*);
......@@ -90,8 +91,8 @@ public:
bool get(const String&, RefPtr<MediaKeyError>&) const;
bool get(const String&, RefPtr<TrackBase>&) const;
bool get(const String&, RefPtr<SpeechRecognitionError>&) const;
bool get(const String&, RefPtrWillBeRawPtr<SpeechRecognitionResult>&) const;
bool get(const String&, RefPtrWillBeRawPtr<SpeechRecognitionResultList>&) const;
bool get(const String&, RefPtrWillBeMember<SpeechRecognitionResult>&) const;
bool get(const String&, RefPtrWillBeMember<SpeechRecognitionResultList>&) const;
bool get(const String&, RefPtrWillBeMember<Gamepad>&) const;
bool get(const String&, RefPtr<MediaStream>&) const;
bool get(const String&, RefPtr<EventTarget>&) const;
......@@ -99,7 +100,7 @@ public:
bool get(const String&, Dictionary&) const;
bool get(const String&, Vector<String>&) 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&, v8::Local<v8::Value>&) const;
......@@ -178,13 +179,7 @@ public:
bool hasProperty(const String&) const;
// Only allow inline allocation.
void* operator new(size_t, NotNullTag, void* location) { return location; }
private:
// Disallow new allocation.
void* operator new(size_t);
bool getKey(const String& key, v8::Local<v8::Value>&) const;
v8::Handle<v8::Value> m_options;
......
......@@ -93,7 +93,7 @@ public:
CSSValue* second() const { return item(1); }
size_t length() const { return m_list ? m_list->length() : 0; }
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.
......
......@@ -5328,13 +5328,13 @@ public:
CSSPropertyID property;
CSSPropertyParser* m_parser;
RefPtrWillBeRawPtr<CSSValueList> values;
RefPtrWillBeRawPtr<CSSPrimitiveValue> x;
RefPtrWillBeRawPtr<CSSPrimitiveValue> y;
RefPtrWillBeRawPtr<CSSPrimitiveValue> blur;
RefPtrWillBeRawPtr<CSSPrimitiveValue> spread;
RefPtrWillBeRawPtr<CSSPrimitiveValue> style;
RefPtrWillBeRawPtr<CSSPrimitiveValue> color;
RefPtrWillBeMember<CSSValueList> values;
RefPtrWillBeMember<CSSPrimitiveValue> x;
RefPtrWillBeMember<CSSPrimitiveValue> y;
RefPtrWillBeMember<CSSPrimitiveValue> blur;
RefPtrWillBeMember<CSSPrimitiveValue> spread;
RefPtrWillBeMember<CSSPrimitiveValue> style;
RefPtrWillBeMember<CSSPrimitiveValue> color;
bool allowX;
bool allowY;
......@@ -5844,10 +5844,10 @@ private:
bool m_allowFill;
bool m_allowFinalCommit;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left;
RefPtrWillBeMember<CSSPrimitiveValue> m_top;
RefPtrWillBeMember<CSSPrimitiveValue> m_right;
RefPtrWillBeMember<CSSPrimitiveValue> m_bottom;
RefPtrWillBeMember<CSSPrimitiveValue> m_left;
bool m_fill;
};
......@@ -5961,10 +5961,10 @@ private:
bool m_allowNumber;
bool m_allowFinalCommit;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom;
RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left;
RefPtrWillBeMember<CSSPrimitiveValue> m_top;
RefPtrWillBeMember<CSSPrimitiveValue> m_right;
RefPtrWillBeMember<CSSPrimitiveValue> m_bottom;
RefPtrWillBeMember<CSSPrimitiveValue> m_left;
};
bool CSSPropertyParser::parseBorderImageQuad(Units validUnits, RefPtrWillBeRawPtr<CSSPrimitiveValue>& result)
......
......@@ -382,7 +382,7 @@ private:
int m_inParseShorthand;
CSSPropertyID m_currentShorthand;
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
// classes w/o needing to make them friends.
......
......@@ -99,7 +99,7 @@ public:
// Stores value=propertySet.getPropertyCSSValue(id).get().
CSSPropertyValue(CSSPropertyID, const StylePropertySet&);
CSSPropertyID property;
CSSValue* value;
RawPtrWillBeMember<CSSValue> value;
};
// 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
, m_parentStyle(parentStyle)
, m_applyPropertyToRegularStyle(true)
, m_applyPropertyToVisitedLinkStyle(false)
, m_lineHeightValue(0)
, m_lineHeightValue(nullptr)
, m_styleMap(*this, m_elementStyleResources)
, m_currentRule(0)
, m_currentRule(nullptr)
{
if (!parentStyle && m_elementContext.parentNode())
m_parentStyle = m_elementContext.parentNode()->renderStyle();
......
......@@ -42,8 +42,8 @@ class FontDescription;
class StyleRule;
class StyleResolverState {
STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(StyleResolverState);
STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(StyleResolverState);
public:
StyleResolverState(Document&, Element*, RenderStyle* parentStyle = 0);
~StyleResolverState();
......@@ -158,7 +158,7 @@ private:
bool m_applyPropertyToRegularStyle;
bool m_applyPropertyToVisitedLinkStyle;
CSSValue* m_lineHeightValue;
RawPtrWillBeMember<CSSValue> m_lineHeightValue;
FontBuilder m_fontBuilder;
......@@ -170,7 +170,7 @@ private:
CSSToStyleMap m_styleMap;
Vector<AtomicString> m_contentAttrValues;
StyleRule* m_currentRule;
RawPtrWillBeMember<StyleRule> m_currentRule;
};
} // namespace WebCore
......
......@@ -54,7 +54,7 @@ struct HelperResultType {
DISALLOW_ALLOCATION();
public:
typedef PassRefPtrWillBeRawPtr<ResultType> ReturnType;
typedef RefPtrWillBeRawPtr<ResultType> StorageType;
typedef RefPtrWillBeMember<ResultType> StorageType;
static ReturnType createFromCallbackArg(CallbackArg argument)
{
......@@ -154,7 +154,7 @@ private:
bool m_completed;
};
struct EmptyType : public RefCounted<EmptyType> {
struct EmptyType : public RefCountedWillBeGarbageCollected<EmptyType> {
static PassRefPtrWillBeRawPtr<EmptyType> create(EmptyType*)
{
return nullptr;
......
......@@ -38,12 +38,11 @@ namespace WebCore {
class Document;
class SpeechRecognitionEventInit : public EventInit {
DISALLOW_ALLOCATION();
public:
SpeechRecognitionEventInit();
unsigned long resultIndex;
RefPtrWillBeRawPtr<SpeechRecognitionResultList> results;
RefPtrWillBeMember<SpeechRecognitionResultList> results;
};
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