summaryrefslogtreecommitdiffstats
path: root/ppapi/thunk/ppb_url_loader_thunk.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/thunk/ppb_url_loader_thunk.cc')
-rw-r--r--ppapi/thunk/ppb_url_loader_thunk.cc94
1 files changed, 43 insertions, 51 deletions
diff --git a/ppapi/thunk/ppb_url_loader_thunk.cc b/ppapi/thunk/ppb_url_loader_thunk.cc
index 23113cd..fc38023 100644
--- a/ppapi/thunk/ppb_url_loader_thunk.cc
+++ b/ppapi/thunk/ppb_url_loader_thunk.cc
@@ -2,22 +2,27 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// From ppb_url_loader.idl modified Wed Apr 17 10:03:38 2013.
+
+#include <string.h>
+
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_url_loader.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/ppb_instance_api.h"
#include "ppapi/thunk/ppb_url_loader_api.h"
#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
namespace ppapi {
namespace thunk {
namespace {
-typedef EnterResource<PPB_URLLoader_API> EnterURLLoader;
-
PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_URLLoader::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
@@ -25,22 +30,25 @@ PP_Resource Create(PP_Instance instance) {
}
PP_Bool IsURLLoader(PP_Resource resource) {
- EnterURLLoader enter(resource, false);
+ VLOG(4) << "PPB_URLLoader::IsURLLoader()";
+ EnterResource<PPB_URLLoader_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
int32_t Open(PP_Resource loader,
- PP_Resource request_id,
- PP_CompletionCallback callback) {
- EnterURLLoader enter(loader, callback, true);
+ PP_Resource request_info,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_URLLoader::Open()";
+ EnterResource<PPB_URLLoader_API> enter(loader, callback, true);
if (enter.failed())
return enter.retval();
- return enter.SetResult(enter.object()->Open(request_id, enter.callback()));
+ return enter.SetResult(enter.object()->Open(request_info, enter.callback()));
}
int32_t FollowRedirect(PP_Resource loader,
- PP_CompletionCallback callback) {
- EnterURLLoader enter(loader, callback, true);
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_URLLoader::FollowRedirect()";
+ EnterResource<PPB_URLLoader_API> enter(loader, callback, true);
if (enter.failed())
return enter.retval();
return enter.SetResult(enter.object()->FollowRedirect(enter.callback()));
@@ -49,23 +57,24 @@ int32_t FollowRedirect(PP_Resource loader,
PP_Bool GetUploadProgress(PP_Resource loader,
int64_t* bytes_sent,
int64_t* total_bytes_to_be_sent) {
- EnterURLLoader enter(loader, true);
+ VLOG(4) << "PPB_URLLoader::GetUploadProgress()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
if (enter.failed()) {
- *bytes_sent = 0;
- *total_bytes_to_be_sent = 0;
+ memset(bytes_sent, 0, sizeof(bytes_sent));
+ memset(total_bytes_to_be_sent, 0, sizeof(total_bytes_to_be_sent));
return PP_FALSE;
}
- return enter.object()->GetUploadProgress(bytes_sent,
- total_bytes_to_be_sent);
+ return enter.object()->GetUploadProgress(bytes_sent, total_bytes_to_be_sent);
}
PP_Bool GetDownloadProgress(PP_Resource loader,
int64_t* bytes_received,
int64_t* total_bytes_to_be_received) {
- EnterURLLoader enter(loader, true);
+ VLOG(4) << "PPB_URLLoader::GetDownloadProgress()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
if (enter.failed()) {
- *bytes_received = 0;
- *total_bytes_to_be_received = 0;
+ memset(bytes_received, 0, sizeof(bytes_received));
+ memset(total_bytes_to_be_received, 0, sizeof(total_bytes_to_be_received));
return PP_FALSE;
}
return enter.object()->GetDownloadProgress(bytes_received,
@@ -73,7 +82,8 @@ PP_Bool GetDownloadProgress(PP_Resource loader,
}
PP_Resource GetResponseInfo(PP_Resource loader) {
- EnterURLLoader enter(loader, true);
+ VLOG(4) << "PPB_URLLoader::GetResponseInfo()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
if (enter.failed())
return 0;
return enter.object()->GetResponseInfo();
@@ -82,43 +92,34 @@ PP_Resource GetResponseInfo(PP_Resource loader) {
int32_t ReadResponseBody(PP_Resource loader,
void* buffer,
int32_t bytes_to_read,
- PP_CompletionCallback callback) {
- EnterURLLoader enter(loader, callback, true);
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_URLLoader::ReadResponseBody()";
+ EnterResource<PPB_URLLoader_API> enter(loader, callback, true);
if (enter.failed())
return enter.retval();
- return enter.SetResult(enter.object()->ReadResponseBody(buffer, bytes_to_read,
+ return enter.SetResult(enter.object()->ReadResponseBody(buffer,
+ bytes_to_read,
enter.callback()));
}
int32_t FinishStreamingToFile(PP_Resource loader,
- PP_CompletionCallback callback) {
- EnterURLLoader enter(loader, callback, true);
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_URLLoader::FinishStreamingToFile()";
+ EnterResource<PPB_URLLoader_API> enter(loader, callback, true);
if (enter.failed())
return enter.retval();
- return enter.SetResult(
- enter.object()->FinishStreamingToFile(enter.callback()));
+ return enter.SetResult(enter.object()->FinishStreamingToFile(
+ enter.callback()));
}
void Close(PP_Resource loader) {
- EnterURLLoader enter(loader, true);
+ VLOG(4) << "PPB_URLLoader::Close()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
if (enter.succeeded())
enter.object()->Close();
}
-void GrantUniversalAccess(PP_Resource loader) {
- EnterURLLoader enter(loader, true);
- if (enter.succeeded())
- enter.object()->GrantUniversalAccess();
-}
-
-void SetStatusCallback(PP_Resource loader,
- PP_URLLoaderTrusted_StatusCallback cb) {
- EnterURLLoader enter(loader, true);
- if (enter.succeeded())
- enter.object()->SetStatusCallback(cb);
-}
-
-const PPB_URLLoader g_ppb_urlloader_thunk = {
+const PPB_URLLoader_1_0 g_ppb_urlloader_thunk_1_0 = {
&Create,
&IsURLLoader,
&Open,
@@ -131,19 +132,10 @@ const PPB_URLLoader g_ppb_urlloader_thunk = {
&Close
};
-const PPB_URLLoaderTrusted g_ppb_urlloader_trusted_thunk = {
- &GrantUniversalAccess,
- &SetStatusCallback
-};
-
} // namespace
const PPB_URLLoader_1_0* GetPPB_URLLoader_1_0_Thunk() {
- return &g_ppb_urlloader_thunk;
-}
-
-const PPB_URLLoaderTrusted_0_3* GetPPB_URLLoaderTrusted_0_3_Thunk() {
- return &g_ppb_urlloader_trusted_thunk;
+ return &g_ppb_urlloader_thunk_1_0;
}
} // namespace thunk