summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-02 17:51:19 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-02 17:51:19 +0000
commit1ca76b51f7b785e9dd99197f855dc8ed11394fc2 (patch)
treee08b28691e7c7b86858082f4a49fbd3794db0252 /remoting
parent2e069f78102bc89af305a52e0386e2959be6dd00 (diff)
downloadchromium_src-1ca76b51f7b785e9dd99197f855dc8ed11394fc2.zip
chromium_src-1ca76b51f7b785e9dd99197f855dc8ed11394fc2.tar.gz
chromium_src-1ca76b51f7b785e9dd99197f855dc8ed11394fc2.tar.bz2
Set up and tear down AtExitManager at the right times in the Host plugin.
BUG=84663 TEST=Run two instances of the Host plugin in separate tabs. The second one to start should no longer crash the plugin process. Review URL: http://codereview.chromium.org/7108004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87628 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/host_plugin.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/remoting/host/host_plugin.cc b/remoting/host/host_plugin.cc
index 11069d4..97422c6 100644
--- a/remoting/host/host_plugin.cc
+++ b/remoting/host/host_plugin.cc
@@ -70,6 +70,9 @@ namespace {
// Global netscape functions initialized in NP_Initialize.
NPNetscapeFuncs* g_npnetscape_funcs = NULL;
+// Global AtExitManager, created in NP_Initialize and destroyed in NP_Shutdown.
+base::AtExitManager* g_at_exit_manager = NULL;
+
// The name and description are returned by GetValue, but are also
// combined with the MIME type to satisfy GetMIMEDescription, so we
// use macros here to allow that to happen at compile-time.
@@ -314,7 +317,6 @@ class HostNPScriptObject {
int state_;
std::string access_code_;
NPObject* on_state_changed_func_;
- base::AtExitManager exit_manager_;
base::PlatformThreadId np_thread_id_;
scoped_refptr<remoting::RegisterSupportHostRequest> register_request_;
@@ -922,12 +924,16 @@ OSCALL NPError NP_Initialize(NPNetscapeFuncs* npnetscape_funcs
#endif // OS_LINUX
) {
LOG(INFO) << "NP_Initialize";
+ if (g_at_exit_manager)
+ return NPERR_MODULE_LOAD_FAILED_ERROR;
+
if(npnetscape_funcs == NULL)
return NPERR_INVALID_FUNCTABLE_ERROR;
if(((npnetscape_funcs->version & 0xff00) >> 8) > NP_VERSION_MAJOR)
return NPERR_INCOMPATIBLE_VERSION_ERROR;
+ g_at_exit_manager = new base::AtExitManager;
g_npnetscape_funcs = npnetscape_funcs;
#if defined(OS_LINUX)
NP_GetEntryPoints(nppfuncs);
@@ -937,6 +943,8 @@ OSCALL NPError NP_Initialize(NPNetscapeFuncs* npnetscape_funcs
OSCALL NPError NP_Shutdown() {
LOG(INFO) << "NP_Shutdown";
+ delete g_at_exit_manager;
+ g_at_exit_manager = NULL;
return NPERR_NO_ERROR;
}