Pass wxSharedPtr argument of RegisterFactory() by const reference

Avoid extra copies from passing it by value.
This commit is contained in:
Vadim Zeitlin
2020-12-13 00:19:03 +01:00
parent e3382b6e93
commit 727b590814
3 changed files with 7 additions and 3 deletions

View File

@@ -241,7 +241,8 @@ public:
static wxWebSession* New(const wxString& backend = wxWebSessionBackendDefault); static wxWebSession* New(const wxString& backend = wxWebSessionBackendDefault);
static void RegisterFactory(const wxString& backend, wxSharedPtr<wxWebSessionFactory> factory); static void RegisterFactory(const wxString& backend,
const wxSharedPtr<wxWebSessionFactory>& factory);
static bool IsBackendAvailable(const wxString& backend); static bool IsBackendAvailable(const wxString& backend);

View File

@@ -544,7 +544,8 @@ public:
@param backend The name for the new backend to be registered under @param backend The name for the new backend to be registered under
@param factory A shared pointer to the factory which creates the appropriate backend. @param factory A shared pointer to the factory which creates the appropriate backend.
*/ */
static void RegisterFactory(const wxString& backend, wxSharedPtr<wxWebSessionFactory> factory); static void RegisterFactory(const wxString& backend,
const wxSharedPtr<wxWebSessionFactory>& factory);
/** /**
Allows to check if the specified backend is available at runtime. Allows to check if the specified backend is available at runtime.

View File

@@ -431,7 +431,9 @@ wxWebSession* wxWebSession::New(const wxString& backend)
} }
// static // static
void wxWebSession::RegisterFactory(const wxString& backend, wxSharedPtr<wxWebSessionFactory> factory) void
wxWebSession::RegisterFactory(const wxString& backend,
const wxSharedPtr<wxWebSessionFactory>& factory)
{ {
ms_factoryMap[backend] = factory; ms_factoryMap[backend] = factory;
} }