Commit c5e54cd2 authored by andersca@apple.com's avatar andersca@apple.com

Get rid of more uses of OwnPtr and PassOwnPtr

https://bugs.webkit.org/show_bug.cgi?id=122136

Reviewed by Antti Koivisto.

Source/WebCore:

* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::didReceiveBinaryData):
* WebCore.exp.in:
* fileapi/Blob.cpp:
(WebCore::Blob::Blob):
(WebCore::Blob::slice):
* fileapi/Blob.h:
(WebCore::Blob::create):
* fileapi/File.cpp:
(WebCore::createBlobDataForFileWithType):
(WebCore::createBlobDataForFile):
(WebCore::createBlobDataForFileWithName):
* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::BlobRegistryContext::BlobRegistryContext):
(WebCore::registerBlobURLTask):
(WebCore::ThreadableBlobRegistry::registerBlobURL):
* fileapi/ThreadableBlobRegistry.h:
* fileapi/WebKitBlobBuilder.cpp:
(WebCore::BlobBuilder::getBlob):
* platform/network/BlobData.cpp:
(WebCore::BlobDataHandle::BlobDataHandle):
* platform/network/BlobData.h:
(WebCore::BlobData::BlobData):
(WebCore::BlobDataHandle::create):
* platform/network/BlobRegistry.h:
* platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::registerBlobURL):
* platform/network/BlobRegistryImpl.h:
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::responseBlob):

Source/WebKit2:

