summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-27 20:28:18 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-27 20:28:18 +0000
commit246fc49935cd37deba43624861f236acc016aa48 (patch)
tree8dbc89fc8304cfa0409dc83ccb8b94b01d3def8f /ppapi/shared_impl
parent906960ba1d7a27bb458fca480a20aa33c61ebdb6 (diff)
downloadchromium_src-246fc49935cd37deba43624861f236acc016aa48.zip
chromium_src-246fc49935cd37deba43624861f236acc016aa48.tar.gz
chromium_src-246fc49935cd37deba43624861f236acc016aa48.tar.bz2
PPAPI/NaCl: Make NaClIPCAdapter transfer handles more generally
This does a couple of things: - It defines a new wrapper for passing any kind of handle through the PPAPI proxy (SerializedHandle). - It updates nacl_ipc_adapter to have a more general way to pick apart messages based on their static types (which include the types of all the params). - It adds support for PPB_Graphics2D and PPB_Graphics3D to the NaCl IPC proxy (e.g., NaCl SDK examples pi_generator and tumbler work in the new proxy with this patch). The downside is it requires pulling parts of ppapi/shared_impl and ppapi/proxy in to the NaCl Win64 build. BUG=116317 TEST= Review URL: https://chromiumcodereview.appspot.com/10828023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153531 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl')
-rw-r--r--ppapi/shared_impl/host_resource.cc25
-rw-r--r--ppapi/shared_impl/host_resource.h14
-rw-r--r--ppapi/shared_impl/ppb_audio_shared.h1
-rw-r--r--ppapi/shared_impl/ppb_device_ref_shared.cc3
-rw-r--r--ppapi/shared_impl/ppb_image_data_shared.cc22
-rw-r--r--ppapi/shared_impl/ppb_input_event_shared.cc8
-rw-r--r--ppapi/shared_impl/ppb_network_list_private_shared.cc4
-rw-r--r--ppapi/shared_impl/var.cc2
8 files changed, 52 insertions, 27 deletions
diff --git a/ppapi/shared_impl/host_resource.cc b/ppapi/shared_impl/host_resource.cc
new file mode 100644
index 0000000..031a5f0
--- /dev/null
+++ b/ppapi/shared_impl/host_resource.cc
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 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.
+
+#include "ppapi/shared_impl/host_resource.h"
+
+namespace ppapi {
+
+HostResource::HostResource() : instance_(0), host_resource_(0) {
+}
+
+// static
+HostResource HostResource::MakeInstanceOnly(PP_Instance instance) {
+ HostResource resource;
+ resource.SetHostResource(instance, 0);
+ return resource;
+}
+
+void HostResource::SetHostResource(PP_Instance instance, PP_Resource resource) {
+ instance_ = instance;
+ host_resource_ = resource;
+}
+
+} // namespace ppapi
+
diff --git a/ppapi/shared_impl/host_resource.h b/ppapi/shared_impl/host_resource.h
index b614546..c98d2d6 100644
--- a/ppapi/shared_impl/host_resource.h
+++ b/ppapi/shared_impl/host_resource.h
@@ -20,8 +20,7 @@ namespace ppapi {
// All HostResources respresent IDs valid in the host.
class PPAPI_SHARED_EXPORT HostResource {
public:
- HostResource() : instance_(0), host_resource_(0) {
- }
+ HostResource();
bool is_null() const {
return !host_resource_;
@@ -31,21 +30,14 @@ class PPAPI_SHARED_EXPORT HostResource {
// resource in the host. Yet these resources still need an instance to be
// associated with. This function creates a HostResource with the given
// instances and a 0 host resource ID for these cases.
- static HostResource MakeInstanceOnly(PP_Instance instance) {
- HostResource resource;
- resource.SetHostResource(instance, 0);
- return resource;
- }
+ static HostResource MakeInstanceOnly(PP_Instance instance);
// Sets and retrieves the internal PP_Resource which is valid for the host
// (a.k.a. renderer, as opposed to the plugin) process.
//
// DO NOT CALL THESE FUNCTIONS IN THE PLUGIN SIDE OF THE PROXY. The values
// will be invalid. See the class comment above.
- void SetHostResource(PP_Instance instance, PP_Resource resource) {
- instance_ = instance;
- host_resource_ = resource;
- }
+ void SetHostResource(PP_Instance instance, PP_Resource resource);
PP_Resource host_resource() const {
return host_resource_;
}
diff --git a/ppapi/shared_impl/ppb_audio_shared.h b/ppapi/shared_impl/ppb_audio_shared.h
index 8858e5c..ed3a5c2 100644
--- a/ppapi/shared_impl/ppb_audio_shared.h
+++ b/ppapi/shared_impl/ppb_audio_shared.h
@@ -60,6 +60,7 @@ class PPAPI_SHARED_EXPORT PPB_Audio_Shared
// into user code.
static void SetThreadFunctions(const struct PP_ThreadFunctions* functions);
#endif
+
private:
// Starts execution of the audio thread.
void StartThread();
diff --git a/ppapi/shared_impl/ppb_device_ref_shared.cc b/ppapi/shared_impl/ppb_device_ref_shared.cc
index 15a3a7b..73a9a7c 100644
--- a/ppapi/shared_impl/ppb_device_ref_shared.cc
+++ b/ppapi/shared_impl/ppb_device_ref_shared.cc
@@ -58,7 +58,8 @@ PP_Resource PPB_DeviceRef_Shared::CreateResourceArray(
}
}
PPB_ResourceArray_Shared* array_object =
- new PPB_ResourceArray_Shared(type, instance, elements.get(), size);
+ new PPB_ResourceArray_Shared(type, instance, elements.get(),
+ static_cast<uint32_t>(size));
for (size_t index = 0; index < size; ++index)
PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(elements[index]);
diff --git a/ppapi/shared_impl/ppb_image_data_shared.cc b/ppapi/shared_impl/ppb_image_data_shared.cc
index deec2ac..abdea60 100644
--- a/ppapi/shared_impl/ppb_image_data_shared.cc
+++ b/ppapi/shared_impl/ppb_image_data_shared.cc
@@ -4,9 +4,10 @@
#include "ppapi/shared_impl/ppb_image_data_shared.h"
+#include "base/logging.h"
#include "build/build_config.h"
-#if !defined(OS_NACL)
+#if !defined(OS_NACL) && !defined(NACL_WIN64)
#include "third_party/skia/include/core/SkTypes.h"
#endif
@@ -14,18 +15,23 @@ namespace ppapi {
// static
PP_ImageDataFormat PPB_ImageData_Shared::GetNativeImageDataFormat() {
-#if !defined(OS_NACL)
- if (SK_B32_SHIFT == 0)
+#if defined(OS_NACL)
+ // In NaCl, just default to something. If we're wrong, it will be converted
+ // later.
+ // TODO(dmichael): Really proxy this.
+ return PP_IMAGEDATAFORMAT_BGRA_PREMUL;
+#elif defined(NACL_WIN64)
+ // In the NaCl Win64 helper, this shouldn't be called. If we start building
+ // Chrome on Windows 64 for realz, we should really implement this.
+ NOTIMPLEMENTED();
+ return PP_IMAGEDATAFORMAT_BGRA_PREMUL;
+#else
+ return PP_IMAGEDATAFORMAT_BGRA_PREMUL; if (SK_B32_SHIFT == 0)
return PP_IMAGEDATAFORMAT_BGRA_PREMUL;
else if (SK_R32_SHIFT == 0)
return PP_IMAGEDATAFORMAT_RGBA_PREMUL;
else
return PP_IMAGEDATAFORMAT_BGRA_PREMUL; // Default to something on failure.
-#else
- // In NaCl, just default to something. If we're wrong, it will be converted
- // later.
- // TODO(dmichael): Really proxy this.
- return PP_IMAGEDATAFORMAT_BGRA_PREMUL;
#endif
}
diff --git a/ppapi/shared_impl/ppb_input_event_shared.cc b/ppapi/shared_impl/ppb_input_event_shared.cc
index 0d7ebb9..4cd918d 100644
--- a/ppapi/shared_impl/ppb_input_event_shared.cc
+++ b/ppapi/shared_impl/ppb_input_event_shared.cc
@@ -111,7 +111,7 @@ uint32_t PPB_InputEvent_Shared::GetUsbKeyCode() {
uint32_t PPB_InputEvent_Shared::GetIMESegmentNumber() {
if (data_.composition_segment_offsets.empty())
return 0;
- return data_.composition_segment_offsets.size() - 1;
+ return static_cast<uint32_t>(data_.composition_segment_offsets.size() - 1);
}
uint32_t PPB_InputEvent_Shared::GetIMESegmentOffset(uint32_t index) {
@@ -151,11 +151,11 @@ void PPB_InputEvent_Shared::AddTouchPoint(PP_TouchListType list,
uint32_t PPB_InputEvent_Shared::GetTouchCount(PP_TouchListType list) {
switch (list) {
case PP_TOUCHLIST_TYPE_TOUCHES:
- return data_.touches.size();
+ return static_cast<uint32_t>(data_.touches.size());
case PP_TOUCHLIST_TYPE_CHANGEDTOUCHES:
- return data_.changed_touches.size();
+ return static_cast<uint32_t>(data_.changed_touches.size());
case PP_TOUCHLIST_TYPE_TARGETTOUCHES:
- return data_.target_touches.size();
+ return static_cast<uint32_t>(data_.target_touches.size());
}
return 0;
diff --git a/ppapi/shared_impl/ppb_network_list_private_shared.cc b/ppapi/shared_impl/ppb_network_list_private_shared.cc
index 6f8c67c..0430289 100644
--- a/ppapi/shared_impl/ppb_network_list_private_shared.cc
+++ b/ppapi/shared_impl/ppb_network_list_private_shared.cc
@@ -58,7 +58,7 @@ const NetworkList& PPB_NetworkList_Private_Shared::GetNetworkListData() const {
}
uint32_t PPB_NetworkList_Private_Shared::GetCount() {
- return list_->list().size();
+ return static_cast<uint32_t>(list_->list().size());
}
PP_Var PPB_NetworkList_Private_Shared::GetName(uint32_t index) {
@@ -91,7 +91,7 @@ int32_t PPB_NetworkList_Private_Shared::GetIpAddresses(
count, static_cast<uint32_t>(list_->list().at(index).addresses.size()));
memcpy(addresses, &(list_->list().at(index).addresses[0]),
sizeof(PP_NetAddress_Private) * count);
- return list_->list().at(index).addresses.size();
+ return static_cast<int32_t>(list_->list().at(index).addresses.size());
}
PP_Var PPB_NetworkList_Private_Shared::GetDisplayName(uint32_t index) {
diff --git a/ppapi/shared_impl/var.cc b/ppapi/shared_impl/var.cc
index da7a2cb..2e63dbe 100644
--- a/ppapi/shared_impl/var.cc
+++ b/ppapi/shared_impl/var.cc
@@ -137,7 +137,7 @@ PP_VarType StringVar::GetType() const {
// static
PP_Var StringVar::StringToPPVar(const std::string& var) {
- return StringToPPVar(var.c_str(), var.size());
+ return StringToPPVar(var.c_str(), static_cast<uint32>(var.size()));
}
// static