OLD | NEW |
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" | |
9 #include "GrContextFactory.h" | |
10 | |
11 #include "Request.h" | 8 #include "Request.h" |
12 #include "Response.h" | 9 #include "Response.h" |
13 | 10 |
14 #include "SkCommandLineFlags.h" | 11 #include "SkCommandLineFlags.h" |
15 | 12 |
16 #include "microhttpd.h" | 13 #include "microhttpd.h" |
17 | 14 |
18 #include "urlhandlers/UrlHandler.h" | 15 #include "urlhandlers/UrlHandler.h" |
19 #include <sys/socket.h> | 16 #include <sys/socket.h> |
20 | 17 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 upload_data_size); | 74 upload_data_size); |
78 if (MHD_NO == result) { | 75 if (MHD_NO == result) { |
79 fprintf(stderr, "Invalid method and / or url: %s %s\n", method, url); | 76 fprintf(stderr, "Invalid method and / or url: %s %s\n", method, url); |
80 } | 77 } |
81 return result; | 78 return result; |
82 } | 79 } |
83 | 80 |
84 int skiaserve_main() { | 81 int skiaserve_main() { |
85 Request request(SkString("/data")); // This simple server has one request | 82 Request request(SkString("/data")); // This simple server has one request |
86 | 83 |
87 // create surface | |
88 GrContextOptions grContextOpts; | |
89 request.fContextFactory.reset(new GrContextFactory(grContextOpts)); | |
90 request.fSurface.reset(request.createCPUSurface()); | |
91 | |
92 struct MHD_Daemon* daemon; | 84 struct MHD_Daemon* daemon; |
93 // TODO Add option to bind this strictly to an address, e.g. localhost, for
security. | 85 // TODO Add option to bind this strictly to an address, e.g. localhost, for
security. |
94 daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, FLAGS_port, nullptr, nu
llptr, | 86 daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, FLAGS_port, nullptr, nu
llptr, |
95 &answer_to_connection, &request, | 87 &answer_to_connection, &request, |
96 MHD_OPTION_END); | 88 MHD_OPTION_END); |
97 if (NULL == daemon) { | 89 if (NULL == daemon) { |
98 return 1; | 90 return 1; |
99 } | 91 } |
100 | 92 |
101 getchar(); | 93 getchar(); |
102 MHD_stop_daemon(daemon); | 94 MHD_stop_daemon(daemon); |
103 return 0; | 95 return 0; |
104 } | 96 } |
105 | 97 |
106 #if !defined SK_BUILD_FOR_IOS | 98 #if !defined SK_BUILD_FOR_IOS |
107 int main(int argc, char** argv) { | 99 int main(int argc, char** argv) { |
108 SkCommandLineFlags::Parse(argc, argv); | 100 SkCommandLineFlags::Parse(argc, argv); |
109 return skiaserve_main(); | 101 return skiaserve_main(); |
110 } | 102 } |
111 #endif | 103 #endif |
OLD | NEW |