| 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" | 8 #include "GrCaps.h" |
| 9 #include "GrContextFactory.h" | 9 #include "GrContextFactory.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 SkAutoTUnref<SkJSONCanvas> jsonCanvas(new SkJSONCanvas(kImageWidth, kImageHe
ight, stream)); | 149 SkAutoTUnref<SkJSONCanvas> jsonCanvas(new SkJSONCanvas(kImageWidth, kImageHe
ight, stream)); |
| 150 jsonCanvas->drawPicture(picture); | 150 jsonCanvas->drawPicture(picture); |
| 151 jsonCanvas->finish(); | 151 jsonCanvas->finish(); |
| 152 | 152 |
| 153 SkAutoTUnref<SkData> data(stream.copyToData()); | 153 SkAutoTUnref<SkData> data(stream.copyToData()); |
| 154 return SendData(connection, data, "application/json"); | 154 return SendData(connection, data, "application/json"); |
| 155 } | 155 } |
| 156 | 156 |
| 157 static int SendTemplate(MHD_Connection* connection, bool redirect = false, | 157 static int SendTemplate(MHD_Connection* connection, bool redirect = false, |
| 158 const char* redirectUrl = nullptr) { | 158 const char* redirectUrl = nullptr) { |
| 159 SkString debuggerTemplate = generateTemplate(SkString("http://debugger.skia.
org")); | 159 SkString debuggerTemplate = generateTemplate(SkString("https://debugger.skia
.org")); |
| 160 | 160 |
| 161 MHD_Response* response = MHD_create_response_from_buffer( | 161 MHD_Response* response = MHD_create_response_from_buffer( |
| 162 debuggerTemplate.size(), | 162 debuggerTemplate.size(), |
| 163 (void*) const_cast<char*>(debuggerTemplate.c_str()), | 163 (void*) const_cast<char*>(debuggerTemplate.c_str()), |
| 164 MHD_RESPMEM_MUST_COPY); | 164 MHD_RESPMEM_MUST_COPY); |
| 165 MHD_add_response_header (response, "Access-Control-Allow-Origin", "*"); |
| 165 | 166 |
| 166 int status = MHD_HTTP_OK; | 167 int status = MHD_HTTP_OK; |
| 167 | 168 |
| 168 if (redirect) { | 169 if (redirect) { |
| 169 MHD_add_response_header (response, "Location", redirectUrl); | 170 MHD_add_response_header (response, "Location", redirectUrl); |
| 170 status = MHD_HTTP_SEE_OTHER; | 171 status = MHD_HTTP_SEE_OTHER; |
| 171 } | 172 } |
| 172 | 173 |
| 173 int ret = MHD_queue_response(connection, status, response); | 174 int ret = MHD_queue_response(connection, status, response); |
| 174 MHD_destroy_response(response); | 175 MHD_destroy_response(response); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 MHD_stop_daemon(daemon); | 299 MHD_stop_daemon(daemon); |
| 299 return 0; | 300 return 0; |
| 300 } | 301 } |
| 301 | 302 |
| 302 #if !defined SK_BUILD_FOR_IOS | 303 #if !defined SK_BUILD_FOR_IOS |
| 303 int main(int argc, char** argv) { | 304 int main(int argc, char** argv) { |
| 304 SkCommandLineFlags::Parse(argc, argv); | 305 SkCommandLineFlags::Parse(argc, argv); |
| 305 return skiaserve_main(); | 306 return skiaserve_main(); |
| 306 } | 307 } |
| 307 #endif | 308 #endif |
| OLD | NEW |