Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Unified Diff: ppapi/proxy/ppb_var_deprecated_proxy.cc

Issue 6900009: Delay release of object Vars (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fgit try Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/ppb_var_deprecated_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_var_deprecated_proxy.cc
diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.cc b/ppapi/proxy/ppb_var_deprecated_proxy.cc
index 729baae68218ecda8afa59fe74a49ba63337091a..db98e3620dcae924e92ece7033c352d33137fc27 100644
--- a/ppapi/proxy/ppb_var_deprecated_proxy.cc
+++ b/ppapi/proxy/ppb_var_deprecated_proxy.cc
@@ -7,6 +7,8 @@
#include <stdlib.h> // For malloc
#include "base/logging.h"
+#include "base/message_loop.h"
+#include "base/task.h"
#include "ppapi/c/dev/ppb_var_deprecated.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/c/ppb_core.h"
@@ -296,7 +298,8 @@ InterfaceProxy* CreateVarDeprecatedProxy(Dispatcher* dispatcher,
PPB_Var_Deprecated_Proxy::PPB_Var_Deprecated_Proxy(
Dispatcher* dispatcher,
const void* target_interface)
- : InterfaceProxy(dispatcher, target_interface) {
+ : InterfaceProxy(dispatcher, target_interface),
+ task_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
PPB_Var_Deprecated_Proxy::~PPB_Var_Deprecated_Proxy() {
@@ -361,10 +364,9 @@ void PPB_Var_Deprecated_Proxy::OnMsgAddRefObject(int64 object_id,
}
void PPB_Var_Deprecated_Proxy::OnMsgReleaseObject(int64 object_id) {
- PP_Var var;
- var.type = PP_VARTYPE_OBJECT;
- var.value.as_id = object_id;
- ppb_var_target()->Release(var);
+ MessageLoop::current()->PostNonNestableTask(FROM_HERE,
brettw 2011/04/22 01:05:04 Can you add a very long comment here about why thi
piman 2011/04/22 02:28:11 Done.
+ task_factory_.NewRunnableMethod(
+ &PPB_Var_Deprecated_Proxy::DoReleaseObject, object_id));
}
void PPB_Var_Deprecated_Proxy::OnMsgHasProperty(
@@ -492,5 +494,12 @@ void PPB_Var_Deprecated_Proxy::SetAllowPluginReentrancy() {
static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy();
}
+void PPB_Var_Deprecated_Proxy::DoReleaseObject(int64 object_id) {
+ PP_Var var;
+ var.type = PP_VARTYPE_OBJECT;
+ var.value.as_id = object_id;
+ ppb_var_target()->Release(var);
+}
+
} // namespace proxy
} // namespace pp
« no previous file with comments | « ppapi/proxy/ppb_var_deprecated_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698