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

Unified Diff: ppapi/thunk/ppb_url_loader_thunk.cc

Issue 11417145: Provide a safer URLLoader ReadResponseBody API (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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/thunk/ppb_url_loader_api.h ('k') | webkit/plugins/ppapi/ppb_url_loader_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/thunk/ppb_url_loader_thunk.cc
diff --git a/ppapi/thunk/ppb_url_loader_thunk.cc b/ppapi/thunk/ppb_url_loader_thunk.cc
index 23113cd1ce7aff0d65276b46e71df536cabc3db1..00fd0bac5c060c671e3ff8e9f7fd2bb45675fc99 100644
--- a/ppapi/thunk/ppb_url_loader_thunk.cc
+++ b/ppapi/thunk/ppb_url_loader_thunk.cc
@@ -90,6 +90,17 @@ int32_t ReadResponseBody(PP_Resource loader,
enter.callback()));
}
+int32_t ReadResponseBodyToArray(PP_Resource loader,
+ int32_t max_read_length,
+ PP_ArrayOutput* buffer,
+ PP_CompletionCallback callback) {
+ EnterURLLoader enter(loader, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->ReadResponseBodyToArray(
+ max_read_length, buffer, enter.callback()));
+}
+
int32_t FinishStreamingToFile(PP_Resource loader,
PP_CompletionCallback callback) {
EnterURLLoader enter(loader, callback, true);
@@ -118,7 +129,21 @@ void SetStatusCallback(PP_Resource loader,
enter.object()->SetStatusCallback(cb);
}
-const PPB_URLLoader g_ppb_urlloader_thunk = {
+const PPB_URLLoader_1_1 g_ppb_urlloader_thunk = {
+ &Create,
+ &IsURLLoader,
+ &Open,
+ &FollowRedirect,
+ &GetUploadProgress,
+ &GetDownloadProgress,
+ &GetResponseInfo,
+ &ReadResponseBody,
+ &FinishStreamingToFile,
+ &Close,
+ &ReadResponseBodyToArray
+};
+
+const PPB_URLLoader_1_0 g_ppb_urlloader_thunk_1_0 = {
&Create,
&IsURLLoader,
&Open,
@@ -138,10 +163,14 @@ const PPB_URLLoaderTrusted g_ppb_urlloader_trusted_thunk = {
} // namespace
-const PPB_URLLoader_1_0* GetPPB_URLLoader_1_0_Thunk() {
+const PPB_URLLoader_1_1* GetPPB_URLLoader_1_1_Thunk() {
return &g_ppb_urlloader_thunk;
}
+const PPB_URLLoader_1_0* GetPPB_URLLoader_1_0_Thunk() {
+ return &g_ppb_urlloader_thunk_1_0;
+}
+
const PPB_URLLoaderTrusted_0_3* GetPPB_URLLoaderTrusted_0_3_Thunk() {
return &g_ppb_urlloader_trusted_thunk;
}
« no previous file with comments | « ppapi/thunk/ppb_url_loader_api.h ('k') | webkit/plugins/ppapi/ppb_url_loader_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698