Update to the latest AMTL: remove PassRef.

This commit is contained in:
David Anderson 2015-11-08 13:51:22 -08:00
parent e2b399b8d3
commit c3e5d62bf6
8 changed files with 22 additions and 22 deletions

View File

@ -138,13 +138,13 @@ void GameHooks::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPla
} }
#endif #endif
ke::PassRef<CommandHook> ke::RefPtr<CommandHook>
GameHooks::AddCommandHook(ConCommand *cmd, const CommandHook::Callback &callback) GameHooks::AddCommandHook(ConCommand *cmd, const CommandHook::Callback &callback)
{ {
return new CommandHook(cmd, callback, false); return new CommandHook(cmd, callback, false);
} }
ke::PassRef<CommandHook> ke::RefPtr<CommandHook>
GameHooks::AddPostCommandHook(ConCommand *cmd, const CommandHook::Callback &callback) GameHooks::AddPostCommandHook(ConCommand *cmd, const CommandHook::Callback &callback)
{ {
return new CommandHook(cmd, callback, true); return new CommandHook(cmd, callback, true);

View File

@ -93,8 +93,8 @@ public:
} }
public: public:
ke::PassRef<CommandHook> AddCommandHook(ConCommand *cmd, const CommandHook::Callback &callback); ke::RefPtr<CommandHook> AddCommandHook(ConCommand *cmd, const CommandHook::Callback &callback);
ke::PassRef<CommandHook> AddPostCommandHook(ConCommand *cmd, const CommandHook::Callback &callback); ke::RefPtr<CommandHook> AddPostCommandHook(ConCommand *cmd, const CommandHook::Callback &callback);
int CommandClient() const { int CommandClient() const {
return last_command_client_; return last_command_client_;

View File

@ -261,11 +261,11 @@ void ShareSystem::OverrideNatives(IExtension *myself, const sp_nativeinfo_t *nat
assert(false); assert(false);
} }
PassRef<Native> ShareSystem::FindNative(const char *name) RefPtr<Native> ShareSystem::FindNative(const char *name)
{ {
NativeCache::Result r = m_NtvCache.find(name); NativeCache::Result r = m_NtvCache.find(name);
if (!r.found()) if (!r.found())
return NULL; return nullptr;
return *r; return *r;
} }
@ -368,15 +368,15 @@ void ShareSystem::BindNativeToPlugin(CPlugin *pPlugin, const sp_native_t *native
nullptr); nullptr);
} }
PassRef<Native> ShareSystem::AddNativeToCache(CNativeOwner *pOwner, const sp_nativeinfo_t *ntv) AlreadyRefed<Native> ShareSystem::AddNativeToCache(CNativeOwner *pOwner, const sp_nativeinfo_t *ntv)
{ {
NativeCache::Insert i = m_NtvCache.findForAdd(ntv->name); NativeCache::Insert i = m_NtvCache.findForAdd(ntv->name);
if (i.found()) if (i.found())
return NULL; return nullptr;
RefPtr<Native> entry = new Native(pOwner, ntv); RefPtr<Native> entry = new Native(pOwner, ntv);
m_NtvCache.insert(ntv->name, entry); m_NtvCache.insert(ntv->name, entry);
return entry; return entry.forget();
} }
FakeNative::~FakeNative() FakeNative::~FakeNative()
@ -400,24 +400,24 @@ void ShareSystem::ClearNativeFromCache(CNativeOwner *pOwner, const char *name)
m_NtvCache.remove(r); m_NtvCache.remove(r);
} }
PassRef<Native> ShareSystem::AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKENATIVE_FUNC func) AlreadyRefed<Native> ShareSystem::AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKENATIVE_FUNC func)
{ {
RefPtr<Native> entry(FindNative(name)); RefPtr<Native> entry(FindNative(name));
if (entry) if (entry)
return NULL; return nullptr;
AutoPtr<FakeNative> fake(new FakeNative(name, pFunc)); AutoPtr<FakeNative> fake(new FakeNative(name, pFunc));
fake->gate = g_pSourcePawn2->CreateFakeNative(func, fake); fake->gate = g_pSourcePawn2->CreateFakeNative(func, fake);
if (!fake->gate) if (!fake->gate)
return NULL; return nullptr;
CNativeOwner *owner = g_PluginSys.GetPluginByCtx(fake->ctx->GetContext()); CNativeOwner *owner = g_PluginSys.GetPluginByCtx(fake->ctx->GetContext());
entry = new Native(owner, fake.take()); entry = new Native(owner, fake.take());
m_NtvCache.insert(name, entry); m_NtvCache.insert(name, entry);
return entry; return entry.forget();
} }
void ShareSystem::AddCapabilityProvider(IExtension *myself, IFeatureProvider *provider, void ShareSystem::AddCapabilityProvider(IExtension *myself, IFeatureProvider *provider,

View File

@ -122,10 +122,10 @@ public:
void BeginBindingFor(CPlugin *pPlugin); void BeginBindingFor(CPlugin *pPlugin);
void BindNativesToPlugin(CPlugin *pPlugin, bool bCoreOnly); void BindNativesToPlugin(CPlugin *pPlugin, bool bCoreOnly);
void BindNativeToPlugin(CPlugin *pPlugin, const ke::RefPtr<Native> &pEntry); void BindNativeToPlugin(CPlugin *pPlugin, const ke::RefPtr<Native> &pEntry);
ke::PassRef<Native> AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKENATIVE_FUNC func); ke::AlreadyRefed<Native> AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKENATIVE_FUNC func);
ke::PassRef<Native> FindNative(const char *name); ke::RefPtr<Native> FindNative(const char *name);
private: private:
ke::PassRef<Native> AddNativeToCache(CNativeOwner *pOwner, const sp_nativeinfo_t *ntv); ke::AlreadyRefed<Native> AddNativeToCache(CNativeOwner *pOwner, const sp_nativeinfo_t *ntv);
void ClearNativeFromCache(CNativeOwner *pOwner, const char *name); void ClearNativeFromCache(CNativeOwner *pOwner, const char *name);
void BindNativeToPlugin(CPlugin *pPlugin, const sp_native_t *ntv, uint32_t index, const ke::RefPtr<Native> &pEntry); void BindNativeToPlugin(CPlugin *pPlugin, const sp_native_t *ntv, uint32_t index, const ke::RefPtr<Native> &pEntry);
private: private:

