16#include "microhttpd.h"
21#include <sys/socket.h>
30static DEFINE_bool(hosted,
false,
"Running in hosted mode on debugger.skia.org.");
53 for (
int i = 0;
i < fHandlers.
size();
i++) {
delete fHandlers[
i]; }
57 int invoke(Request* request, MHD_Connection* connection,
const char* url,
const char* method,
58 const char* upload_data,
size_t* upload_data_size)
const {
59 for (
int i = 0;
i < fHandlers.
size();
i++) {
60 if (fHandlers[
i]->canHandle(method, url)) {
61 return fHandlers[
i]->handle(request, connection, url, method, upload_data,
75 const char* url,
const char* method,
const char*
version,
76 const char* upload_data,
size_t* upload_data_size,
78 SkDebugf(
"New %s request for %s using version %s\n", method, url,
version);
80 Request* request =
reinterpret_cast<Request*
>(cls);
84 fprintf(stderr,
"Invalid method and / or url: %s %s\n", method, url);
93 struct sockaddr_in address;
94 address.sin_family = AF_INET;
95 address.sin_port = htons(FLAGS_port);
96 int result = inet_pton(AF_INET, FLAGS_address[0], &address.sin_addr);
98 printf(
"inet_pton for %s:%d failed with return %d %s\n",
99 FLAGS_address[0], FLAGS_port,
result, strerror(errno));
103 printf(
"Visit http://%s:%d in your browser.\n", FLAGS_address[0], FLAGS_port);
105 struct MHD_Daemon* daemon;
106 daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY
110 , FLAGS_port,
nullptr,
nullptr,
112 MHD_OPTION_SOCK_ADDR, &address,
114 if (
nullptr == daemon) {
115 SkDebugf(
"Could not initialize daemon\n");
122 #if defined(SK_BUILD_FOR_WIN)
131 MHD_stop_daemon(daemon);
135#if !defined SK_BUILD_FOR_IOS
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static void Parse(int argc, const char *const *argv)
int invoke(Request *request, MHD_Connection *connection, const char *url, const char *method, const char *upload_data, size_t *upload_data_size) const
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service port
int main(int argc, char **argv)
static DEFINE_string(address, "127.0.0.1", "The address to bind to.")
const UrlManager kUrlManager
int answer_to_connection(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls)
static DEFINE_bool(hosted, false, "Running in hosted mode on debugger.skia.org.")
static DEFINE_int(port, 8888, "The port to listen on.")