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

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

Issue 1639403002: skiaserve: Enable /cmd endpoint. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 return MHD_NO; 239 return MHD_NO;
240 } 240 }
241 241
242 class UrlManager { 242 class UrlManager {
243 public: 243 public:
244 UrlManager() { 244 UrlManager() {
245 // Register handlers 245 // Register handlers
246 fHandlers.push_back({MHD_HTTP_METHOD_GET, "/", rootHandler}); 246 fHandlers.push_back({MHD_HTTP_METHOD_GET, "/", rootHandler});
247 fHandlers.push_back({MHD_HTTP_METHOD_POST, "/new", postHandler}); 247 fHandlers.push_back({MHD_HTTP_METHOD_POST, "/new", postHandler});
248 fHandlers.push_back({MHD_HTTP_METHOD_GET, "/img", imgHandler}); 248 fHandlers.push_back({MHD_HTTP_METHOD_GET, "/img", imgHandler});
249 //fHandlers.push_back({MHD_HTTP_METHOD_GET, "/cmd", infoHandler}); 249 fHandlers.push_back({MHD_HTTP_METHOD_GET, "/cmd", infoHandler});
250 } 250 }
251 251
252 // This is clearly not efficient for a large number of urls and handlers 252 // This is clearly not efficient for a large number of urls and handlers
253 int invoke(Request* request, MHD_Connection* connection, const char* url, co nst char* method, 253 int invoke(Request* request, MHD_Connection* connection, const char* url, co nst char* method,
254 const char* upload_data, size_t* upload_data_size) const { 254 const char* upload_data, size_t* upload_data_size) const {
255 for (int i = 0; i < fHandlers.count(); i++) { 255 for (int i = 0; i < fHandlers.count(); i++) {
256 const Url& urlHandler = fHandlers[i]; 256 const Url& urlHandler = fHandlers[i];
257 if (0 == strcmp(method, urlHandler.fMethod) && 257 if (0 == strcmp(method, urlHandler.fMethod) &&
258 0 == strcmp(url, urlHandler.fPath)) { 258 0 == strcmp(url, urlHandler.fPath)) {
259 return (*urlHandler.fHandler)(request, connection, upload_da ta, 259 return (*urlHandler.fHandler)(request, connection, upload_da ta,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 MHD_stop_daemon(daemon); 298 MHD_stop_daemon(daemon);
299 return 0; 299 return 0;
300 } 300 }
301 301
302 #if !defined SK_BUILD_FOR_IOS 302 #if !defined SK_BUILD_FOR_IOS
303 int main(int argc, char** argv) { 303 int main(int argc, char** argv) {
304 SkCommandLineFlags::Parse(argc, argv); 304 SkCommandLineFlags::Parse(argc, argv);
305 return skiaserve_main(); 305 return skiaserve_main();
306 } 306 }
307 #endif 307 #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