OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // From ppb_url_loader.idl modified Tue Aug 20 08:13:36 2013. | 5 // From ppb_url_loader.idl modified Tue May 7 14:43:00 2013. |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "ppapi/c/pp_completion_callback.h" | 9 #include "ppapi/c/pp_completion_callback.h" |
10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
11 #include "ppapi/c/ppb_url_loader.h" | 11 #include "ppapi/c/ppb_url_loader.h" |
12 #include "ppapi/shared_impl/tracked_callback.h" | 12 #include "ppapi/shared_impl/tracked_callback.h" |
13 #include "ppapi/thunk/enter.h" | 13 #include "ppapi/thunk/enter.h" |
14 #include "ppapi/thunk/ppapi_thunk_export.h" | 14 #include "ppapi/thunk/ppapi_thunk_export.h" |
15 #include "ppapi/thunk/ppb_url_loader_api.h" | 15 #include "ppapi/thunk/ppb_url_loader_api.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 } | 88 } |
89 | 89 |
90 int32_t ReadResponseBody(PP_Resource loader, | 90 int32_t ReadResponseBody(PP_Resource loader, |
91 void* buffer, | 91 void* buffer, |
92 int32_t bytes_to_read, | 92 int32_t bytes_to_read, |
93 struct PP_CompletionCallback callback) { | 93 struct PP_CompletionCallback callback) { |
94 VLOG(4) << "PPB_URLLoader::ReadResponseBody()"; | 94 VLOG(4) << "PPB_URLLoader::ReadResponseBody()"; |
95 EnterResource<PPB_URLLoader_API> enter(loader, callback, true); | 95 EnterResource<PPB_URLLoader_API> enter(loader, callback, true); |
96 if (enter.failed()) | 96 if (enter.failed()) |
97 return enter.retval(); | 97 return enter.retval(); |
98 return enter.SetResult(enter.object()->ReadResponseBody(buffer, | 98 return enter.SetResult(enter.object()->ReadResponseBody( |
99 bytes_to_read, | 99 buffer, bytes_to_read, enter.callback())); |
100 enter.callback())); | |
101 } | 100 } |
102 | 101 |
103 int32_t FinishStreamingToFile(PP_Resource loader, | 102 int32_t FinishStreamingToFile(PP_Resource loader, |
104 struct PP_CompletionCallback callback) { | 103 struct PP_CompletionCallback callback) { |
105 VLOG(4) << "PPB_URLLoader::FinishStreamingToFile()"; | 104 VLOG(4) << "PPB_URLLoader::FinishStreamingToFile()"; |
106 EnterResource<PPB_URLLoader_API> enter(loader, callback, true); | 105 EnterResource<PPB_URLLoader_API> enter(loader, callback, true); |
107 if (enter.failed()) | 106 if (enter.failed()) |
108 return enter.retval(); | 107 return enter.retval(); |
109 return enter.SetResult(enter.object()->FinishStreamingToFile( | 108 return enter.SetResult( |
110 enter.callback())); | 109 enter.object()->FinishStreamingToFile(enter.callback())); |
111 } | 110 } |
112 | 111 |
113 void Close(PP_Resource loader) { | 112 void Close(PP_Resource loader) { |
114 VLOG(4) << "PPB_URLLoader::Close()"; | 113 VLOG(4) << "PPB_URLLoader::Close()"; |
115 EnterResource<PPB_URLLoader_API> enter(loader, true); | 114 EnterResource<PPB_URLLoader_API> enter(loader, true); |
116 if (enter.failed()) | 115 if (enter.failed()) |
117 return; | 116 return; |
118 enter.object()->Close(); | 117 enter.object()->Close(); |
119 } | 118 } |
120 | 119 |
121 const PPB_URLLoader_1_0 g_ppb_urlloader_thunk_1_0 = { | 120 const PPB_URLLoader_1_0 g_ppb_urlloader_thunk_1_0 = { // |
122 &Create, | 121 &Create, // |
123 &IsURLLoader, | 122 &IsURLLoader, // |
124 &Open, | 123 &Open, // |
125 &FollowRedirect, | 124 &FollowRedirect, // |
126 &GetUploadProgress, | 125 &GetUploadProgress, // |
127 &GetDownloadProgress, | 126 &GetDownloadProgress, // |
128 &GetResponseInfo, | 127 &GetResponseInfo, // |
129 &ReadResponseBody, | 128 &ReadResponseBody, // |
130 &FinishStreamingToFile, | 129 &FinishStreamingToFile, // |
131 &Close | 130 &Close // |
Nico
2014/04/17 18:37:36
Eww, that's pretty horrible, no?
Have you tried i
dmichael (off chromium)
2014/04/17 19:11:13
Yes, exactly why I had filed that bug... thank yo
| |
132 }; | 131 }; |
133 | 132 |
134 } // namespace | 133 } // namespace |
135 | 134 |
136 PPAPI_THUNK_EXPORT const PPB_URLLoader_1_0* GetPPB_URLLoader_1_0_Thunk() { | 135 PPAPI_THUNK_EXPORT const PPB_URLLoader_1_0* GetPPB_URLLoader_1_0_Thunk() { |
137 return &g_ppb_urlloader_thunk_1_0; | 136 return &g_ppb_urlloader_thunk_1_0; |
138 } | 137 } |
139 | 138 |
140 } // namespace thunk | 139 } // namespace thunk |
141 } // namespace ppapi | 140 } // namespace ppapi |
OLD | NEW |