Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/plugin/PluginClass.cpp

Issue 5032147387678720: NoIssue - Refactor HTTP and HTTPS namespaces registration
Patch Set: Created April 13, 2015, 3:14 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/plugin/PluginClass.h ('k') | src/plugin/PluginFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/plugin/PluginClass.cpp
===================================================================
--- a/src/plugin/PluginClass.cpp
+++ b/src/plugin/PluginClass.cpp
@@ -23,7 +23,6 @@
#include "PluginFilter.h"
#include "PluginMimeFilterClient.h"
#include "PluginClient.h"
-#include "PluginClientFactory.h"
#include "PluginMutex.h"
#include "sddl.h"
#include "PluginUtil.h"
@@ -47,7 +46,7 @@
uint32_t iconHeight = 32;
uint32_t iconWidth = 32;
-CPluginMimeFilterClient* CPluginClass::s_mimeFilter = NULL;
+std::shared_ptr<CPluginMimeFilterClient> CPluginClass::s_mimeFilter = NULL;
CLOSETHEMEDATA pfnClose = NULL;
DRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL;
@@ -247,7 +246,10 @@
s_criticalSectionLocal.Lock();
{
// Always register on startup, then check if we need to unregister in a separate thread
- s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance();
+ if (!s_mimeFilter)
+ {
+ s_mimeFilter.reset(new CPluginMimeFilterClient());
+ }
s_asyncWebBrowser2 = unknownSite;
s_instances.insert(this);
}
@@ -320,11 +322,6 @@
{
s_threadInstances.erase(it);
}
- if (s_instances.empty())
- {
- // TODO: Explicitly releasing a resource when a container becomes empty looks like a job better suited for shared_ptr
- CPluginClientFactory::ReleaseMimeFilterClientInstance();
- }
}
s_criticalSectionLocal.Unlock();
@@ -630,7 +627,7 @@
if (!settings->GetPluginEnabled())
{
- s_mimeFilter->Unregister();
+ s_mimeFilter.reset();
}
// Load theme module
@@ -1089,13 +1086,11 @@
{
if (settings->GetPluginEnabled())
{
- s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance();
+ s_mimeFilter.reset(new CPluginMimeFilterClient());
}
else
{
- s_mimeFilter = NULL;
-
- CPluginClientFactory::ReleaseMimeFilterClientInstance();
+ s_mimeFilter.reset();
}
}
s_criticalSectionLocal.Unlock();
« no previous file with comments | « src/plugin/PluginClass.h ('k') | src/plugin/PluginFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld