https://bugs.webkit.org/show_bug.cgi?id=149156
Reviewed by Darin Adler.
* inspector/DOMEditor.cpp:
(WebCore::DOMEditor::InsertBeforeAction::InsertBeforeAction):
(WebCore::DOMEditor::ReplaceChildNodeAction::ReplaceChildNodeAction):
(WebCore::DOMEditor::insertBefore):
(WebCore::DOMEditor::replaceChild):
* inspector/DOMEditor.h:
* inspector/DOMPatchSupport.cpp:
(WebCore::DOMPatchSupport::removeChildAndMoveToNew):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::highlightSelector):
* inspector/InspectorDatabaseAgent.cpp:
(WebCore::InspectorDatabaseAgent::didOpenDatabase):
* inspector/InspectorDatabaseAgent.h:
* inspector/InspectorDatabaseInstrumentation.h:
* inspector/InspectorDatabaseResource.h:
(WebCore::InspectorDatabaseResource::setDatabase):
* inspector/InspectorFrontendHost.cpp:
(WebCore::FrontendMenuProvider::create):
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didOpenDatabaseImpl):
* inspector/InspectorLayerTreeAgent.h:
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::highlightNodeList):
* inspector/InspectorOverlay.h:
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::sharedBufferContent):
* inspector/InspectorPageAgent.h:
* inspector/InspectorResourceAgent.cpp:
* inspector/InspectorTimelineAgent.cpp:
(WebCore::startProfiling):
(WebCore::stopProfiling):
(WebCore::InspectorTimelineAgent::stopFromConsole):
* inspector/InspectorTimelineAgent.h:
* inspector/InspectorWorkerResource.h:
(WebCore::InspectorWorkerResource::create):
* inspector/InstrumentingAgents.h:
* inspector/NetworkResourcesData.cpp:
(WebCore::createOtherResourceTextDecoder):
(WebCore::NetworkResourcesData::addResourceSharedBuffer):
* inspector/NetworkResourcesData.h:
* inspector/TimelineRecordFactory.cpp:
(WebCore::createQuad):
* inspector/WebInjectedScriptHost.h:
* inspector/WebInjectedScriptManager.cpp:
(WebCore::WebInjectedScriptManager::WebInjectedScriptManager):
* inspector/WebInjectedScriptManager.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189905
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-09-16 Gyuyoung Kim <gyuyoung.kim@webkit.org>
+
+ Remove all uses of PassRefPtr in WebCore/inspector
+ https://bugs.webkit.org/show_bug.cgi?id=149156
+
+ Reviewed by Darin Adler.
+
+ * inspector/DOMEditor.cpp:
+ (WebCore::DOMEditor::InsertBeforeAction::InsertBeforeAction):
+ (WebCore::DOMEditor::ReplaceChildNodeAction::ReplaceChildNodeAction):
+ (WebCore::DOMEditor::insertBefore):
+ (WebCore::DOMEditor::replaceChild):
+ * inspector/DOMEditor.h:
+ * inspector/DOMPatchSupport.cpp:
+ (WebCore::DOMPatchSupport::removeChildAndMoveToNew):
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::highlightSelector):
+ * inspector/InspectorDatabaseAgent.cpp:
+ (WebCore::InspectorDatabaseAgent::didOpenDatabase):
+ * inspector/InspectorDatabaseAgent.h:
+ * inspector/InspectorDatabaseInstrumentation.h:
+ * inspector/InspectorDatabaseResource.h:
+ (WebCore::InspectorDatabaseResource::setDatabase):
+ * inspector/InspectorFrontendHost.cpp:
+ (WebCore::FrontendMenuProvider::create):
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::didOpenDatabaseImpl):
+ * inspector/InspectorLayerTreeAgent.h:
+ * inspector/InspectorOverlay.cpp:
+ (WebCore::InspectorOverlay::highlightNodeList):
+ * inspector/InspectorOverlay.h:
+ * inspector/InspectorPageAgent.cpp:
+ (WebCore::InspectorPageAgent::sharedBufferContent):
+ * inspector/InspectorPageAgent.h:
+ * inspector/InspectorResourceAgent.cpp:
+ * inspector/InspectorTimelineAgent.cpp:
+ (WebCore::startProfiling):
+ (WebCore::stopProfiling):
+ (WebCore::InspectorTimelineAgent::stopFromConsole):
+ * inspector/InspectorTimelineAgent.h:
+ * inspector/InspectorWorkerResource.h:
+ (WebCore::InspectorWorkerResource::create):
+ * inspector/InstrumentingAgents.h:
+ * inspector/NetworkResourcesData.cpp:
+ (WebCore::createOtherResourceTextDecoder):
+ (WebCore::NetworkResourcesData::addResourceSharedBuffer):
+ * inspector/NetworkResourcesData.h:
+ * inspector/TimelineRecordFactory.cpp:
+ (WebCore::createQuad):
+ * inspector/WebInjectedScriptHost.h:
+ * inspector/WebInjectedScriptManager.cpp:
+ (WebCore::WebInjectedScriptManager::WebInjectedScriptManager):
+ * inspector/WebInjectedScriptManager.h:
+
2015-09-16 Brady Eidson <beidson@apple.com>
Have window.indexedDB.open return an IDBOpenDBRequest.
class DOMEditor::InsertBeforeAction : public InspectorHistory::Action {
WTF_MAKE_NONCOPYABLE(InsertBeforeAction);
public:
- InsertBeforeAction(Node* parentNode, PassRefPtr<Node> node, Node* anchorNode)
+ InsertBeforeAction(Node* parentNode, RefPtr<Node>&& node, Node* anchorNode)
: InspectorHistory::Action("InsertBefore")
, m_parentNode(parentNode)
- , m_node(node)
+ , m_node(WTF::move(node))
, m_anchorNode(anchorNode)
{
}
class DOMEditor::ReplaceChildNodeAction : public InspectorHistory::Action {
WTF_MAKE_NONCOPYABLE(ReplaceChildNodeAction);
public:
- ReplaceChildNodeAction(Node* parentNode, PassRefPtr<Node> newNode, Node* oldNode)
+ ReplaceChildNodeAction(Node* parentNode, RefPtr<Node>&& newNode, Node* oldNode)
: InspectorHistory::Action("ReplaceChildNode")
, m_parentNode(parentNode)
- , m_newNode(newNode)
+ , m_newNode(WTF::move(newNode))
, m_oldNode(oldNode)
{
}
DOMEditor::~DOMEditor() { }
-bool DOMEditor::insertBefore(Node* parentNode, PassRefPtr<Node> node, Node* anchorNode, ExceptionCode& ec)
+bool DOMEditor::insertBefore(Node* parentNode, RefPtr<Node>&& node, Node* anchorNode, ExceptionCode& ec)
{
- return m_history->perform(std::make_unique<InsertBeforeAction>(parentNode, node, anchorNode), ec);
+ return m_history->perform(std::make_unique<InsertBeforeAction>(parentNode, WTF::move(node), anchorNode), ec);
}
bool DOMEditor::removeChild(Node* parentNode, Node* node, ExceptionCode& ec)
return m_history->perform(std::make_unique<ReplaceWholeTextAction>(textNode, text), ec);
}
-bool DOMEditor::replaceChild(Node* parentNode, PassRefPtr<Node> newNode, Node* oldNode, ExceptionCode& ec)
+bool DOMEditor::replaceChild(Node* parentNode, RefPtr<Node>&& newNode, Node* oldNode, ExceptionCode& ec)
{
- return m_history->perform(std::make_unique<ReplaceChildNodeAction>(parentNode, newNode, oldNode), ec);
+ return m_history->perform(std::make_unique<ReplaceChildNodeAction>(parentNode, WTF::move(newNode), oldNode), ec);
}
bool DOMEditor::setNodeValue(Node* node, const String& value, ExceptionCode& ec)
}
}
-bool DOMEditor::insertBefore(Node* parentNode, PassRefPtr<Node> node, Node* anchorNode, ErrorString& errorString)
+bool DOMEditor::insertBefore(Node* parentNode, RefPtr<Node>&& node, Node* anchorNode, ErrorString& errorString)
{
ExceptionCode ec = 0;
- bool result = insertBefore(parentNode, node, anchorNode, ec);
+ bool result = insertBefore(parentNode, WTF::move(node), anchorNode, ec);
populateErrorString(ec, errorString);
return result;
}
explicit DOMEditor(InspectorHistory*);
~DOMEditor();
- bool insertBefore(Node* parentNode, PassRefPtr<Node>, Node* anchorNode, ExceptionCode&);
+ bool insertBefore(Node* parentNode, RefPtr<Node>&&, Node* anchorNode, ExceptionCode&);
bool removeChild(Node* parentNode, Node*, ExceptionCode&);
bool setAttribute(Element*, const String& name, const String& value, ExceptionCode&);
bool removeAttribute(Element*, const String& name, ExceptionCode&);
bool setOuterHTML(Node&, const String& html, Node** newNode, ExceptionCode&);
bool replaceWholeText(Text*, const String& text, ExceptionCode&);
- bool replaceChild(Node* parentNode, PassRefPtr<Node> newNode, Node* oldNode, ExceptionCode&);
+ bool replaceChild(Node* parentNode, RefPtr<Node>&& newNode, Node* oldNode, ExceptionCode&);
bool setNodeValue(Node* parentNode, const String& value, ExceptionCode&);
- bool insertBefore(Node* parentNode, PassRefPtr<Node>, Node* anchorNode, ErrorString&);
+ bool insertBefore(Node* parentNode, RefPtr<Node>&&, Node* anchorNode, ErrorString&);
bool removeChild(Node* parentNode, Node*, ErrorString&);
bool setAttribute(Element*, const String& name, const String& value, ErrorString&);
bool removeAttribute(Element*, const String& name, ErrorString&);
if (it != m_unusedNodesMap.end()) {
Digest* newDigest = it->value;
Node* newNode = newDigest->m_node;
- if (!m_domEditor->replaceChild(newNode->parentNode(), oldNode, newNode, ec))
+ if (!m_domEditor->replaceChild(newNode->parentNode(), WTF::move(oldNode), newNode, ec))
return false;
newDigest->m_node = oldNode.get();
markNodeAsUsed(newDigest);
if (!highlightConfig)
return;
- m_overlay->highlightNodeList(nodes, *highlightConfig);
+ m_overlay->highlightNodeList(WTF::move(nodes), *highlightConfig);
}
void InspectorDOMAgent::highlightNode(ErrorString& errorString, const InspectorObject& highlightInspectorObject, const int* nodeId, const String* objectId)
} // namespace
-void InspectorDatabaseAgent::didOpenDatabase(PassRefPtr<Database> database, const String& domain, const String& name, const String& version)
+void InspectorDatabaseAgent::didOpenDatabase(RefPtr<Database>&& database, const String& domain, const String& name, const String& version)
{
if (InspectorDatabaseResource* resource = findByFileName(database->fileName())) {
- resource->setDatabase(database);
+ resource->setDatabase(WTF::move(database));
return;
}
- RefPtr<InspectorDatabaseResource> resource = InspectorDatabaseResource::create(database, domain, name, version);
+ RefPtr<InspectorDatabaseResource> resource = InspectorDatabaseResource::create(WTF::move(database), domain, name, version);
m_resources.set(resource->id(), resource);
// Resources are only bound while visible.
if (m_enabled)
// Called from the injected script.
String databaseId(Database*);
- void didOpenDatabase(PassRefPtr<Database>, const String& domain, const String& name, const String& version);
+ void didOpenDatabase(RefPtr<Database>&&, const String& domain, const String& name, const String& version);
private:
Database* databaseForId(const String& databaseId);
InspectorDatabaseResource* findByFileName(const String& fileName);
#include "Database.h"
#include "InspectorInstrumentation.h"
-#include <wtf/PassRefPtr.h>
namespace WebCore {
void bind(Inspector::DatabaseFrontendDispatcher*);
Database* database() { return m_database.get(); }
- void setDatabase(RefPtr<Database>&& database) { m_database = database; }
+ void setDatabase(RefPtr<Database>&& database) { m_database = WTF::move(database); }
String id() const { return m_id; }
private:
#if ENABLE(CONTEXT_MENUS)
class FrontendMenuProvider : public ContextMenuProvider {
public:
- static PassRefPtr<FrontendMenuProvider> create(InspectorFrontendHost* frontendHost, Deprecated::ScriptObject frontendApiObject, const Vector<ContextMenuItem>& items)
+ static Ref<FrontendMenuProvider> create(InspectorFrontendHost* frontendHost, Deprecated::ScriptObject frontendApiObject, const Vector<ContextMenuItem>& items)
{
- return adoptRef(new FrontendMenuProvider(frontendHost, frontendApiObject, items));
+ return adoptRef(*new FrontendMenuProvider(frontendHost, frontendApiObject, items));
}
void disconnect()
if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled())
return;
if (InspectorDatabaseAgent* dbAgent = instrumentingAgents.inspectorDatabaseAgent())
- dbAgent->didOpenDatabase(database, domain, name, version);
+ dbAgent->didOpenDatabase(WTF::move(database), domain, name, version);
}
void InspectorInstrumentation::didDispatchDOMStorageEventImpl(InstrumentingAgents& instrumentingAgents, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page)
#include <inspector/InspectorFrontendDispatchers.h>
#include <inspector/InspectorProtocolObjects.h>
#include "RenderLayer.h"
-#include <wtf/PassRefPtr.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
update();
}
-void InspectorOverlay::highlightNodeList(PassRefPtr<NodeList> nodes, const HighlightConfig& highlightConfig)
+void InspectorOverlay::highlightNodeList(RefPtr<NodeList>&& nodes, const HighlightConfig& highlightConfig)
{
m_nodeHighlightConfig = highlightConfig;
- m_highlightNodeList = nodes;
+ m_highlightNodeList = WTF::move(nodes);
m_highlightNode = nullptr;
update();
}
void setPausedInDebuggerMessage(const String*);
void hideHighlight();
- void highlightNodeList(PassRefPtr<NodeList>, const HighlightConfig&);
+ void highlightNodeList(RefPtr<NodeList>&&, const HighlightConfig&);
void highlightNode(Node*, const HighlightConfig&);
void highlightQuad(std::unique_ptr<FloatQuad>, const HighlightConfig&);
}
// static
-bool InspectorPageAgent::sharedBufferContent(PassRefPtr<SharedBuffer> buffer, const String& textEncodingName, bool withBase64Encode, String* result)
+bool InspectorPageAgent::sharedBufferContent(RefPtr<SharedBuffer>&& buffer, const String& textEncodingName, bool withBase64Encode, String* result)
{
return dataContent(buffer ? buffer->data() : nullptr, buffer ? buffer->size() : 0, textEncodingName, withBase64Encode, result);
}
};
static bool cachedResourceContent(CachedResource*, String* result, bool* base64Encoded);
- static bool sharedBufferContent(PassRefPtr<SharedBuffer>, const String& textEncodingName, bool withBase64Encode, String* result);
+ static bool sharedBufferContent(RefPtr<SharedBuffer>&&, const String& textEncodingName, bool withBase64Encode, String* result);
static void resourceContent(ErrorString&, Frame*, const URL&, String* result, bool* base64Encoded);
static String sourceMapURLForResource(CachedResource*);
class InspectorThreadableLoaderClient final : public ThreadableLoaderClient {
WTF_MAKE_NONCOPYABLE(InspectorThreadableLoaderClient);
public:
- InspectorThreadableLoaderClient(PassRefPtr<LoadResourceCallback> callback)
- : m_callback(callback) { }
+ InspectorThreadableLoaderClient(RefPtr<LoadResourceCallback>&& callback)
+ : m_callback(WTF::move(callback)) { }
virtual ~InspectorThreadableLoaderClient() { }
dispose();
}
- void setLoader(PassRefPtr<ThreadableLoader> loader)
+ void setLoader(RefPtr<ThreadableLoader>&& loader)
{
- m_loader = loader;
+ m_loader = WTF::move(loader);
}
private:
m_scriptDebugServer = scriptDebugServer;
}
-static inline void startProfiling(JSC::ExecState* exec, const String& title, PassRefPtr<Stopwatch> stopwatch)
+static inline void startProfiling(JSC::ExecState* exec, const String& title, RefPtr<Stopwatch>&& stopwatch)
{
- JSC::LegacyProfiler::profiler()->startProfiling(exec, title, stopwatch);
+ JSC::LegacyProfiler::profiler()->startProfiling(exec, title, WTF::move(stopwatch));
}
-static inline PassRefPtr<JSC::Profile> stopProfiling(JSC::ExecState* exec, const String& title)
+static inline RefPtr<JSC::Profile> stopProfiling(JSC::ExecState* exec, const String& title)
{
return JSC::LegacyProfiler::profiler()->stopProfiling(exec, title);
}
-static inline void startProfiling(Frame* frame, const String& title, PassRefPtr<Stopwatch> stopwatch)
+static inline void startProfiling(Frame* frame, const String& title, RefPtr<Stopwatch>&& stopwatch)
{
- startProfiling(toJSDOMWindow(frame, debuggerWorld())->globalExec(), title, stopwatch);
+ startProfiling(toJSDOMWindow(frame, debuggerWorld())->globalExec(), title, WTF::move(stopwatch));
}
static inline PassRefPtr<JSC::Profile> stopProfiling(Frame* frame, const String& title)
m_pendingConsoleProfileRecords.append(createRecordEntry(TimelineRecordFactory::createConsoleProfileData(title), TimelineRecordType::ConsoleProfile, true, frameFromExecState(exec)));
}
-PassRefPtr<JSC::Profile> InspectorTimelineAgent::stopFromConsole(JSC::ExecState* exec, const String& title)
+RefPtr<JSC::Profile> InspectorTimelineAgent::stopFromConsole(JSC::ExecState* exec, const String& title)
{
// Stop profiles in reverse order. If the title is empty, then stop the last profile.
// Otherwise, match the title of the profile to stop.
// Methods called from WebCore.
void startFromConsole(JSC::ExecState*, const String &title);
- PassRefPtr<JSC::Profile> stopFromConsole(JSC::ExecState*, const String& title);
+ RefPtr<JSC::Profile> stopFromConsole(JSC::ExecState*, const String& title);
// InspectorInstrumentation callbacks.
void didInstallTimer(int timerId, int timeout, bool singleShot, Frame*);
struct TimelineRecordEntry {
TimelineRecordEntry()
: type(TimelineRecordType::EventDispatch) { }
- TimelineRecordEntry(PassRefPtr<Inspector::InspectorObject> record, PassRefPtr<Inspector::InspectorObject> data, PassRefPtr<Inspector::InspectorArray> children, TimelineRecordType type)
- : record(record), data(data), children(children), type(type)
+ TimelineRecordEntry(RefPtr<Inspector::InspectorObject>&& record, RefPtr<Inspector::InspectorObject>&& data, RefPtr<Inspector::InspectorArray>&& children, TimelineRecordType type)
+ : record(WTF::move(record))
+ , data(WTF::move(data))
+ , children(WTF::move(children))
+ , type(type)
{
}
#ifndef InspectorWorkerResource_h
#define InspectorWorkerResource_h
-#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/text/WTFString.h>
class InspectorWorkerResource : public RefCounted<InspectorWorkerResource> {
public:
- static PassRefPtr<InspectorWorkerResource> create(intptr_t id, const String& url, bool isSharedWorker)
+ static Ref<InspectorWorkerResource> create(intptr_t id, const String& url, bool isSharedWorker)
{
- return adoptRef(new InspectorWorkerResource(id, url, isSharedWorker));
+ return adoptRef(*new InspectorWorkerResource(id, url, isSharedWorker));
}
intptr_t id() const { return m_id; }
#include <inspector/InspectorEnvironment.h>
#include <wtf/FastMalloc.h>
#include <wtf/Noncopyable.h>
-#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
namespace Inspector {
m_requestIdToResourceDataMap.set(requestId, new ResourceData(requestId, loaderId));
}
-static PassRefPtr<TextResourceDecoder> createOtherResourceTextDecoder(const String& mimeType, const String& textEncodingName)
+static RefPtr<TextResourceDecoder> createOtherResourceTextDecoder(const String& mimeType, const String& textEncodingName)
{
RefPtr<TextResourceDecoder> decoder;
if (!textEncodingName.isEmpty())
resourceData->setCachedResource(cachedResource);
}
-void NetworkResourcesData::addResourceSharedBuffer(const String& requestId, PassRefPtr<SharedBuffer> buffer, const String& textEncodingName)
+void NetworkResourcesData::addResourceSharedBuffer(const String& requestId, RefPtr<SharedBuffer>&& buffer, const String& textEncodingName)
{
ResourceData* resourceData = resourceDataForRequestId(requestId);
if (!resourceData)
return;
- resourceData->setBuffer(buffer);
+ resourceData->setBuffer(WTF::move(buffer));
resourceData->setTextEncodingName(textEncodingName);
}
void maybeAddResourceData(const String& requestId, const char* data, size_t dataLength);
void maybeDecodeDataToContent(const String& requestId);
void addCachedResource(const String& requestId, CachedResource*);
- void addResourceSharedBuffer(const String& requestId, PassRefPtr<SharedBuffer>, const String& textEncodingName);
+ void addResourceSharedBuffer(const String& requestId, RefPtr<SharedBuffer>&&, const String& textEncodingName);
ResourceData const* data(const String& requestId);
Vector<String> removeCachedResource(CachedResource*);
void clear(const String& preservedLoaderId = String());
return WTF::move(data);
}
-static PassRefPtr<InspectorArray> createQuad(const FloatQuad& quad)
+static Ref<InspectorArray> createQuad(const FloatQuad& quad)
{
- RefPtr<InspectorArray> array = InspectorArray::create();
+ Ref<InspectorArray> array = InspectorArray::create();
array->pushDouble(quad.p1().x());
array->pushDouble(quad.p1().y());
array->pushDouble(quad.p2().x());
class WebInjectedScriptHost final : public Inspector::InjectedScriptHost {
public:
- static PassRefPtr<WebInjectedScriptHost> create() { return adoptRef(new WebInjectedScriptHost); }
+ static Ref<WebInjectedScriptHost> create() { return adoptRef(*new WebInjectedScriptHost); }
virtual JSC::JSValue subtype(JSC::ExecState*, JSC::JSValue) override;
virtual bool isHTMLAllCollection(JSC::JSValue) override;
namespace WebCore {
-WebInjectedScriptManager::WebInjectedScriptManager(InspectorEnvironment& environment, PassRefPtr<InjectedScriptHost> host)
- : InjectedScriptManager(environment, host)
+WebInjectedScriptManager::WebInjectedScriptManager(InspectorEnvironment& environment, RefPtr<InjectedScriptHost>&& host)
+ : InjectedScriptManager(environment, WTF::move(host))
, m_commandLineAPIHost(CommandLineAPIHost::create())
{
}
class WebInjectedScriptManager final : public Inspector::InjectedScriptManager {
public:
- WebInjectedScriptManager(Inspector::InspectorEnvironment&, PassRefPtr<Inspector::InjectedScriptHost>);
+ WebInjectedScriptManager(Inspector::InspectorEnvironment&, RefPtr<Inspector::InjectedScriptHost>&&);
virtual ~WebInjectedScriptManager() { }
CommandLineAPIHost* commandLineAPIHost() const { return m_commandLineAPIHost.get(); }