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

Unified Diff: ppapi/proxy/ppb_testing_proxy.cc

Issue 6282007: First pass at making the proxy handle multiple renderers. This associates the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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
« no previous file with comments | « ppapi/proxy/ppb_testing_proxy.h ('k') | ppapi/proxy/ppb_url_loader_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_testing_proxy.cc
===================================================================
--- ppapi/proxy/ppb_testing_proxy.cc (revision 71973)
+++ ppapi/proxy/ppb_testing_proxy.cc (working copy)
@@ -6,6 +6,7 @@
#include "base/message_loop.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
+#include "ppapi/proxy/image_data.h"
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/ppapi_messages.h"
@@ -17,8 +18,16 @@
PP_Bool ReadImageData(PP_Resource device_context_2d,
PP_Resource image,
const PP_Point* top_left) {
+ ImageData* image_object = PluginResource::GetAs<ImageData>(image);
+ if (!image_object)
+ return PP_FALSE;
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(
+ image_object->instance());
+ if (!dispatcher)
+ return PP_FALSE;
+
PP_Bool result = PP_FALSE;
- PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBTesting_ReadImageData(
+ dispatcher->Send(new PpapiHostMsg_PPBTesting_ReadImageData(
INTERFACE_ID_PPB_TESTING, device_context_2d, image, *top_left, &result));
return result;
}
@@ -34,10 +43,14 @@
MessageLoop::current()->QuitNow();
}
-uint32_t GetLiveObjectCount(PP_Module module_id) {
+uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) {
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
+ if (!dispatcher)
+ return static_cast<uint32_t>(-1);
+
uint32_t result = 0;
- PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBTesting_GetLiveObjectCount(
- INTERFACE_ID_PPB_TESTING, module_id, &result));
+ dispatcher->Send(new PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance(
+ INTERFACE_ID_PPB_TESTING, instance_id, &result));
return result;
}
@@ -45,7 +58,7 @@
&ReadImageData,
&RunMessageLoop,
&QuitMessageLoop,
- &GetLiveObjectCount
+ &GetLiveObjectsForInstance
};
} // namespace
@@ -75,8 +88,8 @@
OnMsgRunMessageLoop)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_QuitMessageLoop,
OnMsgQuitMessageLoop)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_GetLiveObjectCount,
- OnMsgGetLiveObjectCount)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance,
+ OnMsgGetLiveObjectsForInstance)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -99,9 +112,9 @@
ppb_testing_target()->QuitMessageLoop();
}
-void PPB_Testing_Proxy::OnMsgGetLiveObjectCount(PP_Module module_id,
+void PPB_Testing_Proxy::OnMsgGetLiveObjectsForInstance(PP_Instance instance,
uint32_t* result) {
- *result = ppb_testing_target()->GetLiveObjectCount(module_id);
+ *result = ppb_testing_target()->GetLiveObjectsForInstance(instance);
}
} // namespace proxy
« no previous file with comments | « ppapi/proxy/ppb_testing_proxy.h ('k') | ppapi/proxy/ppb_url_loader_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698