Index: ppapi/cpp/instance.cc |
diff --git a/ppapi/cpp/instance.cc b/ppapi/cpp/instance.cc |
index e42adf62ddd25e0f521761b79b02cca3acbc3936..5a8f46dad33ae8a056ab4dca4242d94644dab335 100644 |
--- a/ppapi/cpp/instance.cc |
+++ b/ppapi/cpp/instance.cc |
@@ -11,6 +11,7 @@ |
#include "ppapi/cpp/graphics_2d.h" |
#include "ppapi/cpp/graphics_3d.h" |
#include "ppapi/cpp/image_data.h" |
+#include "ppapi/cpp/instance_handle.h" |
#include "ppapi/cpp/logging.h" |
#include "ppapi/cpp/module.h" |
#include "ppapi/cpp/module_impl.h" |
@@ -137,6 +138,18 @@ void Instance::AddPerInstanceObject(const std::string& interface_name, |
interface_name_to_objects_[interface_name] = object; |
} |
+// static |
+void Instance::AddPerInstanceObject(const InstanceHandle& instance, |
+ const std::string& interface_name, |
+ void* object) { |
+ // TODO(brettw) assert we're on the main thread (instance is not threadsafe |
+ // and may be deleted from the main thread)> |
dmichael (off chromium)
2012/02/22 21:38:44
nit: ">" -> "."
|
+ Instance* that = Module::Get()->InstanceForPPInstance(instance.pp_instance()); |
+ if (!that) |
+ return; |
+ that->AddPerInstanceObject(interface_name, object); |
+} |
+ |
void Instance::RemovePerInstanceObject(const std::string& interface_name, |
void* object) { |
InterfaceNameToObjectMap::iterator found = interface_name_to_objects_.find( |
@@ -156,6 +169,17 @@ void Instance::RemovePerInstanceObject(const std::string& interface_name, |
} |
// static |
+void Instance::RemovePerInstanceObject(const InstanceHandle& instance, |
+ const std::string& interface_name, |
+ void* object) { |
+ // TODO(brettw) assert we're on the main thread. |
+ Instance* that = Module::Get()->InstanceForPPInstance(instance.pp_instance()); |
+ if (!that) |
+ return; |
+ that->RemovePerInstanceObject(interface_name, object); |
+} |
+ |
+// static |
void* Instance::GetPerInstanceObject(PP_Instance instance, |
const std::string& interface_name) { |
Instance* that = Module::Get()->InstanceForPPInstance(instance); |