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

Unified Diff: ppapi/cpp/instance.cc

Issue 9381010: Convert resources to take an instance key instead of an Instance*. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: USELESS PATCH TITLE Created 8 years, 10 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/cpp/instance.h ('k') | ppapi/cpp/instance_handle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/instance.cc
diff --git a/ppapi/cpp/instance.cc b/ppapi/cpp/instance.cc
index e42adf62ddd25e0f521761b79b02cca3acbc3936..56d88ab0ae2ebf0b8f02afd79e7038ac2e5af182 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).
+ 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);
« no previous file with comments | « ppapi/cpp/instance.h ('k') | ppapi/cpp/instance_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698