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

Side by Side Diff: tools/skiaserve/skiaserve.cpp

Issue 1659703004: fix skiaserve crash (Closed) Base URL: https://skia.googlesource.com/skia.git@skiaserve-8-advancedurlparsing
Patch Set: Created 4 years, 10 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrCaps.h" 8 #include "GrCaps.h"
9 #include "GrContextFactory.h" 9 #include "GrContextFactory.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 return 0 == strcmp(method, MHD_HTTP_METHOD_GET) && 203 return 0 == strcmp(method, MHD_HTTP_METHOD_GET) &&
204 0 == strncmp(url, kBasePath, strlen(kBasePath)); 204 0 == strncmp(url, kBasePath, strlen(kBasePath));
205 } 205 }
206 206
207 int handle(Request* request, MHD_Connection* connection, 207 int handle(Request* request, MHD_Connection* connection,
208 const char* upload_data, size_t* upload_data_size) override { 208 const char* upload_data, size_t* upload_data_size) override {
209 if (request->fPNG.get()) { 209 if (request->fPNG.get()) {
210 SkData* data = request->fPNG.get(); 210 SkData* data = request->fPNG.get();
211 return SendData(connection, data, "image/png"); 211 return SendData(connection, data, "image/png");
212 } 212 }
213
213 return MHD_NO; 214 return MHD_NO;
214 } 215 }
215 }; 216 };
216 217
217 class PostHandler : public UrlHandler { 218 class PostHandler : public UrlHandler {
218 public: 219 public:
219 bool canHandle(const char* method, const char* url) override { 220 bool canHandle(const char* method, const char* url) override {
220 return 0 == strcmp(method, MHD_HTTP_METHOD_POST) && 221 return 0 == strcmp(method, MHD_HTTP_METHOD_POST) &&
221 0 == strcmp(url, "/new"); 222 0 == strcmp(url, "/new");
222 } 223 }
(...skipping 27 matching lines...) Expand all
250 MHD_destroy_post_processor(uc->fPostProcessor); 251 MHD_destroy_post_processor(uc->fPostProcessor);
251 uc->fPostProcessor = nullptr; 252 uc->fPostProcessor = nullptr;
252 253
253 // TODO response 254 // TODO response
254 SkString error; 255 SkString error;
255 if (!setupAndDrawToCanvas(request, &error)) { 256 if (!setupAndDrawToCanvas(request, &error)) {
256 // TODO send error 257 // TODO send error
257 return MHD_YES; 258 return MHD_YES;
258 } 259 }
259 260
261 // clear upload context
262 delete request->fUploadContext;
263 request->fUploadContext = nullptr;
264
260 return SendTemplate(connection, true, "/"); 265 return SendTemplate(connection, true, "/");
261 } 266 }
262 }; 267 };
263 268
264 class RootHandler : public UrlHandler { 269 class RootHandler : public UrlHandler {
265 public: 270 public:
266 bool canHandle(const char* method, const char* url) override { 271 bool canHandle(const char* method, const char* url) override {
267 return 0 == strcmp(method, MHD_HTTP_METHOD_GET) && 272 return 0 == strcmp(method, MHD_HTTP_METHOD_GET) &&
268 0 == strcmp(url, "/"); 273 0 == strcmp(url, "/");
269 } 274 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 MHD_stop_daemon(daemon); 340 MHD_stop_daemon(daemon);
336 return 0; 341 return 0;
337 } 342 }
338 343
339 #if !defined SK_BUILD_FOR_IOS 344 #if !defined SK_BUILD_FOR_IOS
340 int main(int argc, char** argv) { 345 int main(int argc, char** argv) {
341 SkCommandLineFlags::Parse(argc, argv); 346 SkCommandLineFlags::Parse(argc, argv);
342 return skiaserve_main(); 347 return skiaserve_main();
343 } 348 }
344 #endif 349 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698