提交 6b828261 编写于 作者: E Eric Seidel

Remove various Heap* types.

Also removed a bunch of trace() methods which
I touched by accident.  Turns out they're
all very interconnected sadly.

I re-wrote Supplement to not use templates
in an earlier version of this patch
but hit some trouble with vtables
and decided to table that work
for a later time once more of oilpan
has been unwound.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/683703003
上级 e9e27699
......@@ -101,11 +101,4 @@ bool CSSCanvasValue::equals(const CSSCanvasValue& other) const
return m_name == other.m_name;
}
void CSSCanvasValue::traceAfterDispatch(Visitor* visitor)
{
visitor->trace(m_canvasObserver);
visitor->trace(m_element);
CSSImageGeneratorValue::traceAfterDispatch(visitor);
}
} // namespace blink
......@@ -52,8 +52,6 @@ public:
bool equals(const CSSCanvasValue&) const;
void traceAfterDispatch(Visitor*);
private:
explicit CSSCanvasValue(const String& name)
: CSSImageGeneratorValue(CanvasClass)
......@@ -84,11 +82,6 @@ private:
m_ownerValue->canvasDestroyed(canvas);
}
#endif
virtual void trace(Visitor* visitor) override
{
visitor->trace(m_ownerValue);
CanvasObserver::trace(visitor);
}
private:
RawPtr<CSSCanvasValue> m_ownerValue;
......
......@@ -271,11 +271,6 @@ DocumentVisibilityObserver::~DocumentVisibilityObserver()
#endif
}
void DocumentVisibilityObserver::trace(Visitor* visitor)
{
visitor->trace(m_document);
}
void DocumentVisibilityObserver::unregisterObserver()
{
if (m_document) {
......@@ -3177,48 +3172,6 @@ v8::Handle<v8::Object> Document::wrap(v8::Handle<v8::Object> creationContext, v8
return wrapper;
}
void Document::trace(Visitor* visitor)
{
#if ENABLE(OILPAN)
visitor->trace(m_importsController);
visitor->trace(m_implementation);
visitor->trace(m_autofocusElement);
visitor->trace(m_focusedElement);
visitor->trace(m_hoverNode);
visitor->trace(m_activeHoverElement);
visitor->trace(m_documentElement);
visitor->trace(m_titleElement);
visitor->trace(m_markers);
visitor->trace(m_currentScriptStack);
visitor->trace(m_cssCanvasElements);
visitor->trace(m_elemSheet);
visitor->trace(m_ranges);
visitor->trace(m_styleEngine);
visitor->trace(m_domWindow);
visitor->trace(m_fetcher);
visitor->trace(m_parser);
visitor->trace(m_styleSheetList);
visitor->trace(m_mediaQueryMatcher);
visitor->trace(m_scriptedAnimationController);
visitor->trace(m_registrationContext);
visitor->trace(m_customElementMicrotaskRunQueue);
visitor->trace(m_elementDataCache);
visitor->trace(m_templateDocument);
visitor->trace(m_templateDocumentHost);
visitor->trace(m_visibilityObservers);
visitor->trace(m_userActionElements);
visitor->trace(m_timeline);
visitor->trace(m_compositorPendingAnimations);
visitor->trace(m_contextDocument);
visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this);
#endif
DocumentSupplementable::trace(visitor);
TreeScope::trace(visitor);
ContainerNode::trace(visitor);
ExecutionContext::trace(visitor);
LifecycleContext<Document>::trace(visitor);
}
} // namespace blink
#ifndef NDEBUG
......
......@@ -160,9 +160,6 @@ public:
// DocumentVisibilityObserver::setDocument
void setObservedDocument(Document&);
protected:
virtual void trace(Visitor*);
private:
void registerObserver(Document&);
void unregisterObserver();
......@@ -655,8 +652,6 @@ public:
void updateStyleInvalidationIfNeeded();
virtual void trace(Visitor*) override;
void didRecalculateStyleForElement() { ++m_styleRecalcElementCounter; }
virtual v8::Handle<v8::Object> wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*) override;
......
......@@ -49,10 +49,6 @@ public:
, m_callStack(callStack)
{
}
void trace(Visitor* visitor)
{
visitor->trace(m_callStack);
}
String m_errorMessage;
int m_lineNumber;
int m_columnNumber;
......@@ -248,13 +244,4 @@ bool ExecutionContext::isIteratingOverObservers() const
return m_lifecycleNotifier && m_lifecycleNotifier->isIteratingOverObservers();
}
void ExecutionContext::trace(Visitor* visitor)
{
#if ENABLE(OILPAN)
visitor->trace(m_pendingExceptions);
#endif
Supplementable<ExecutionContext>::trace(visitor);
LifecycleContext<ExecutionContext>::trace(visitor);
}
} // namespace blink
......@@ -55,8 +55,6 @@ class ExecutionContext
: public LifecycleContext<ExecutionContext>
, public Supplementable<ExecutionContext> {
public:
virtual void trace(Visitor*) override;
// Delegating to ExecutionContextClient
bool isDocument() const { return m_client && m_client->isDocument(); }
const KURL& url() const;
......
......@@ -56,18 +56,8 @@ MemoryCache* memoryCache()
PassOwnPtr<MemoryCache> replaceMemoryCacheForTesting(PassOwnPtr<MemoryCache> cache)
{
#if ENABLE(OILPAN)
// Move m_liveResources content to keep Resource objects alive.
for (HeapHashSet<Member<Resource> >::iterator i = memoryCache()->m_liveResources.begin();
i != memoryCache()->m_liveResources.end();
++i) {
cache->m_liveResources.add(*i);
}
memoryCache()->m_liveResources.clear();
#else
// Make sure we have non-empty gMemoryCache.
memoryCache();
#endif
OwnPtr<MemoryCache> oldCache = gMemoryCache->release();
*gMemoryCache = cache;
return oldCache.release();
......
......@@ -277,15 +277,6 @@ private:
typedef HashMap<String, OwnPtr<MemoryCacheEntry> > ResourceMap;
ResourceMap m_resources;
#if ENABLE(OILPAN)
// Unlike m_allResources, m_liveResources is a set of Resource objects which
// should not be deleted. m_allResources only contains on-cache Resource
// objects.
// FIXME: Can we remove manual lifetime management of Resource and this?
HeapHashSet<Member<Resource> > m_liveResources;
friend RawPtr<MemoryCache> replaceMemoryCacheForTesting(RawPtr<MemoryCache>);
#endif
friend class MemoryCacheTest;
#ifdef MEMORY_CACHE_STATS
Timer<MemoryCache> m_statsTimer;
......
......@@ -816,19 +816,4 @@ PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > LocalDOMWindow::createLifecycleNo
return DOMWindowLifecycleNotifier::create(this);
}
void LocalDOMWindow::trace(Visitor* visitor)
{
visitor->trace(m_document);
visitor->trace(m_screen);
visitor->trace(m_history);
visitor->trace(m_console);
visitor->trace(m_location);
visitor->trace(m_media);
visitor->trace(m_css);
visitor->trace(m_eventQueue);
Supplementable<LocalDOMWindow>::trace(visitor);
EventTargetWithInlineData::trace(visitor);
LifecycleContext<LocalDOMWindow>::trace(visitor);
}
} // namespace blink
......@@ -208,8 +208,6 @@ public:
void acceptLanguagesChanged();
virtual void trace(Visitor*) override;
protected:
DOMWindowLifecycleNotifier& lifecycleNotifier();
......
......@@ -101,9 +101,4 @@ unsigned Screen::availWidth() const
return static_cast<unsigned>(screenAvailableRect(m_frame->view()).width());
}
void Screen::trace(Visitor* visitor)
{
Supplementable<Screen>::trace(visitor);
}
} // namespace blink
......@@ -59,8 +59,6 @@ public:
unsigned availHeight() const;
unsigned availWidth() const;
void trace(Visitor*);
private:
explicit Screen(LocalFrame*);
};
......
......@@ -542,16 +542,6 @@ void HTMLCanvasElement::notifySurfaceInvalid()
}
}
void HTMLCanvasElement::trace(Visitor* visitor)
{
#if ENABLE(OILPAN)
visitor->trace(m_observers);
visitor->trace(m_context);
#endif
DocumentVisibilityObserver::trace(visitor);
HTMLElement::trace(visitor);
}
void HTMLCanvasElement::updateExternallyAllocatedMemory() const
{
int bufferCount = 0;
......
......@@ -65,8 +65,6 @@ public:
#if !ENABLE(OILPAN)
virtual void canvasDestroyed(HTMLCanvasElement*) = 0;
#endif
virtual void trace(Visitor*) { }
};
class HTMLCanvasElement final : public HTMLElement, public DocumentVisibilityObserver, public CanvasImageSource, public ImageBufferClient {
......@@ -150,8 +148,6 @@ public:
virtual bool isDirty() override { return !m_dirtyRect.isEmpty(); }
virtual void didFinalizeFrame() override;
virtual void trace(Visitor*) override;
protected:
virtual void didMoveToNewDocument(Document& oldDocument) override;
......
......@@ -2424,16 +2424,4 @@ void HTMLMediaElement::defaultEventHandler(Event* event)
HTMLElement::defaultEventHandler(event);
}
void HTMLMediaElement::trace(Visitor* visitor)
{
visitor->trace(m_playedTimeRanges);
visitor->trace(m_asyncEventQueue);
visitor->trace(m_error);
visitor->trace(m_currentSourceNode);
visitor->trace(m_nextChildNodeToConsider);
visitor->trace(m_mediaSource);
Supplementable<HTMLMediaElement>::trace(visitor);
HTMLElement::trace(visitor);
}
}
......@@ -62,8 +62,6 @@ class HTMLMediaElement : public HTMLElement, public Supplementable<HTMLMediaElem
public:
static blink::WebMimeRegistry::SupportsType supportsType(const ContentType&, const String& keySystem = String());
virtual void trace(Visitor*) override;
// Do not use player().
// FIXME: Replace all uses with webMediaPlayer() and remove this API.
MediaPlayer* player() const { return m_player.get(); }
......
......@@ -61,12 +61,6 @@ PassRefPtr<HTMLVideoElement> HTMLVideoElement::create(Document& document)
return video.release();
}
void HTMLVideoElement::trace(Visitor* visitor)
{
visitor->trace(m_imageLoader);
HTMLMediaElement::trace(visitor);
}
bool HTMLVideoElement::rendererIsNeeded(const RenderStyle& style)
{
return HTMLElement::rendererIsNeeded(style);
......
......@@ -50,7 +50,6 @@ class HTMLVideoElement final : public HTMLMediaElement, public CanvasImageSource
DEFINE_WRAPPERTYPEINFO();
public:
static PassRefPtr<HTMLVideoElement> create(Document&);
virtual void trace(Visitor*) override;
unsigned videoWidth() const;
unsigned videoHeight() const;
......
......@@ -157,11 +157,4 @@ Document* HTMLImportsController::loaderDocumentAt(size_t i) const
return loaderAt(i)->document();
}
void HTMLImportsController::trace(Visitor* visitor)
{
visitor->trace(m_root);
visitor->trace(m_loaders);
DocumentSupplement::trace(visitor);
}
} // namespace blink
......@@ -76,8 +76,6 @@ public:
Document* loaderDocumentAt(size_t) const;
HTMLImportLoader* loaderFor(const Document&) const;
virtual void trace(Visitor*);
private:
HTMLImportChild* createChild(const KURL&, HTMLImportLoader*, HTMLImport* parent, HTMLImportChildClient*);
......
......@@ -14,40 +14,6 @@
namespace blink {
#if ENABLE(OILPAN)
typedef HeapHashMap<WeakMember<Node>, int> NodeToIdMap;
typedef HeapHashMap<int, WeakMember<Node> > IdToNodeMap;
static NodeToIdMap& nodeToIdMap()
{
DEFINE_STATIC_LOCAL(Persistent<NodeToIdMap>, nodeToIdMap, (new NodeToIdMap()));
return *nodeToIdMap;
}
static IdToNodeMap& idToNodeMap()
{
DEFINE_STATIC_LOCAL(Persistent<IdToNodeMap>, idToNodeMap, (new IdToNodeMap()));
return *idToNodeMap;
}
int InspectorNodeIds::idForNode(Node* node)
{
static int s_nextNodeId = 1;
NodeToIdMap::iterator it = nodeToIdMap().find(node);
if (it != nodeToIdMap().end())
return it->value;
int id = s_nextNodeId++;
nodeToIdMap().set(node, id);
ASSERT(idToNodeMap().find(id) == idToNodeMap().end());
idToNodeMap().set(id, node);
return id;
}
Node* InspectorNodeIds::nodeForId(int id)
{
return idToNodeMap().get(id);
}
#else
static WeakNodeMap& nodeIds()
{
DEFINE_STATIC_LOCAL(WeakNodeMap, self, ());
......@@ -70,6 +36,5 @@ Node* InspectorNodeIds::nodeForId(int id)
{
return nodeIds().node(id);
}
#endif
}
......@@ -359,18 +359,6 @@ PassOwnPtr<LifecycleNotifier<Page> > Page::createLifecycleNotifier()
return PageLifecycleNotifier::create(this);
}
void Page::trace(Visitor* visitor)
{
#if ENABLE(OILPAN)
visitor->trace(m_dragCaretController);
visitor->trace(m_undoStack);
visitor->trace(m_multisamplingChangedObservers);
visitor->trace(m_frameHost);
#endif
Supplementable<Page>::trace(visitor);
LifecycleContext<Page>::trace(visitor);
}
void Page::willBeDestroyed()
{
RefPtr<LocalFrame> mainFrame = m_mainFrame;
......
......@@ -162,7 +162,6 @@ public:
static void networkStateChanged(bool online);
PassOwnPtr<LifecycleNotifier<Page> > createLifecycleNotifier();
void trace(Visitor*);
void willBeDestroyed();
protected:
......
......@@ -55,8 +55,6 @@ public:
// Called from the destructor of observers.
void wasUnobservedBy(Observer*);
virtual void trace(Visitor*) { }
protected:
Notifier& lifecycleNotifier();
......
......@@ -49,8 +49,6 @@ public:
#endif
ThisType* wrapped() const { return m_wrapped.get(); }
virtual void trace(Visitor*) override { }
private:
RefPtr<ThisType> m_wrapped;
......
......@@ -97,12 +97,6 @@ class SupplementableBase;
template<typename T, bool isGarbageCollected>
struct SupplementableTraits;
template<typename T>
struct SupplementableTraits<T, true> {
typedef RawPtr<SupplementBase<T, true> > SupplementArgumentType;
typedef HeapHashMap<const char*, Member<SupplementBase<T, true> >, PtrHash<const char*> > SupplementMap;
};
template<typename T>
struct SupplementableTraits<T, false> {
typedef PassOwnPtr<SupplementBase<T, false> > SupplementArgumentType;
......@@ -112,14 +106,10 @@ struct SupplementableTraits<T, false> {
template<bool>
class SupplementTracing;
template<>
class SupplementTracing<true> : public GarbageCollectedMixin { };
template<>
class SupplementTracing<false> {
public:
virtual ~SupplementTracing() { }
virtual void trace(Visitor*) { }
};
template<typename T, bool isGarbageCollected = false>
......@@ -196,21 +186,6 @@ private:
#endif
};
// This class is used to make an on-heap class supplementable. Its supplements
// must be HeapSupplement.
template<typename T>
class HeapSupplement : public SupplementBase<T, true> { };
// FIXME: Oilpan: Move GarbageCollectedMixin to SupplementableBase<T, true> once PersistentHeapSupplementable is removed again.
template<typename T>
class GC_PLUGIN_IGNORE("http://crbug.com/395036") HeapSupplementable : public SupplementableBase<T, true>, public GarbageCollectedMixin {
public:
virtual void trace(Visitor* visitor) override
{
visitor->trace(this->m_supplements);
SupplementableBase<T, true>::trace(visitor);
}
};
template<typename T>
class Supplement : public SupplementBase<T, false> { };
......@@ -219,20 +194,6 @@ class Supplement : public SupplementBase<T, false> { };
// supplements (Supplement).
template<typename T>
class GC_PLUGIN_IGNORE("http://crbug.com/395036") Supplementable : public SupplementableBase<T, false> {
public:
virtual void trace(Visitor* visitor)
{
}
};
template<typename T>
struct ThreadingTrait<SupplementBase<T, true> > {
static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity;
};
template<typename T>
struct ThreadingTrait<SupplementableBase<T, true> > {
static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity;
};
} // namespace blink
......
......@@ -606,30 +606,6 @@ template <typename T> struct VectorTraits<blink::WeakMember<T> > : VectorTraitsB
static const bool canMoveWithMemcpy = true;
};
template <typename T> struct VectorTraits<blink::HeapVector<T, 0> > : VectorTraitsBase<blink::HeapVector<T, 0> > {
static const bool needsDestruction = false;
static const bool canInitializeWithMemset = true;
static const bool canMoveWithMemcpy = true;
};
template <typename T> struct VectorTraits<blink::HeapDeque<T, 0> > : VectorTraitsBase<blink::HeapDeque<T, 0> > {
static const bool needsDestruction = false;
static const bool canInitializeWithMemset = true;
static const bool canMoveWithMemcpy = true;
};
template <typename T, size_t inlineCapacity> struct VectorTraits<blink::HeapVector<T, inlineCapacity> > : VectorTraitsBase<blink::HeapVector<T, inlineCapacity> > {
static const bool needsDestruction = VectorTraits<T>::needsDestruction;
static const bool canInitializeWithMemset = VectorTraits<T>::canInitializeWithMemset;
static const bool canMoveWithMemcpy = VectorTraits<T>::canMoveWithMemcpy;
};
template <typename T, size_t inlineCapacity> struct VectorTraits<blink::HeapDeque<T, inlineCapacity> > : VectorTraitsBase<blink::HeapDeque<T, inlineCapacity> > {
static const bool needsDestruction = VectorTraits<T>::needsDestruction;
static const bool canInitializeWithMemset = VectorTraits<T>::canInitializeWithMemset;
static const bool canMoveWithMemcpy = VectorTraits<T>::canMoveWithMemcpy;
};
template<typename T> struct HashTraits<blink::Member<T> > : SimpleClassHashTraits<blink::Member<T> > {
static const bool needsDestruction = false;
// FIXME: The distinction between PeekInType and PassInType is there for
......@@ -741,14 +717,6 @@ template<typename T> inline T* getPtr(const blink::Persistent<T>& p)
return p.get();
}
template<typename T, size_t inlineCapacity>
struct NeedsTracing<ListHashSetNode<T, blink::HeapListHashSetAllocator<T, inlineCapacity> > *> {
// All heap allocated node pointers need visiting to keep the nodes alive,
// regardless of whether they contain pointers to other heap allocated
// objects.
static const bool value = true;
};
// For wtf/Functional.h
template<typename T, bool isGarbageCollected> struct PointerParamStorageTraits;
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册