summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-07 22:00:34 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-07 22:00:34 +0000
commit9891f389497a8a7e392b5a72038628cfd42e16c0 (patch)
treee3fc07184c2a79a5ff28c70f2369c1e75230ad4a /ppapi
parent32d4e102a3a871f96b47bb71699994b58f5a4a08 (diff)
downloadchromium_src-9891f389497a8a7e392b5a72038628cfd42e16c0.zip
chromium_src-9891f389497a8a7e392b5a72038628cfd42e16c0.tar.gz
chromium_src-9891f389497a8a7e392b5a72038628cfd42e16c0.tar.bz2
PPAPI: Make ScopedModuleReference not crash on plugin side.
With this CL, using ScopedModuleReference is just a no-op there. This fixes a crash when using MouseLock out of process. BUG=None TEST=None Review URL: http://codereview.chromium.org/10383052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135737 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/proxy/host_dispatcher.cc13
-rw-r--r--ppapi/proxy/host_dispatcher.h5
2 files changed, 10 insertions, 8 deletions
diff --git a/ppapi/proxy/host_dispatcher.cc b/ppapi/proxy/host_dispatcher.cc
index 8a610e0..8cac0ef 100644
--- a/ppapi/proxy/host_dispatcher.cc
+++ b/ppapi/proxy/host_dispatcher.cc
@@ -248,14 +248,17 @@ void HostDispatcher::OnHostMsgLogWithSource(PP_Instance instance,
// ScopedModuleReference -------------------------------------------------------
-ScopedModuleReference::ScopedModuleReference(Dispatcher* dispatcher) {
- DCHECK(!dispatcher->IsPlugin());
- dispatcher_ = static_cast<HostDispatcher*>(dispatcher);
- dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module());
+ScopedModuleReference::ScopedModuleReference(Dispatcher* dispatcher)
+ : dispatcher_(NULL) {
+ if (!dispatcher->IsPlugin()) {
+ dispatcher_ = static_cast<HostDispatcher*>(dispatcher);
+ dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module());
+ }
}
ScopedModuleReference::~ScopedModuleReference() {
- dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module());
+ if (dispatcher_)
+ dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module());
}
} // namespace proxy
diff --git a/ppapi/proxy/host_dispatcher.h b/ppapi/proxy/host_dispatcher.h
index 82a0bf5..e7b5135 100644
--- a/ppapi/proxy/host_dispatcher.h
+++ b/ppapi/proxy/host_dispatcher.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -136,8 +136,7 @@ class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher {
// dispatcher) from being deleted out from under you. This is necessary when
// calling some scripting functions that may delete the plugin.
//
-// This may only be called in the host. The parameter is a plain Dispatcher
-// since that's what most callers have.
+// This class does nothing if used on the plugin side.
class ScopedModuleReference {
public:
explicit ScopedModuleReference(Dispatcher* dispatcher);