View File

@ -750,13 +750,13 @@ bool CoreProviderImpl::LoadBridge(char *error, size_t maxlength)
return true; return true;
} }
ke::PassRef<CommandHook> ke::RefPtr<CommandHook>
CoreProviderImpl::AddCommandHook(ConCommand *cmd, const CommandHook::Callback &callback) CoreProviderImpl::AddCommandHook(ConCommand *cmd, const CommandHook::Callback &callback)
{ {
return hooks_.AddCommandHook(cmd, callback); return hooks_.AddCommandHook(cmd, callback);
} }
ke::PassRef<CommandHook> ke::RefPtr<CommandHook>
CoreProviderImpl::AddPostCommandHook(ConCommand *cmd, const CommandHook::Callback &callback) CoreProviderImpl::AddPostCommandHook(ConCommand *cmd, const CommandHook::Callback &callback)
{ {
return hooks_.AddPostCommandHook(cmd, callback); return hooks_.AddPostCommandHook(cmd, callback);

View File

@ -67,8 +67,8 @@ public:
bool IsClientConVarQueryingSupported() override; bool IsClientConVarQueryingSupported() override;
void DefineCommand(const char *cmd, const char *help, const SourceMod::CommandFunc &callback) override; void DefineCommand(const char *cmd, const char *help, const SourceMod::CommandFunc &callback) override;
ke::PassRef<CommandHook> AddCommandHook(ConCommand *cmd, const CommandHook::Callback &callback); ke::RefPtr<CommandHook> AddCommandHook(ConCommand *cmd, const CommandHook::Callback &callback);
ke::PassRef<CommandHook> AddPostCommandHook(ConCommand *cmd, const CommandHook::Callback &callback); ke::RefPtr<CommandHook> AddPostCommandHook(ConCommand *cmd, const CommandHook::Callback &callback);
int CommandClient() const { int CommandClient() const {
return hooks_.CommandClient(); return hooks_.CommandClient();

@ -1 +1 @@
Subproject commit 50de9b831e1691cb513b6e18a49cdf5b4d73c5cb Subproject commit 522057068a520d75acca00f6682f4d06d1ae18a4

@ -1 +1 @@
Subproject commit 028d93357d452906aac2a5bbfb3284682b5b1173 Subproject commit dde42ef136c59ae125169a850298b1383e53afb6