Commit 99cb6e65 authored by sigbjornf@opera.com's avatar sigbjornf@opera.com

Oilpan: make DataObject and SharedWorker heap Supplementables.

With heap supplement{able}s support now in place, follow up and turn
the supplements of these two into garbage allocated objects also.

R=haraken@chromium.org
BUG=340522

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

git-svn-id: svn://svn.chromium.org/blink/trunk@169733 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 931bfd79
......@@ -268,6 +268,9 @@ void DataObject::internalAddFileItem(PassRefPtrWillBeRawPtr<DataObjectItem> item
void DataObject::trace(Visitor* visitor)
{
visitor->trace(m_itemList);
#if ENABLE(OILPAN)
HeapSupplementable<DataObject>::trace(visitor);
#endif
}
} // namespace WebCore
......@@ -50,7 +50,8 @@ class SharedBuffer;
// A data object for holding data that would be in a clipboard or moved
// during a drag-n-drop operation. This is the data that WebCore is aware
// of and is not specific to a platform.
class DataObject : public RefCountedWillBeGarbageCollectedFinalized<DataObject>, public Supplementable<DataObject> {
class DataObject : public RefCountedWillBeGarbageCollectedFinalized<DataObject>, public WillBeHeapSupplementable<DataObject> {
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DataObject);
public:
static PassRefPtrWillBeRawPtr<DataObject> createFromPasteboard(PasteMode);
static PassRefPtrWillBeRawPtr<DataObject> create();
......@@ -95,7 +96,6 @@ public:
const String& filenameForNavigation() const { return m_filenameForNavigation; }
void setFilenameForNavigation(const String& filename) { m_filenameForNavigation = filename; }
// FIXME: oilpan: This trace() has to trace Supplementable.
void trace(Visitor*);
private:
......
......@@ -109,6 +109,9 @@ void SharedWorker::unsetPreventGC()
void SharedWorker::trace(Visitor* visitor)
{
AbstractWorker::trace(visitor);
#if ENABLE(OILPAN)
HeapSupplementable<SharedWorker>::trace(visitor);
#endif
}
} // namespace WebCore
......@@ -40,7 +40,8 @@ namespace WebCore {
class ExceptionState;
class SharedWorker FINAL : public AbstractWorker, public ScriptWrappable, public Supplementable<SharedWorker> {
class SharedWorker FINAL : public AbstractWorker, public ScriptWrappable, public WillBeHeapSupplementable<SharedWorker> {
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SharedWorker);
public:
static PassRefPtrWillBeRawPtr<SharedWorker> create(ExecutionContext*, const String& url, const String& name, ExceptionState&);
virtual ~SharedWorker();
......
......@@ -58,9 +58,19 @@ const char* DraggedIsolatedFileSystem::supplementName()
return "DraggedIsolatedFileSystem";
}
DraggedIsolatedFileSystem* DraggedIsolatedFileSystem::from(DataObject* dataObject)
{
return static_cast<DraggedIsolatedFileSystem*>(WillBeHeapSupplement<DataObject>::from(dataObject, supplementName()));
}
DraggedIsolatedFileSystem::DraggedIsolatedFileSystem(const String& filesystemId)
: m_filesystemId(filesystemId)
{
}
void DraggedIsolatedFileSystem::trace(Visitor* visitor)
{
visitor->trace(m_filesystem);
}
} // namespace WebCore
......@@ -32,6 +32,7 @@
#define DraggedIsolatedFileSystem_h
#include "core/clipboard/DataObject.h"
#include "heap/Handle.h"
#include "wtf/Forward.h"
#include "wtf/text/WTFString.h"
......@@ -39,24 +40,27 @@ namespace WebCore {
class DOMFileSystem;
class DraggedIsolatedFileSystem FINAL : public Supplement<DataObject> {
class DraggedIsolatedFileSystem FINAL : public NoBaseWillBeGarbageCollectedFinalized<DraggedIsolatedFileSystem>, public WillBeHeapSupplement<DataObject> {
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DraggedIsolatedFileSystem);
public:
virtual ~DraggedIsolatedFileSystem();
static PassOwnPtr<DraggedIsolatedFileSystem> create(const String& filesystemId)
static PassOwnPtrWillBeRawPtr<DraggedIsolatedFileSystem> create(const String& filesystemId)
{
return adoptPtr(new DraggedIsolatedFileSystem(filesystemId));
return adoptPtrWillBeNoop(new DraggedIsolatedFileSystem(filesystemId));
}
const String& filesystemId() const { return m_filesystemId; }
DOMFileSystem* getDOMFileSystem(ExecutionContext*);
static const char* supplementName();
static DraggedIsolatedFileSystem* from(DataObject* dataObject) { return static_cast<DraggedIsolatedFileSystem*>(Supplement<DataObject>::from(dataObject, supplementName())); }
static DraggedIsolatedFileSystem* from(DataObject*);
void trace(Visitor*);
private:
DraggedIsolatedFileSystem(const String& filesystemId);
RefPtr<DOMFileSystem> m_filesystem;
RefPtrWillBeMember<DOMFileSystem> m_filesystem;
String m_filesystemId;
};
......
......@@ -54,10 +54,10 @@ const char* SharedWorkerPerformance::supplementName()
SharedWorkerPerformance& SharedWorkerPerformance::from(SharedWorker& sharedWorker)
{
SharedWorkerPerformance* supplement = static_cast<SharedWorkerPerformance*>(Supplement<SharedWorker>::from(sharedWorker, supplementName()));
SharedWorkerPerformance* supplement = static_cast<SharedWorkerPerformance*>(WillBeHeapSupplement<SharedWorker>::from(sharedWorker, supplementName()));
if (!supplement) {
supplement = new SharedWorkerPerformance();
provideTo(sharedWorker, supplementName(), adoptPtr(supplement));
provideTo(sharedWorker, supplementName(), adoptPtrWillBeNoop(supplement));
}
return *supplement;
}
......
......@@ -30,6 +30,7 @@
#ifndef SharedWorkerPerformance_h
#define SharedWorkerPerformance_h
#include "heap/Handle.h"
#include "platform/Supplementable.h"
namespace WebCore {
......@@ -37,7 +38,8 @@ namespace WebCore {
class ExecutionContext;
class SharedWorker;
class SharedWorkerPerformance FINAL : public Supplement<SharedWorker> {
class SharedWorkerPerformance FINAL : public NoBaseWillBeGarbageCollected<SharedWorkerPerformance>, public WillBeHeapSupplement<SharedWorker> {
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SharedWorkerPerformance);
public:
virtual ~SharedWorkerPerformance();
static SharedWorkerPerformance& from(SharedWorker&);
......@@ -45,6 +47,8 @@ public:
static double workerStart(ExecutionContext*, SharedWorker&);
double getWorkerStart(ExecutionContext*, SharedWorker&) const;
void trace(Visitor*) { }
private:
explicit SharedWorkerPerformance();
static const char* supplementName();
......
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