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

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

Issue 2036173002: skiaserve: Add a flag to control hosted mode, i.e. when running on debugger.skia.org. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: \khan{Windows!} Created 4 years, 6 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 "Request.h" 8 #include "Request.h"
9 #include "Response.h" 9 #include "Response.h"
10 10
11 #include "SkCommandLineFlags.h" 11 #include "SkCommandLineFlags.h"
12 #include "SkGraphics.h" 12 #include "SkGraphics.h"
13 13
14 #include "microhttpd.h" 14 #include "microhttpd.h"
15 15
16 #include "urlhandlers/UrlHandler.h" 16 #include "urlhandlers/UrlHandler.h"
17 17
18 #include <errno.h> 18 #include <errno.h>
19 19
20 #if !defined _WIN32 20 #if !defined _WIN32
21 #include <sys/socket.h> 21 #include <sys/socket.h>
22 #include <arpa/inet.h> 22 #include <arpa/inet.h>
23 #endif 23 #endif
24 24
25 using namespace Response; 25 using namespace Response;
26 26
27 DEFINE_int32(port, 8888, "The port to listen on."); 27 DEFINE_int32(port, 8888, "The port to listen on.");
28 DEFINE_string(address, "127.0.0.1", "The address to bind to."); 28 DEFINE_string(address, "127.0.0.1", "The address to bind to.");
29 DEFINE_bool(hosted, false, "Running in hosted mode on debugger.skia.org.");
29 30
30 class UrlManager { 31 class UrlManager {
31 public: 32 public:
32 UrlManager() { 33 UrlManager() {
33 // Register handlers 34 // Register handlers
34 fHandlers.push_back(new RootHandler); 35 fHandlers.push_back(new RootHandler);
35 fHandlers.push_back(new PostHandler); 36 fHandlers.push_back(new PostHandler);
36 fHandlers.push_back(new ImgHandler); 37 fHandlers.push_back(new ImgHandler);
37 fHandlers.push_back(new ClipAlphaHandler); 38 fHandlers.push_back(new ClipAlphaHandler);
38 fHandlers.push_back(new EnableGPUHandler); 39 fHandlers.push_back(new EnableGPUHandler);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 #endif 109 #endif
109 , FLAGS_port, nullptr, nullptr, 110 , FLAGS_port, nullptr, nullptr,
110 &answer_to_connection, &request, 111 &answer_to_connection, &request,
111 MHD_OPTION_SOCK_ADDR, &address, 112 MHD_OPTION_SOCK_ADDR, &address,
112 MHD_OPTION_END); 113 MHD_OPTION_END);
113 if (NULL == daemon) { 114 if (NULL == daemon) {
114 SkDebugf("Could not initialize daemon\n"); 115 SkDebugf("Could not initialize daemon\n");
115 return 1; 116 return 1;
116 } 117 }
117 118
118 getchar(); 119 if (FLAGS_hosted) {
120 while (1) {
121 SkDebugf("loop\n");
122 #if defined(SK_BUILD_FOR_WIN)
123 Sleep(60 * 1000);
124 #else
125 sleep(60);
126 #endif
127 }
128 } else {
129 getchar();
130 }
119 MHD_stop_daemon(daemon); 131 MHD_stop_daemon(daemon);
120 return 0; 132 return 0;
121 } 133 }
122 134
123 #if !defined SK_BUILD_FOR_IOS 135 #if !defined SK_BUILD_FOR_IOS
124 int main(int argc, char** argv) { 136 int main(int argc, char** argv) {
125 SkCommandLineFlags::Parse(argc, argv); 137 SkCommandLineFlags::Parse(argc, argv);
126 return skiaserve_main(); 138 return skiaserve_main();
127 } 139 }
128 #endif 140 #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