* NetworkProcess/AsynchronousNetworkLoaderClient.h:
* NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
(WebKit::NetworkBlobRegistry::registerBlobURL):
* NetworkProcess/FileAPI/NetworkBlobRegistry.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::NetworkResourceLoader):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/SynchronousNetworkLoaderClient.h:
* NetworkProcess/mac/RemoteNetworkingContext.mm:
* Platform/CoreIPC/ArgumentDecoder.h:
* Platform/CoreIPC/ArgumentEncoder.h:
* Platform/CoreIPC/MessageDecoder.cpp:
(CoreIPC::MessageDecoder::setImportanceAssertion):
* Platform/CoreIPC/MessageDecoder.h:
* Platform/CoreIPC/mac/ConnectionMac.cpp:
(CoreIPC::Connection::receiveSourceEventHandler):
* Platform/CoreIPC/mac/ImportanceAssertion.h:
(CoreIPC::ImportanceAssertion::ImportanceAssertion):
* Platform/mac/LayerHostingContext.h:
* Platform/mac/LayerHostingContext.mm:
(WebKit::LayerHostingContext::createForPort):
(WebKit::LayerHostingContext::createForWindowServer):
* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::paint):
* PluginProcess/PluginControllerProxy.h:
* PluginProcess/WebProcessConnection.cpp:
(WebKit::WebProcessConnection::addPluginControllerProxy):
(WebKit::WebProcessConnection::removePluginControllerProxy):
(WebKit::WebProcessConnection::createPluginInternal):
* PluginProcess/WebProcessConnection.h:
* Shared/API/c/cg/WKImageCG.cpp:
(WKImageCreateFromCGImage):
* Shared/BlockingResponseMap.h:
(BlockingResponseMap::waitForResponse):
(BlockingResponseMap::didReceiveResponse):
* Shared/Downloads/Download.cpp:
* Shared/Downloads/Download.h:
* Shared/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::startDownload):
(WebKit::DownloadManager::convertHandleToDownload):
* Shared/FileAPI/BlobRegistrationData.cpp:
(WebKit::BlobRegistrationData::BlobRegistrationData):
(WebKit::BlobRegistrationData::releaseData):
(WebKit::BlobRegistrationData::decode):
* Shared/FileAPI/BlobRegistrationData.h:
* Shared/Plugins/NPObjectMessageReceiver.cpp:
* Shared/Plugins/NPObjectMessageReceiver.h:
* Shared/Plugins/NPRemoteObjectMap.cpp:
(WebKit::NPRemoteObjectMap::registerNPObject):
* Shared/Plugins/Netscape/NetscapePluginModule.cpp:
(WebKit::NetscapePluginModule::tryLoad):
* Shared/Plugins/Netscape/NetscapePluginModule.h:
* Shared/ShareableBitmap.h:
* Shared/WebURL.h:
(WebKit::WebURL::create):
(WebKit::WebURL::WebURL):
(WebKit::WebURL::parseURLIfNecessary):
* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::ShareableBitmap::createGraphicsContext):
(WebKit::ShareableBitmap::makeCGImageCopy):
* Shared/mac/SecItemShim.cpp:
(WebKit::sendSecItemRequest):
(WebKit::webSecItemCopyMatching):
(WebKit::webSecItemAdd):
(WebKit::webSecItemUpdate):
(WebKit::webSecItemDelete):
(WebKit::SecItemShim::secItemResponse):
* UIProcess/API/mac/FindIndicatorWindow.h:
* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::createDrawingAreaProxy):
* UIProcess/API/mac/WKView.mm:
(-[WKView std::WebKit::]):
(-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/BackingStore.cpp:
* UIProcess/BackingStore.h:
* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::incorporateUpdate):
* UIProcess/DrawingAreaProxyImpl.h:
* UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
* WebProcess/FileAPI/BlobRegistryProxy.cpp:
(WebKit::BlobRegistryProxy::registerBlobURL):
* WebProcess/FileAPI/BlobRegistryProxy.h:
* WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
* WebProcess/InjectedBundle/API/c/mac/WKBundlePageBannerMac.mm:
(WKBundlePageBannerCreateBannerWithCALayer):
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
(WebKit::imageForRect):
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::scheduleTimer):
(WebKit::NetscapePlugin::unscheduleTimer):
(WebKit::NetscapePlugin::snapshot):
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::snapshot):
* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::paint):
(WebKit::PluginProxy::update):
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::convertImageToBitmap):
* WebProcess/WebPage/DrawingArea.cpp:
(WebKit::DrawingArea::create):
* WebProcess/WebPage/DrawingArea.h:
* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::display):
* WebProcess/WebPage/DrawingAreaImpl.h:
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::getFindIndicatorBitmapAndRect):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::createWithCoreMainFrame):
(WebKit::WebFrame::createSubframe):
(WebKit::WebFrame::create):
(WebKit::WebFrame::WebFrame):
* WebProcess/WebPage/WebFrame.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::scaledSnapshotWithOptions):
(WebKit::WebPage::drawRectToImage):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/LayerTreeHostMac.h:
* WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
* WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156688 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b9dc6e50
2013-09-30 Anders Carlsson <andersca@apple.com>
Get rid of more uses of OwnPtr and PassOwnPtr
https://bugs.webkit.org/show_bug.cgi?id=122136
Reviewed by Antti Koivisto.
* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::didReceiveBinaryData):
* WebCore.exp.in:
* fileapi/Blob.cpp:
(WebCore::Blob::Blob):
(WebCore::Blob::slice):
* fileapi/Blob.h:
(WebCore::Blob::create):
* fileapi/File.cpp:
(WebCore::createBlobDataForFileWithType):
(WebCore::createBlobDataForFile):
(WebCore::createBlobDataForFileWithName):
* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::BlobRegistryContext::BlobRegistryContext):
(WebCore::registerBlobURLTask):
(WebCore::ThreadableBlobRegistry::registerBlobURL):
* fileapi/ThreadableBlobRegistry.h:
* fileapi/WebKitBlobBuilder.cpp:
(WebCore::BlobBuilder::getBlob):
* platform/network/BlobData.cpp:
(WebCore::BlobDataHandle::BlobDataHandle):
* platform/network/BlobData.h:
(WebCore::BlobData::BlobData):
(WebCore::BlobDataHandle::create):
* platform/network/BlobRegistry.h:
* platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::registerBlobURL):
* platform/network/BlobRegistryImpl.h:
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::responseBlob):
2013-09-30 Benjamin Poulain <benjamin@webkit.org>
Remove the code guarded by STYLE_SCOPED
......@@ -526,9 +526,9 @@ void WebSocket::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData)
size_t size = binaryData->size();
RefPtr<RawData> rawData = RawData::create();
binaryData->swap(*rawData->mutableData());
OwnPtr<BlobData> blobData = BlobData::create();
auto blobData = std::make_unique<BlobData>();
blobData->appendData(rawData.release(), 0, BlobDataItem::toEndOfFile);
RefPtr<Blob> blob = Blob::create(blobData.release(), size);
RefPtr<Blob> blob = Blob::create(std::move(blobData), size);
dispatchEvent(MessageEvent::create(blob.release(), SecurityOrigin::create(m_url)->toString()));
break;
}
......
......@@ -2377,7 +2377,6 @@ __ZN7WebCore14LoaderStrategy18createBlobRegistryEv
__ZN7WebCore7RawDataC1Ev
__ZN7WebCore8BlobData10appendDataEN3WTF10PassRefPtrINS_7RawDataEEExx
__ZN7WebCore8BlobData10appendFileERKN3WTF6StringExxd
__ZN7WebCore8BlobData6createEv
__ZN7WebCore12BlobDataItem11toEndOfFileE
__ZN7WebCore12BlobRegistryD2Ev
__ZTVN7WebCore12BlobRegistryE
......
......@@ -82,14 +82,14 @@ URLRegistry& BlobURLRegistry::registry()
Blob::Blob()
: m_size(0)
{
OwnPtr<BlobData> blobData = BlobData::create();
auto blobData = std::make_unique<BlobData>();
// Create a new internal URL and register it with the provided blob data.
m_internalURL = BlobURL::createInternalURL();
ThreadableBlobRegistry::registerBlobURL(m_internalURL, blobData.release());
ThreadableBlobRegistry::registerBlobURL(m_internalURL, std::move(blobData));
}
Blob::Blob(PassOwnPtr<BlobData> blobData, long long size)
Blob::Blob(std::unique_ptr<BlobData> blobData, long long size)
: m_type(blobData->contentType())
, m_size(size)
{
......@@ -97,7 +97,7 @@ Blob::Blob(PassOwnPtr<BlobData> blobData, long long size)
// Create a new internal URL and register it with the provided blob data.
m_internalURL = BlobURL::createInternalURL();
ThreadableBlobRegistry::registerBlobURL(m_internalURL, blobData);
ThreadableBlobRegistry::registerBlobURL(m_internalURL, std::move(blobData));
}
Blob::Blob(const URL& srcURL, const String& type, long long size)
......@@ -217,7 +217,7 @@ PassRefPtr<Blob> Blob::slice(long long start, long long end, const String& conte
end = size;
long long length = end - start;
OwnPtr<BlobData> blobData = BlobData::create();
auto blobData = std::make_unique<BlobData>();
blobData->setContentType(Blob::normalizedContentType(contentType));
if (isFile()) {
#if ENABLE(FILE_SYSTEM)
......@@ -229,7 +229,7 @@ PassRefPtr<Blob> Blob::slice(long long start, long long end, const String& conte
} else
blobData->appendBlob(m_internalURL, start, length);
return Blob::create(blobData.release(), length);
return Blob::create(std::move(blobData), length);
}
#endif
......
......@@ -51,9 +51,9 @@ public:
return adoptRef(new Blob);
}
static PassRefPtr<Blob> create(PassOwnPtr<BlobData> blobData, long long size)
static PassRefPtr<Blob> create(std::unique_ptr<BlobData> blobData, long long size)
{
return adoptRef(new Blob(blobData, size));
return adoptRef(new Blob(std::move(blobData), size));
}
// For deserialization.
......@@ -88,7 +88,7 @@ public:
protected:
Blob();
Blob(PassOwnPtr<BlobData>, long long size);
Blob(std::unique_ptr<BlobData>, long long size);
// For deserialization.
Blob(const URL& srcURL, const String& type, long long size);
......
......@@ -50,21 +50,21 @@ static String getContentTypeFromFileName(const String& name, File::ContentTypeLo
return type;
}
static PassOwnPtr<BlobData> createBlobDataForFileWithType(const String& path, const String& contentType)
static std::unique_ptr<BlobData> createBlobDataForFileWithType(const String& path, const String& contentType)
{
OwnPtr<BlobData> blobData = BlobData::create();
auto blobData = std::make_unique<BlobData>();
ASSERT(Blob::isNormalizedContentType(contentType));
blobData->setContentType(contentType);
blobData->appendFile(path);
return blobData.release();
return blobData;
}
static PassOwnPtr<BlobData> createBlobDataForFile(const String& path, File::ContentTypeLookupPolicy policy)
static std::unique_ptr<BlobData> createBlobDataForFile(const String& path, File::ContentTypeLookupPolicy policy)
{
return createBlobDataForFileWithType(path, getContentTypeFromFileName(path, policy));
}
static PassOwnPtr<BlobData> createBlobDataForFileWithName(const String& path, const String& fileSystemName, File::ContentTypeLookupPolicy policy)
static std::unique_ptr<BlobData> createBlobDataForFileWithName(const String& path, const String& fileSystemName, File::ContentTypeLookupPolicy policy)
{
return createBlobDataForFileWithType(path, getContentTypeFromFileName(fileSystemName, policy));
}
......
......@@ -49,9 +49,9 @@ namespace WebCore {
struct BlobRegistryContext {
WTF_MAKE_FAST_ALLOCATED;
public:
BlobRegistryContext(const URL& url, PassOwnPtr<BlobData> blobData)
BlobRegistryContext(const URL& url, std::unique_ptr<BlobData> blobData)
: url(url.copy())
, blobData(blobData)
, blobData(std::move(blobData))
{
this->blobData->detachFromCurrentThread();
}
......@@ -69,12 +69,12 @@ public:
URL url;
URL srcURL;
OwnPtr<BlobData> blobData;
std::unique_ptr<BlobData> blobData;
};
#if ENABLE(BLOB)
typedef HashMap<String, RefPtr<SecurityOrigin> > BlobUrlOriginMap;
typedef HashMap<String, RefPtr<SecurityOrigin>> BlobUrlOriginMap;
static ThreadSpecific<BlobUrlOriginMap>& originMap()
{
AtomicallyInitializedStatic(ThreadSpecific<BlobUrlOriginMap>*, map = new ThreadSpecific<BlobUrlOriginMap>);
......@@ -84,15 +84,15 @@ static ThreadSpecific<BlobUrlOriginMap>& originMap()
static void registerBlobURLTask(void* context)
{
OwnPtr<BlobRegistryContext> blobRegistryContext = adoptPtr(static_cast<BlobRegistryContext*>(context));
blobRegistry().registerBlobURL(blobRegistryContext->url, blobRegistryContext->blobData.release());
blobRegistry().registerBlobURL(blobRegistryContext->url, std::move(blobRegistryContext->blobData));
}
void ThreadableBlobRegistry::registerBlobURL(const URL& url, PassOwnPtr<BlobData> blobData)
void ThreadableBlobRegistry::registerBlobURL(const URL& url, std::unique_ptr<BlobData> blobData)
{
if (isMainThread())
blobRegistry().registerBlobURL(url, blobData);
blobRegistry().registerBlobURL(url, std::move(blobData));
else {
OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(url, blobData));
OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(url, std::move(blobData)));
callOnMainThread(&registerBlobURLTask, context.leakPtr());
}
}
......
......@@ -31,7 +31,6 @@
#ifndef ThreadableBlobRegistry_h
#define ThreadableBlobRegistry_h
#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
namespace WebCore {
......@@ -42,7 +41,7 @@ class SecurityOrigin;
class ThreadableBlobRegistry {
public:
static void registerBlobURL(const URL&, PassOwnPtr<BlobData>);
static void registerBlobURL(const URL&, std::unique_ptr<BlobData>);
static void registerBlobURL(SecurityOrigin*, const URL&, const URL& srcURL);
static void unregisterBlobURL(const URL&);
......
......@@ -145,11 +145,11 @@ void BlobBuilder::appendBytesData(const void* data, size_t length)
PassRefPtr<Blob> BlobBuilder::getBlob(const String& contentType)
{
OwnPtr<BlobData> blobData = BlobData::create();
auto blobData = std::make_unique<BlobData>();
blobData->setContentType(Blob::normalizedContentType(contentType));
blobData->swapItems(m_items);
RefPtr<Blob> blob = Blob::create(blobData.release(), m_size);
RefPtr<Blob> blob = Blob::create(std::move(blobData), m_size);
// After creating a blob from the current blob data, we do not need to keep the data around any more. Instead, we only
// need to keep a reference to the URL of the blob just created.
......
......@@ -60,11 +60,6 @@ void BlobDataItem::detachFromCurrentThread()
url = url.copy();
}
PassOwnPtr<BlobData> BlobData::create()
{
return adoptPtr(new BlobData());
}
void BlobData::detachFromCurrentThread()
{
m_contentType = m_contentType.isolatedCopy();
......@@ -112,11 +107,11 @@ void BlobData::swapItems(BlobDataItemList& items)
}
BlobDataHandle::BlobDataHandle(PassOwnPtr<BlobData> data, long long size)
BlobDataHandle::BlobDataHandle(std::unique_ptr<BlobData> data, long long size)
{
UNUSED_PARAM(size);
m_internalURL = BlobURL::createInternalURL();
ThreadableBlobRegistry::registerBlobURL(m_internalURL, data);
ThreadableBlobRegistry::registerBlobURL(m_internalURL, std::move(data));
}
BlobDataHandle::~BlobDataHandle()
......
......@@ -167,7 +167,7 @@ typedef Vector<BlobDataItem> BlobDataItemList;
class BlobData {
WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<BlobData> create();
BlobData() { }
// Detaches from current thread so that it can be passed to another thread.
void detachFromCurrentThread();
......@@ -193,8 +193,6 @@ private:
friend class BlobRegistryImpl;
friend class BlobStorageData;
BlobData() { }
// This is only exposed to BlobStorageData.
void appendData(const RawData&, long long offset, long long length);
......@@ -208,15 +206,15 @@ private:
// https://codereview.chromium.org/11192017/.
class BlobDataHandle : public ThreadSafeRefCounted<BlobDataHandle> {
public:
static PassRefPtr<BlobDataHandle> create(PassOwnPtr<BlobData> data, long long size)
static PassRefPtr<BlobDataHandle> create(std::unique_ptr<BlobData> data, long long size)
{
return adoptRef(new BlobDataHandle(data, size));
return adoptRef(new BlobDataHandle(std::move(data), size));
}
~BlobDataHandle();
private:
BlobDataHandle(PassOwnPtr<BlobData>, long long size);
BlobDataHandle(std::unique_ptr<BlobData>, long long size);
URL m_internalURL;
};
......
......@@ -46,7 +46,7 @@ BlobRegistry& blobRegistry();
class BlobRegistry {
public:
// Registers a blob URL referring to the specified blob data.
virtual void registerBlobURL(const URL&, PassOwnPtr<BlobData>) = 0;
virtual void registerBlobURL(const URL&, std::unique_ptr<BlobData>) = 0;
// Registers a new blob URL referring to the blob data identified by the specified srcURL.
virtual void registerBlobURL(const URL&, const URL& srcURL) = 0;
......
......@@ -128,7 +128,7 @@ void BlobRegistryImpl::appendStorageItems(BlobStorageData* blobStorageData, cons
}
}
void BlobRegistryImpl::registerBlobURL(const URL& url, PassOwnPtr<BlobData> blobData)
void BlobRegistryImpl::registerBlobURL(const URL& url, std::unique_ptr<BlobData> blobData)
{
ASSERT(isMainThread());
registerBlobResourceHandleConstructor();
......
......@@ -58,7 +58,7 @@ private:
void appendStorageItems(BlobStorageData*, const BlobDataItemList&);
void appendStorageItems(BlobStorageData*, const BlobDataItemList&, long long offset, long long length);
virtual void registerBlobURL(const URL&, PassOwnPtr<BlobData>) OVERRIDE;
virtual void registerBlobURL(const URL&, std::unique_ptr<BlobData>) OVERRIDE;
virtual void registerBlobURL(const URL&, const URL& srcURL) OVERRIDE;
virtual void unregisterBlobURL(const URL&) OVERRIDE;
virtual bool isBlobRegistryImpl() const OVERRIDE { return true; }
......
......@@ -300,7 +300,7 @@ Blob* XMLHttpRequest::responseBlob()
// instead of copying the bytes. Embedders who store blob data in the
// same process as WebCore would at least to teach BlobData to take
// a SharedBuffer, even if they don't get the Blob from the network layer directly.
OwnPtr<BlobData> blobData = BlobData::create();
auto blobData = std::make_unique<BlobData>();
// If we errored out or got no data, we still return a blob, just an empty one.
size_t size = 0;
if (m_binaryResponseBuilder) {
......@@ -312,7 +312,7 @@ Blob* XMLHttpRequest::responseBlob()
blobData->setContentType(normalizedContentType); // responseMIMEType defaults to text/xml which may be incorrect.
m_binaryResponseBuilder.clear();
}
m_responseBlob = Blob::create(blobData.release(), size);
m_responseBlob = Blob::create(std::move(blobData), size);
}
return m_responseBlob.get();
......
2013-09-30 Anders Carlsson <andersca@apple.com>
Get rid of more uses of OwnPtr and PassOwnPtr
https://bugs.webkit.org/show_bug.cgi?id=122136
Reviewed by Antti Koivisto.
* NetworkProcess/AsynchronousNetworkLoaderClient.h:
* NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
(WebKit::NetworkBlobRegistry::registerBlobURL):
* NetworkProcess/FileAPI/NetworkBlobRegistry.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::NetworkResourceLoader):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/SynchronousNetworkLoaderClient.h:
* NetworkProcess/mac/RemoteNetworkingContext.mm:
* Platform/CoreIPC/ArgumentDecoder.h:
* Platform/CoreIPC/ArgumentEncoder.h:
* Platform/CoreIPC/MessageDecoder.cpp:
(CoreIPC::MessageDecoder::setImportanceAssertion):
* Platform/CoreIPC/MessageDecoder.h:
* Platform/CoreIPC/mac/ConnectionMac.cpp:
(CoreIPC::Connection::receiveSourceEventHandler):
* Platform/CoreIPC/mac/ImportanceAssertion.h:
(CoreIPC::ImportanceAssertion::ImportanceAssertion):
* Platform/mac/LayerHostingContext.h:
* Platform/mac/LayerHostingContext.mm:
(WebKit::LayerHostingContext::createForPort):
(WebKit::LayerHostingContext::createForWindowServer):
* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::paint):
* PluginProcess/PluginControllerProxy.h:
* PluginProcess/WebProcessConnection.cpp:
(WebKit::WebProcessConnection::addPluginControllerProxy):
(WebKit::WebProcessConnection::removePluginControllerProxy):
(WebKit::WebProcessConnection::createPluginInternal):
* PluginProcess/WebProcessConnection.h:
* Shared/API/c/cg/WKImageCG.cpp:
(WKImageCreateFromCGImage):
* Shared/BlockingResponseMap.h:
(BlockingResponseMap::waitForResponse):
(BlockingResponseMap::didReceiveResponse):
* Shared/Downloads/Download.cpp:
* Shared/Downloads/Download.h:
* Shared/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::startDownload):
(WebKit::DownloadManager::convertHandleToDownload):
* Shared/FileAPI/BlobRegistrationData.cpp:
(WebKit::BlobRegistrationData::BlobRegistrationData):
(WebKit::BlobRegistrationData::releaseData):
(WebKit::BlobRegistrationData::decode):
* Shared/FileAPI/BlobRegistrationData.h:
* Shared/Plugins/NPObjectMessageReceiver.cpp:
* Shared/Plugins/NPObjectMessageReceiver.h:
* Shared/Plugins/NPRemoteObjectMap.cpp:
(WebKit::NPRemoteObjectMap::registerNPObject):
* Shared/Plugins/Netscape/NetscapePluginModule.cpp:
(WebKit::NetscapePluginModule::tryLoad):
* Shared/Plugins/Netscape/NetscapePluginModule.h:
* Shared/ShareableBitmap.h:
* Shared/WebURL.h:
(WebKit::WebURL::create):
(WebKit::WebURL::WebURL):
(WebKit::WebURL::parseURLIfNecessary):
* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::ShareableBitmap::createGraphicsContext):
(WebKit::ShareableBitmap::makeCGImageCopy):
* Shared/mac/SecItemShim.cpp:
(WebKit::sendSecItemRequest):
(WebKit::webSecItemCopyMatching):
(WebKit::webSecItemAdd):
(WebKit::webSecItemUpdate):
(WebKit::webSecItemDelete):
(WebKit::SecItemShim::secItemResponse):
* UIProcess/API/mac/FindIndicatorWindow.h:
* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::createDrawingAreaProxy):
* UIProcess/API/mac/WKView.mm:
(-[WKView std::WebKit::]):
(-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/BackingStore.cpp:
* UIProcess/BackingStore.h:
* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::incorporateUpdate):
* UIProcess/DrawingAreaProxyImpl.h:
* UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
* WebProcess/FileAPI/BlobRegistryProxy.cpp:
(WebKit::BlobRegistryProxy::registerBlobURL):
* WebProcess/FileAPI/BlobRegistryProxy.h:
* WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
* WebProcess/InjectedBundle/API/c/mac/WKBundlePageBannerMac.mm:
(WKBundlePageBannerCreateBannerWithCALayer):
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
(WebKit::imageForRect):
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::scheduleTimer):
(WebKit::NetscapePlugin::unscheduleTimer):
(WebKit::NetscapePlugin::snapshot):
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::snapshot):
* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::paint):
(WebKit::PluginProxy::update):
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::convertImageToBitmap):
* WebProcess/WebPage/DrawingArea.cpp:
(WebKit::DrawingArea::create):
* WebProcess/WebPage/DrawingArea.h:
* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::display):
* WebProcess/WebPage/DrawingAreaImpl.h:
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::getFindIndicatorBitmapAndRect):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::createWithCoreMainFrame):
(WebKit::WebFrame::createSubframe):
(WebKit::WebFrame::create):
(WebKit::WebFrame::WebFrame):
* WebProcess/WebPage/WebFrame.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::scaledSnapshotWithOptions):
(WebKit::WebPage::drawRectToImage):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/LayerTreeHostMac.h:
* WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
* WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2013-09-27 Anders Carlsson <andersca@apple.com>
Message sending functions should only accept rvalues
......
......@@ -28,7 +28,6 @@
#include "NetworkLoaderClient.h"
#include "ShareableResource.h"
#include <wtf/PassOwnPtr.h>
#if ENABLE(NETWORK_PROCESS)
......@@ -36,14 +35,9 @@ namespace WebKit {
class AsynchronousNetworkLoaderClient : public NetworkLoaderClient {
public:
static PassOwnPtr<NetworkLoaderClient> create()
{
return adoptPtr(new AsynchronousNetworkLoaderClient());
}
private:
AsynchronousNetworkLoaderClient();
private:
virtual void willSendRequest(NetworkResourceLoader*, WebCore::ResourceRequest& newRequest, const WebCore::ResourceResponse& redirectResponse) OVERRIDE;
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
virtual void canAuthenticateAgainstProtectionSpace(NetworkResourceLoader*, const WebCore::ProtectionSpace&) OVERRIDE;
......
......@@ -47,7 +47,7 @@ NetworkBlobRegistry::NetworkBlobRegistry()
{
}
void NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess* connection, const URL& url, PassOwnPtr<BlobData> data, const Vector<RefPtr<SandboxExtension>>& newSandboxExtensions)
void NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess* connection, const URL& url, std::unique_ptr<BlobData> data, const Vector<RefPtr<SandboxExtension>>& newSandboxExtensions)
{
ASSERT(!m_sandboxExtensions.contains(url.string()));
......@@ -59,7 +59,7 @@ void NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess* connect
sandboxExtensions.appendVector(m_sandboxExtensions.get(items[i].url.string()));
}
blobRegistry().registerBlobURL(url, data);
blobRegistry().registerBlobURL(url, std::move(data));
if (!sandboxExtensions.isEmpty())
m_sandboxExtensions.add(url.string(), sandboxExtensions);
......
......@@ -47,7 +47,7 @@ public:
NetworkBlobRegistry();
static NetworkBlobRegistry& shared();
void registerBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&, PassOwnPtr<WebCore::BlobData>, const Vector<RefPtr<SandboxExtension>>&);
void registerBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&, std::unique_ptr<WebCore::BlobData>, const Vector<RefPtr<SandboxExtension>>&);
void registerBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&, const WebCore::URL& srcURL);
void unregisterBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&);
......
......@@ -103,9 +103,9 @@ NetworkResourceLoader::NetworkResourceLoader(const NetworkResourceLoadParameters
ASSERT(isMainThread());
if (reply)
m_networkLoaderClient = SynchronousNetworkLoaderClient::create(m_request, reply);
m_networkLoaderClient = std::make_unique<SynchronousNetworkLoaderClient>(m_request, reply);
else
m_networkLoaderClient = AsynchronousNetworkLoaderClient::create();
m_networkLoaderClient = std::make_unique<AsynchronousNetworkLoaderClient>();
}
NetworkResourceLoader::~NetworkResourceLoader()
......
......@@ -166,7 +166,7 @@ private:
uint64_t m_bytesReceived;
bool m_handleConvertedToDownload;
OwnPtr<NetworkLoaderClient> m_networkLoaderClient;
std::unique_ptr<NetworkLoaderClient> m_networkLoaderClient;
ResourceLoadIdentifier m_identifier;
uint64_t m_webPageID;
......
......@@ -43,18 +43,12 @@ namespace WebKit {
class SynchronousNetworkLoaderClient : public NetworkLoaderClient {
public:
static PassOwnPtr<NetworkLoaderClient> create(const WebCore::ResourceRequest& originalRequest, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply> reply)
{
return adoptPtr(new SynchronousNetworkLoaderClient(originalRequest, reply));
}
SynchronousNetworkLoaderClient(const WebCore::ResourceRequest& originalRequest, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply>);
virtual ~SynchronousNetworkLoaderClient() OVERRIDE;
virtual bool isSynchronous() OVERRIDE { return true; }
private:
SynchronousNetworkLoaderClient(const WebCore::ResourceRequest& originalRequest, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply>);
virtual void willSendRequest(NetworkResourceLoader*, WebCore::ResourceRequest& proposedRequest, const WebCore::Res