Change NetscapePluginInstanceProxy::m_replies to use unique_ptr instead of deleteAllValues
https://bugs.webkit.org/show_bug.cgi?id=122492
Reviewed by Andreas Kling.
* Plugins/Hosted/NetscapePluginHostManager.mm:
(WebKit::NetscapePluginHostManager::instantiatePlugin): Use auto so this works with
unique_ptr instead of auto_ptr.
* Plugins/Hosted/NetscapePluginHostProxy.mm:
(WKPCGetScriptableNPObjectReply): Use make_unique instead of using new directly.
(WKPCBooleanReply): Ditto.
(WKPCBooleanAndDataReply): Ditto.
(WKPCInstantiatePluginReply): Ditto.
* Plugins/Hosted/NetscapePluginInstanceProxy.h: Changed m_replies to map to unique_ptr
instead of to a raw pointer.
(WebKit::NetscapePluginInstanceProxy::setCurrentReply): Changed to take a unique_ptr
instead of a raw pointer since this takes ownership of the pointer.
(WebKit::NetscapePluginInstanceProxy::waitForReply): Changed to return a unique_ptr
instead of a auto_ptr because that's better. Use unique_ptr inside the function
too to avoid the need for an explicit delete.
* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::~NetscapePluginInstanceProxy): Removed the call to
deleteAllValues.
(WebKit::NetscapePluginInstanceProxy::cancelStreamLoad): Removed unneeded initialization
of a local variable that was already set in all code paths.
(WebKit::NetscapePluginInstanceProxy::wheelEvent): Use auto so this works with unique_ptr
instead of auto_ptr.
(WebKit::NetscapePluginInstanceProxy::print): Ditto.
(WebKit::NetscapePluginInstanceProxy::snapshot): Ditto. Ditto.
(WebKit::NetscapePluginInstanceProxy::processRequestsAndWaitForReply): Changed to return
a unique_ptr. Also removed an unneeded assertion.
(WebKit::NetscapePluginInstanceProxy::createBindingsInstance): Use auto so this works
with unique_ptr instead of auto_ptr.
* Plugins/Hosted/ProxyInstance.h: Changed return type of waitForReply to unique_ptr.
* Plugins/Hosted/ProxyInstance.mm:
(WebKit::ProxyInstance::invoke): Use auto so this works with unique_ptr instead of auto_ptr.
(WebKit::ProxyInstance::supportsInvokeDefaultMethod): Ditto.
(WebKit::ProxyInstance::supportsConstruct): Ditto.
(WebKit::ProxyInstance::getPropertyNames): Ditto.
(WebKit::ProxyInstance::methodNamed): Ditto.
(WebKit::ProxyInstance::fieldNamed): Ditto.
(WebKit::ProxyInstance::fieldValue): Ditto.
(WebKit::ProxyInstance::setFieldValue): Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157089 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog
index 400b55e..99b3468 100644
--- a/Source/WebKit/mac/ChangeLog
+++ b/Source/WebKit/mac/ChangeLog
@@ -1,3 +1,51 @@
+2013-10-08 Darin Adler <darin@apple.com>
+
+ Change NetscapePluginInstanceProxy::m_replies to use unique_ptr instead of deleteAllValues
+ https://bugs.webkit.org/show_bug.cgi?id=122492
+
+ Reviewed by Andreas Kling.
+
+ * Plugins/Hosted/NetscapePluginHostManager.mm:
+ (WebKit::NetscapePluginHostManager::instantiatePlugin): Use auto so this works with
+ unique_ptr instead of auto_ptr.
+ * Plugins/Hosted/NetscapePluginHostProxy.mm:
+ (WKPCGetScriptableNPObjectReply): Use make_unique instead of using new directly.
+ (WKPCBooleanReply): Ditto.
+ (WKPCBooleanAndDataReply): Ditto.
+ (WKPCInstantiatePluginReply): Ditto.
+ * Plugins/Hosted/NetscapePluginInstanceProxy.h: Changed m_replies to map to unique_ptr
+ instead of to a raw pointer.
+ (WebKit::NetscapePluginInstanceProxy::setCurrentReply): Changed to take a unique_ptr
+ instead of a raw pointer since this takes ownership of the pointer.
+ (WebKit::NetscapePluginInstanceProxy::waitForReply): Changed to return a unique_ptr
+ instead of a auto_ptr because that's better. Use unique_ptr inside the function
+ too to avoid the need for an explicit delete.
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::~NetscapePluginInstanceProxy): Removed the call to
+ deleteAllValues.
+ (WebKit::NetscapePluginInstanceProxy::cancelStreamLoad): Removed unneeded initialization
+ of a local variable that was already set in all code paths.
+ (WebKit::NetscapePluginInstanceProxy::wheelEvent): Use auto so this works with unique_ptr
+ instead of auto_ptr.
+ (WebKit::NetscapePluginInstanceProxy::print): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::snapshot): Ditto. Ditto.
+ (WebKit::NetscapePluginInstanceProxy::processRequestsAndWaitForReply): Changed to return
+ a unique_ptr. Also removed an unneeded assertion.
+ (WebKit::NetscapePluginInstanceProxy::createBindingsInstance): Use auto so this works
+ with unique_ptr instead of auto_ptr.
+
+ * Plugins/Hosted/ProxyInstance.h: Changed return type of waitForReply to unique_ptr.
+
+ * Plugins/Hosted/ProxyInstance.mm:
+ (WebKit::ProxyInstance::invoke): Use auto so this works with unique_ptr instead of auto_ptr.
+ (WebKit::ProxyInstance::supportsInvokeDefaultMethod): Ditto.
+ (WebKit::ProxyInstance::supportsConstruct): Ditto.
+ (WebKit::ProxyInstance::getPropertyNames): Ditto.
+ (WebKit::ProxyInstance::methodNamed): Ditto.
+ (WebKit::ProxyInstance::fieldNamed): Ditto.
+ (WebKit::ProxyInstance::fieldValue): Ditto.
+ (WebKit::ProxyInstance::setFieldValue): Ditto.
+
2013-10-07 Sam Weinig <sam@webkit.org>
CTTE: Use references in and around DragController
diff --git a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
index 11ab8ee..c48e762 100644
--- a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
+++ b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
@@ -268,10 +268,10 @@
_WKPHInstantiatePlugin(hostProxy->port(), requestID, (uint8_t*)[data bytes], [data length], instance->pluginID());
}
- std::auto_ptr<NetscapePluginInstanceProxy::InstantiatePluginReply> reply = instance->waitForReply<NetscapePluginInstanceProxy::InstantiatePluginReply>(requestID);
- if (!reply.get() || reply->m_resultCode != KERN_SUCCESS) {
+ auto reply = instance->waitForReply<NetscapePluginInstanceProxy::InstantiatePluginReply>(requestID);
+ if (!reply || reply->m_resultCode != KERN_SUCCESS) {
instance->cleanup();
- return 0;
+ return nullptr;
}
instance->setRenderContextID(reply->m_renderContextID);
diff --git a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
index 3eae97a..35b4b0e 100644
--- a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
+++ b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
@@ -484,7 +484,7 @@
if (!instanceProxy)
return KERN_FAILURE;
- instanceProxy->setCurrentReply(requestID, new NetscapePluginInstanceProxy::GetScriptableNPObjectReply(objectID));
+ instanceProxy->setCurrentReply(requestID, std::make_unique<NetscapePluginInstanceProxy::GetScriptableNPObjectReply>(objectID));
return KERN_SUCCESS;
}
@@ -498,7 +498,7 @@
if (!instanceProxy)
return KERN_FAILURE;
- instanceProxy->setCurrentReply(requestID, new NetscapePluginInstanceProxy::BooleanReply(result));
+ instanceProxy->setCurrentReply(requestID, std::make_unique<NetscapePluginInstanceProxy::BooleanReply>(result));
return KERN_SUCCESS;
}
@@ -515,7 +515,7 @@
return KERN_FAILURE;
RetainPtr<CFDataRef> result = adoptCF(CFDataCreate(0, reinterpret_cast<UInt8*>(resultData), resultLength));
- instanceProxy->setCurrentReply(requestID, new NetscapePluginInstanceProxy::BooleanAndDataReply(returnValue, result));
+ instanceProxy->setCurrentReply(requestID, std::make_unique<NetscapePluginInstanceProxy::BooleanAndDataReply>(returnValue, result));
return KERN_SUCCESS;
}
@@ -530,7 +530,7 @@
if (!instanceProxy)
return KERN_FAILURE;
- instanceProxy->setCurrentReply(requestID, new NetscapePluginInstanceProxy::InstantiatePluginReply(result, renderContextID, static_cast<RendererType>(rendererType)));
+ instanceProxy->setCurrentReply(requestID, std::make_unique<NetscapePluginInstanceProxy::InstantiatePluginReply>(result, renderContextID, static_cast<RendererType>(rendererType)));
return KERN_SUCCESS;
}
diff --git a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
index 1ef92db..d2c79d3 100644
--- a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
+++ b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
@@ -248,21 +248,21 @@
RetainPtr<CFDataRef> m_result;
};
- void setCurrentReply(uint32_t requestID, Reply* reply)
+ void setCurrentReply(uint32_t requestID, std::unique_ptr<Reply> reply)
{
ASSERT(!m_replies.contains(requestID));
- m_replies.set(requestID, reply);
+ m_replies.add(requestID, std::move(reply));
}
template <typename T>
- std::auto_ptr<T> waitForReply(uint32_t requestID)
+ std::unique_ptr<T> waitForReply(uint32_t requestID)
{
Ref<NetscapePluginInstanceProxy> protect(*this); // Plug-in host may crash while we are waiting for reply, releasing all instances to the instance proxy.
willCallPluginFunction();
m_waitingForReply = true;
- Reply* reply = processRequestsAndWaitForReply(requestID);
+ auto reply = processRequestsAndWaitForReply(requestID);
if (reply)
ASSERT(reply->m_type == T::ReplyType);
@@ -272,11 +272,10 @@
didCallPluginFunction(stopped);
if (stopped) {
// The instance proxy may have been deleted from didCallPluginFunction(), so a null reply needs to be returned.
- delete static_cast<T*>(reply);
- return std::auto_ptr<T>();
+ return nullptr;
}
- return std::auto_ptr<T>(static_cast<T*>(reply));
+ return std::unique_ptr<T>(static_cast<T*>(reply.release()));
}
void webFrameDidFinishLoadWithReason(WebFrame*, NPReason);
@@ -291,7 +290,7 @@
void evaluateJavaScript(PluginRequest*);
void stopAllStreams();
- Reply* processRequestsAndWaitForReply(uint32_t requestID);
+ std::unique_ptr<Reply> processRequestsAndWaitForReply(uint32_t requestID);
NetscapePluginHostProxy* m_pluginHostProxy;
WebHostedNetscapePluginView *m_pluginView;
@@ -309,7 +308,7 @@
RendererType m_rendererType;
bool m_waitingForReply;
- HashMap<uint32_t, Reply*> m_replies;
+ HashMap<uint32_t, std::unique_ptr<Reply>> m_replies;
// NPRuntime
diff --git a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
index b165584..b49c280 100644
--- a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
+++ b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
@@ -122,7 +122,7 @@
inline JSC::JSObject* NetscapePluginInstanceProxy::LocalObjectMap::get(uint32_t objectID) const
{
if (objectID == HashTraits<uint32_t>::emptyValue() || HashTraits<uint32_t>::isDeletedValue(objectID))
- return 0;
+ return nullptr;
return m_idToJSObjectMap.get(objectID).get();
}
@@ -258,7 +258,6 @@
ASSERT(!m_pluginHostProxy);
m_pluginID = 0;
- deleteAllValues(m_replies);
#ifndef NDEBUG
netscapePluginInstanceProxyCounter.decrement();
@@ -321,7 +320,7 @@
(*it)->invalidate();
m_pluginView = nil;
- m_manualStream = 0;
+ m_manualStream = nullptr;
}
void NetscapePluginInstanceProxy::invalidate()
@@ -331,7 +330,7 @@
return;
m_pluginHostProxy->removePluginInstance(this);
- m_pluginHostProxy = 0;
+ m_pluginHostProxy = nullptr;
}
void NetscapePluginInstanceProxy::destroy()
@@ -369,7 +368,7 @@
bool NetscapePluginInstanceProxy::cancelStreamLoad(uint32_t streamID, NPReason reason)
{
- HostedNetscapePluginStream* stream = 0;
+ HostedNetscapePluginStream* stream;
if (m_manualStream && streamID == 1)
stream = m_manualStream.get();
@@ -386,7 +385,7 @@
void NetscapePluginInstanceProxy::disconnectStream(HostedNetscapePluginStream* stream)
{
if (stream == m_manualStream) {
- m_manualStream = 0;
+ m_manualStream = nullptr;
return;
}
@@ -396,7 +395,7 @@
void NetscapePluginInstanceProxy::pluginHostDied()
{
- m_pluginHostProxy = 0;
+ m_pluginHostProxy = nullptr;
[m_pluginView pluginHostDied];
@@ -499,11 +498,8 @@
pluginPoint.x, pluginPoint.y, [event buttonNumber],
[event deltaX], [event deltaY], [event deltaZ]);
- std::auto_ptr<NetscapePluginInstanceProxy::BooleanReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
- if (!reply.get() || !reply->m_result)
- return false;
-
- return true;
+ auto reply = waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
+ return reply && reply->m_result;
}
void NetscapePluginInstanceProxy::print(CGContextRef context, unsigned width, unsigned height)
@@ -511,8 +507,8 @@
uint32_t requestID = nextRequestID();
_WKPHPluginInstancePrint(m_pluginHostProxy->port(), m_pluginID, requestID, width, height);
- std::auto_ptr<NetscapePluginInstanceProxy::BooleanAndDataReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
- if (!reply.get() || !reply->m_returnValue)
+ auto reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
+ if (!reply || !reply->m_returnValue)
return;
RetainPtr<CGDataProvider> dataProvider = adoptCF(CGDataProviderCreateWithCFData(reply->m_result.get()));
@@ -534,8 +530,8 @@
uint32_t requestID = nextRequestID();
_WKPHPluginInstanceSnapshot(m_pluginHostProxy->port(), m_pluginID, requestID, width, height);
- std::auto_ptr<NetscapePluginInstanceProxy::BooleanAndDataReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
- if (!reply.get() || !reply->m_returnValue)
+ auto reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
+ if (!reply || !reply->m_returnValue)
return;
RetainPtr<CGDataProvider> dataProvider = adoptCF(CGDataProviderCreateWithCFData(reply->m_result.get()));
@@ -816,25 +812,25 @@
return NPERR_NO_ERROR;
}
-NetscapePluginInstanceProxy::Reply* NetscapePluginInstanceProxy::processRequestsAndWaitForReply(uint32_t requestID)
+std::unique_ptr<NetscapePluginInstanceProxy::Reply> NetscapePluginInstanceProxy::processRequestsAndWaitForReply(uint32_t requestID)
{
- Reply* reply = 0;
-
ASSERT(m_pluginHostProxy);
+
+ std::unique_ptr<Reply> reply;
+
while (!(reply = m_replies.take(requestID))) {
if (!m_pluginHostProxy->processRequests())
- return 0;
+ return nullptr;
// The host proxy can be destroyed while executing a nested processRequests() call, in which case it's normal
// to get a success result, but be unable to keep looping.
if (!m_pluginHostProxy)
- return 0;
+ return nullptr;
}
-
- ASSERT(reply);
+
return reply;
}
-
+
// NPRuntime support
bool NetscapePluginInstanceProxy::getWindowNPObject(uint32_t& objectID)
{
@@ -871,7 +867,7 @@
bool NetscapePluginInstanceProxy::evaluate(uint32_t objectID, const String& script, data_t& resultData, mach_msg_type_number_t& resultLength, bool allowPopups)
{
- resultData = 0;
+ resultData = nullptr;
resultLength = 0;
if (m_inDestroy)
@@ -901,7 +897,7 @@
bool NetscapePluginInstanceProxy::invoke(uint32_t objectID, const Identifier& methodName, data_t argumentsData, mach_msg_type_number_t argumentsLength, data_t& resultData, mach_msg_type_number_t& resultLength)
{
- resultData = 0;
+ resultData = nullptr;
resultLength = 0;
if (m_inDestroy)
@@ -1437,14 +1433,14 @@
uint32_t requestID = nextRequestID();
if (_WKPHGetScriptableNPObject(m_pluginHostProxy->port(), m_pluginID, requestID) != KERN_SUCCESS)
- return 0;
+ return nullptr;
- std::auto_ptr<GetScriptableNPObjectReply> reply = waitForReply<GetScriptableNPObjectReply>(requestID);
- if (!reply.get())
- return 0;
+ auto reply = waitForReply<GetScriptableNPObjectReply>(requestID);
+ if (!reply)
+ return nullptr;
if (!reply->m_objectID)
- return 0;
+ return nullptr;
// Since the reply was non-null, "this" is still a valid pointer.
return ProxyInstance::create(rootObject, this, reply->m_objectID);
diff --git a/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.h b/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.h
index 655e809..f3e532e 100644
--- a/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.h
+++ b/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.h
@@ -87,12 +87,13 @@
JSC::JSValue invoke(JSC::ExecState*, InvokeType, uint64_t identifier, const JSC::ArgList&);
template <typename T>
- std::auto_ptr<T> waitForReply(uint32_t requestID) const {
- std::auto_ptr<T> reply = m_instanceProxy->waitForReply<T>(requestID);
+ std::unique_ptr<T> waitForReply(uint32_t requestID) const
+ {
+ auto reply = m_instanceProxy->waitForReply<T>(requestID);
// If the instance proxy was invalidated, just return a null reply.
if (!m_instanceProxy)
- return std::auto_ptr<T>();
+ return nullptr;
return reply;
}
diff --git a/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
index 6393fd8..de3754f 100644
--- a/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
+++ b/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
@@ -163,7 +163,7 @@
return jsUndefined();
}
- std::auto_ptr<NetscapePluginInstanceProxy::BooleanAndDataReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
+ auto reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(exec);
if (m_instanceProxy) {
@@ -171,7 +171,7 @@
m_instanceProxy->releaseLocalObject(args.at(i));
}
- if (!reply.get() || !reply->m_returnValue)
+ if (!reply || !reply->m_returnValue)
return jsUndefined();
return m_instanceProxy->demarshalValue(exec, (char*)CFDataGetBytePtr(reply->m_result.get()), CFDataGetLength(reply->m_result.get()));
@@ -242,11 +242,8 @@
m_objectID) != KERN_SUCCESS)
return false;
- std::auto_ptr<NetscapePluginInstanceProxy::BooleanReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
- if (reply.get() && reply->m_result)
- return true;
-
- return false;
+ auto reply = waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
+ return reply && reply->m_result;
}
JSValue ProxyInstance::invokeDefaultMethod(ExecState* exec)
@@ -266,11 +263,8 @@
m_objectID) != KERN_SUCCESS)
return false;
- std::auto_ptr<NetscapePluginInstanceProxy::BooleanReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
- if (reply.get() && reply->m_result)
- return true;
-
- return false;
+ auto reply = waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
+ return reply && reply->m_result;
}
JSValue ProxyInstance::invokeConstruct(ExecState* exec, const ArgList& args)
@@ -320,9 +314,9 @@
if (_WKPHNPObjectEnumerate(m_instanceProxy->hostProxy()->port(), m_instanceProxy->pluginID(), requestID, m_objectID) != KERN_SUCCESS)
return;
- std::auto_ptr<NetscapePluginInstanceProxy::BooleanAndDataReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
+ auto reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(exec);
- if (!reply.get() || !reply->m_returnValue)
+ if (!reply || !reply->m_returnValue)
return;
RetainPtr<NSArray*> array = [NSPropertyListSerialization propertyListFromData:(NSData *)reply->m_result.get()
@@ -347,10 +341,10 @@
{
String name(propertyName.publicName());
if (name.isNull())
- return 0;
+ return nullptr;
if (!m_instanceProxy)
- return 0;
+ return nullptr;
// If we already have an entry in the map, use it.
auto existingMapEntry = m_methods.find(name.impl());
@@ -365,14 +359,14 @@
if (_WKPHNPObjectHasMethod(m_instanceProxy->hostProxy()->port(),
m_instanceProxy->pluginID(), requestID,
m_objectID, methodName) != KERN_SUCCESS)
- return 0;
+ return nullptr;
- std::auto_ptr<NetscapePluginInstanceProxy::BooleanReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
- if (!reply.get())
- return 0;
+ auto reply = waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
+ if (!reply)
+ return nullptr;
if (!reply->m_result && !m_instanceProxy->hostProxy()->shouldCacheMissingPropertiesAndMethods())
- return 0;
+ return nullptr;
// Add a new entry to the map unless an entry was added while we were in waitForReply.
auto mapAddResult = m_methods.add(name.impl(), nullptr);
@@ -386,10 +380,10 @@
{
String name(propertyName.publicName());
if (name.isNull())
- return 0;
+ return nullptr;
if (!m_instanceProxy)
- return 0;
+ return nullptr;
// If we already have an entry in the map, use it.
auto existingMapEntry = m_fields.find(name.impl());
@@ -402,14 +396,14 @@
if (_WKPHNPObjectHasProperty(m_instanceProxy->hostProxy()->port(),
m_instanceProxy->pluginID(), requestID,
m_objectID, identifier) != KERN_SUCCESS)
- return 0;
+ return nullptr;
- std::auto_ptr<NetscapePluginInstanceProxy::BooleanReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
- if (!reply.get())
- return 0;
+ auto reply = waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
+ if (!reply)
+ return nullptr;
if (!reply->m_result && !m_instanceProxy->hostProxy()->shouldCacheMissingPropertiesAndMethods())
- return 0;
+ return nullptr;
// Add a new entry to the map unless an entry was added while we were in waitForReply.
auto mapAddResult = m_fields.add(name.impl(), nullptr);
@@ -431,9 +425,9 @@
m_objectID, serverIdentifier) != KERN_SUCCESS)
return jsUndefined();
- std::auto_ptr<NetscapePluginInstanceProxy::BooleanAndDataReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
+ auto reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(exec);
- if (!reply.get() || !reply->m_returnValue)
+ if (!reply || !reply->m_returnValue)
return jsUndefined();
return m_instanceProxy->demarshalValue(exec, (char*)CFDataGetBytePtr(reply->m_result.get()), CFDataGetLength(reply->m_result.get()));
@@ -461,7 +455,7 @@
if (kr != KERN_SUCCESS)
return;
- std::auto_ptr<NetscapePluginInstanceProxy::BooleanReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
+ waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(exec);
}
@@ -472,7 +466,7 @@
if (NetscapePluginHostProxy* hostProxy = m_instanceProxy->hostProxy())
_WKPHNPObjectRelease(hostProxy->port(),
m_instanceProxy->pluginID(), m_objectID);
- m_instanceProxy = 0;
+ m_instanceProxy = nullptr;
}
} // namespace WebKit