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

Unified Diff: tests/fake_browser_ppapi/fake_host.cc

Issue 6218004: Resource64->32, NaCl side. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: First Created 9 years, 11 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
Index: tests/fake_browser_ppapi/fake_host.cc
diff --git a/tests/fake_browser_ppapi/fake_host.cc b/tests/fake_browser_ppapi/fake_host.cc
index cfdd63ef21a5f83c89271d6f933f0b12b6dcf5fd..a77f3e95de55683874c492172e8dfc2f360343db 100644
--- a/tests/fake_browser_ppapi/fake_host.cc
+++ b/tests/fake_browser_ppapi/fake_host.cc
@@ -62,10 +62,16 @@ Host::~Host() {
int rc = dlclose(dl_handle_);
CHECK(rc == 0);
- ResourceMap::iterator it;
- while ((it = resource_map_.begin()) != resource_map_.end()) {
- delete(it->second);
- resource_map_.erase(it);
+ ResourceMap::iterator ri;
+ while ((ri = resource_map_.begin()) != resource_map_.end()) {
+ delete(ri->second);
+ resource_map_.erase(ri);
+ }
+
+ InstanceMap::iterator ii;
+ while ((ii = instance_map_.begin()) != instance_map_.end()) {
+ delete(ii->second);
+ instance_map_.erase(ii);
}
}
@@ -85,6 +91,7 @@ const void* Host::GetInterface(const char* interface_name) {
PP_Resource Host::TrackResource(Resource* resource) {
PP_Resource resource_id = ++last_resource_id_;
resource_map_[resource_id] = resource;
+ resource->set_resource_id(resource_id);
return resource_id;
}
@@ -95,4 +102,18 @@ Resource* Host::GetResource(PP_Resource resource_id) {
return iter->second;
}
+PP_Instance Host::TrackInstance(Instance* instance) {
+ PP_Instance instance_id = ++last_instance_id_;
+ instance_map_[instance_id] = instance;
+ instance->set_instance_id(instance_id);
+ return instance_id;
+}
+
+Instance* Host::GetInstance(PP_Instance instance_id) {
+ InstanceMap::iterator iter = instance_map_.find(instance_id);
+ if (iter == instance_map_.end())
+ return Instance::Invalid();
+ return iter->second;
+}
+
} // namespace fake_browser_ppapi

Powered by Google App Engine
This is Rietveld 408576698