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

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

Issue 1741823002: Get SkiaServe Request started off with a little privacy (Closed) Base URL: https://skia.googlesource.com/skia@skiaserve-7-wireup
Patch Set: Created 4 years, 9 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 | « tools/skiaserve/Request.cpp ('k') | tools/skiaserve/urlhandlers/EnableGPUHandler.cpp » ('j') | 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"
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
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
OLDNEW
« no previous file with comments | « tools/skiaserve/Request.cpp ('k') | tools/skiaserve/urlhandlers/EnableGPUHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698