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

Unified Diff: ppapi/proxy/ppb_buffer_proxy.cc

Issue 6334016: Refactor PPAPI proxy resource handling to maintain which host they came from,... (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_buffer_proxy.h ('k') | ppapi/proxy/ppb_core_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_buffer_proxy.cc
===================================================================
--- ppapi/proxy/ppb_buffer_proxy.cc (revision 72840)
+++ ppapi/proxy/ppb_buffer_proxy.cc (working copy)
@@ -20,7 +20,9 @@
class Buffer : public PluginResource {
public:
- Buffer(PP_Instance instance, int memory_handle, uint32_t size);
+ Buffer(const HostResource& resource,
+ int memory_handle,
+ uint32_t size);
virtual ~Buffer();
// Resource overrides.
@@ -40,8 +42,10 @@
DISALLOW_COPY_AND_ASSIGN(Buffer);
};
-Buffer::Buffer(PP_Instance instance, int memory_handle, uint32_t size)
- : PluginResource(instance),
+Buffer::Buffer(const HostResource& resource,
+ int memory_handle,
+ uint32_t size)
+ : PluginResource(resource),
memory_handle_(memory_handle),
size_(size),
mapped_data_(NULL) {
@@ -63,19 +67,18 @@
namespace {
PP_Resource Create(PP_Instance instance, uint32_t size) {
- PP_Resource result = 0;
+ HostResource result;
int32_t shm_handle = -1;
PluginDispatcher::GetForInstance(instance)->Send(
new PpapiHostMsg_PPBBuffer_Create(
INTERFACE_ID_PPB_BUFFER, instance, size,
&result, &shm_handle));
- if (!result)
+ if (result.is_null())
return 0;
- linked_ptr<Buffer> object(new Buffer(instance, static_cast<int>(shm_handle),
- size));
- PluginResourceTracker::GetInstance()->AddResource(result, object);
- return result;
+ linked_ptr<Buffer> object(new Buffer(result,
+ static_cast<int>(shm_handle), size));
+ return PluginResourceTracker::GetInstance()->AddResource(object);
}
PP_Bool IsBuffer(PP_Resource resource) {
@@ -144,9 +147,11 @@
void PPB_Buffer_Proxy::OnMsgCreate(PP_Instance instance,
uint32_t size,
- PP_Resource* result_resource,
+ HostResource* result_resource,
int* result_shm_handle) {
- *result_resource = ppb_buffer_target()->Create(instance, size);
+ result_resource->SetHostResource(
+ instance,
+ ppb_buffer_target()->Create(instance, size));
// TODO(brettw) set the shm handle from a trusted interface.
*result_shm_handle = 0;
}
« no previous file with comments | « ppapi/proxy/ppb_buffer_proxy.h ('k') | ppapi/proxy/ppb_core_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698