Refactor PPAPI proxy resource handling to maintain which host they came from,
and to map back to that host when calling functions on them. Adds a mapping
between resources generated by the hosts to a new list inside the plugin so
there can't be overlaps.
This means there are now two meanings for a PP_Resource, one in the plugin
process and one in the host process. This is potentially very confusing. I
introduced a new object called a HostResource that always represents a
"host" PP_Resource to try to prevent errors. In the plugin side of the proxy,
it only deals with PP_Resources valid in the plugin, and SerializedResources
valid in the host. It also encapsulates the associated instance, which
simplifies some code.
Each PluginResource object maintains its SerializedResource which the proxy
uses to send to the host for requests. This requires getting the PluginResource
object in more proxy calls.
This fixes a bug in var sending introduced in my previous patch. The var
releasing from EndSendPassRef used the host var rather than the plugin var. I
had to add more plumbing to get the dispatcher at this location and convert
to a plugin var.
I removed the separate file for ImageData and put it in ppb_image_data_proxy
like for the other resource types.
TEST=some unit tests included
BUG=none
Review URL: http://codereview.chromium.org/6334016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72879 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/proxy/serialized_structs.h b/ppapi/proxy/serialized_structs.h
index 496fd3a6..8b40042f 100644
--- a/ppapi/proxy/serialized_structs.h
+++ b/ppapi/proxy/serialized_structs.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,11 +10,12 @@
#include "base/shared_memory.h"
#include "build/build_config.h"
+#include "ipc/ipc_platform_file.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_point.h"
#include "ppapi/c/pp_rect.h"
-#include "ppapi/c/pp_resource.h"
+#include "ppapi/proxy/host_resource.h"
#include "ppapi/proxy/serialized_var.h"
struct PP_FontDescription_Dev;
@@ -74,8 +75,8 @@
// is a var, it's much more convenient to use the normal way of passing a
// PP_Var.
struct PPBFont_DrawTextAt_Params {
- PP_Resource font;
- PP_Resource image_data;
+ HostResource font;
+ HostResource image_data;
PP_Bool text_is_rtl;
PP_Bool override_direction;
PP_Point position;
@@ -90,7 +91,7 @@
~PPBFlash_DrawGlyphs_Params();
PP_Instance instance;
- PP_Resource pp_image_data;
+ HostResource image_data;
SerializedFontDescription font_desc;
uint32_t color;
PP_Point position;
@@ -100,6 +101,23 @@
std::vector<PP_Point> glyph_advances;
};
+struct PPBAudio_NotifyAudioStreamCreated_Params {
+ pp::proxy::HostResource audio_id;
+ int32_t result_code; // Will be != PP_OK on failure
+ IPC::PlatformFileForTransit socket_handle;
+ base::SharedMemoryHandle handle;
+ int32_t length;
+};
+
+struct PPBURLLoader_UpdateProgress_Params {
+ PP_Instance instance;
+ pp::proxy::HostResource resource;
+ int64_t bytes_sent;
+ int64_t total_bytes_to_be_sent;
+ int64_t bytes_received;
+ int64_t total_bytes_to_be_received;
+};
+
#if defined(OS_WIN)
typedef HANDLE ImageHandle;
#elif defined(OS_MACOSX)