Index: tests/fake_browser_ppapi/fake_host.h |
diff --git a/tests/fake_browser_ppapi/fake_host.h b/tests/fake_browser_ppapi/fake_host.h |
index 74d15c34e72c0b06f7c2635b8bdeef044fee571e..f0416f2b20ecdac8c59fd6c471ae44e8500c0179 100644 |
--- a/tests/fake_browser_ppapi/fake_host.h |
+++ b/tests/fake_browser_ppapi/fake_host.h |
@@ -12,6 +12,7 @@ |
#include <map> |
#include "native_client/src/include/portability.h" |
+#include "native_client/tests/fake_browser_ppapi/fake_instance.h" |
#include "native_client/tests/fake_browser_ppapi/fake_resource.h" |
#include "ppapi/c/ppp.h" |
@@ -37,13 +38,21 @@ class Host { |
return var_interface_; |
} |
- // Resource tracking. |
- // The host keeps track of all Resources assigning them a unique resource_id. |
- // TrackResource() is to be called right after instantiation of a Resource. |
- // GetResource() can be called to map an id to a tracked Resource. If |
- // there is no such resource, Resource::Invalid() is returned. |
+ // Resource and Instance tracking. |
+ // |
+ // The host keeps track of all Resources and Instances assigning them a unique |
+ // id. TrackResource/Instance() is to be called right after instantiation of a |
+ // Resource/Instance. GetResource/Instance () can be called to map an id to a |
+ // tracked Resource/Instance . If there is no such resource, |
+ // Resource::Invalid() or Instance::Invalid() is returned. |
+ // |
+ // Resources and Instances are owned by the host - in other words, they will |
+ // be deleted upon Host's destruction. Do not pass globals/stack variables |
+ // to be tracked! |
sehr (please use chromium)
2011/01/12 00:55:10
We could do this by using a factory pattern for In
neb
2011/01/13 00:00:43
Yup, but then Instances and Resources have differe
|
PP_Resource TrackResource(Resource* resource); |
Resource* GetResource(PP_Resource resource_id); |
+ PP_Instance TrackInstance(Instance* instance); |
+ Instance* GetInstance(PP_Instance instance_id); |
private: |
typedef int32_t (*InitializeModuleFunc)(PP_Module module, |
@@ -63,6 +72,11 @@ class Host { |
typedef std::map<PP_Resource, Resource*> ResourceMap; |
ResourceMap resource_map_; |
+ // Instance tracking. |
+ PP_Instance last_instance_id_; // Used and incremented for each new instance. |
+ typedef std::map<PP_Instance, Instance*> InstanceMap; |
+ InstanceMap instance_map_; |
+ |
NACL_DISALLOW_COPY_AND_ASSIGN(Host); |
}; |