| Index: ppapi/cpp/dev/resource_array_dev.cc
|
| diff --git a/ppapi/cpp/dev/resource_array_dev.cc b/ppapi/cpp/dev/resource_array_dev.cc
|
| index 6a8493fc6d3cabc60848b644b14c437acee5b5a2..5bd2549326469ebbd5687841ffceeead17cbb604 100644
|
| --- a/ppapi/cpp/dev/resource_array_dev.cc
|
| +++ b/ppapi/cpp/dev/resource_array_dev.cc
|
| @@ -5,7 +5,10 @@
|
| #include "ppapi/cpp/dev/resource_array_dev.h"
|
|
|
| #include "ppapi/c/dev/ppb_resource_array_dev.h"
|
| +#include "ppapi/c/pp_errors.h"
|
| #include "ppapi/cpp/instance_handle.h"
|
| +#include "ppapi/cpp/logging.h"
|
| +#include "ppapi/cpp/module.h"
|
| #include "ppapi/cpp/module_impl.h"
|
|
|
| namespace pp {
|
| @@ -59,4 +62,31 @@ PP_Resource ResourceArray_Dev::operator[](uint32_t index) const {
|
| return get_interface<PPB_ResourceArray_Dev>()->GetAt(pp_resource(), index);
|
| }
|
|
|
| +// static
|
| +void ResourceArray_Dev::ArrayOutputCallbackConverter(void* user_data,
|
| + int32_t result) {
|
| + ArrayOutputCallbackData* data =
|
| + static_cast<ArrayOutputCallbackData*>(user_data);
|
| +
|
| + // data->resource_array_output should remain 0 if the call failed.
|
| + ResourceArray_Dev resources(PASS_REF, data->resource_array_output);
|
| + PP_DCHECK(resources.is_null() || result == PP_OK);
|
| +
|
| + // Need to issue the "GetDataBuffer" even for error cases and when the number
|
| + // of items is 0.
|
| + PP_Resource* output_buf = static_cast<PP_Resource*>(
|
| + data->output.GetDataBuffer(
|
| + data->output.user_data, resources.is_null() ? 0 : resources.size(),
|
| + sizeof(PP_Resource)));
|
| + if (output_buf) {
|
| + for (uint32_t index = 0; index < resources.size(); ++index) {
|
| + output_buf[index] = resources[index];
|
| + Module::Get()->core()->AddRefResource(output_buf[index]);
|
| + }
|
| + }
|
| +
|
| + PP_RunCompletionCallback(&data->original_callback, result);
|
| + delete data;
|
| +}
|
| +
|
| } // namespace pp
|
|
|