Move Request to its own file in preparation for numerous cleanups
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1738483003 Review URL: https://codereview.chromium.org/1738483003
This commit is contained in:
parent
5ec26ae9bf
commit
24dd687ac5
45
tools/skiaserve/Request.h
Normal file
45
tools/skiaserve/Request.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Google Inc.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by a BSD-style license that can be
|
||||||
|
* found in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef Request_DEFINED
|
||||||
|
#define Request_DEFINED
|
||||||
|
|
||||||
|
#include "GrContextFactory.h"
|
||||||
|
|
||||||
|
#include "SkDebugCanvas.h"
|
||||||
|
#include "SkPicture.h"
|
||||||
|
#include "SkStream.h"
|
||||||
|
#include "SkSurface.h"
|
||||||
|
|
||||||
|
#include "UrlDataManager.h"
|
||||||
|
|
||||||
|
struct MHD_Connection;
|
||||||
|
struct MHD_PostProcessor;
|
||||||
|
|
||||||
|
struct UploadContext {
|
||||||
|
SkDynamicMemoryWStream fStream;
|
||||||
|
MHD_PostProcessor* fPostProcessor;
|
||||||
|
MHD_Connection* connection;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Request {
|
||||||
|
Request(SkString rootUrl)
|
||||||
|
: fUploadContext(nullptr)
|
||||||
|
, fUrlDataManager(rootUrl)
|
||||||
|
, fGPUEnabled(false) {}
|
||||||
|
|
||||||
|
UploadContext* fUploadContext;
|
||||||
|
SkAutoTUnref<SkPicture> fPicture;
|
||||||
|
SkAutoTUnref<SkDebugCanvas> fDebugCanvas;
|
||||||
|
SkAutoTDelete<GrContextFactory> fContextFactory;
|
||||||
|
SkAutoTUnref<SkSurface> fSurface;
|
||||||
|
UrlDataManager fUrlDataManager;
|
||||||
|
bool fGPUEnabled;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -7,18 +7,14 @@
|
|||||||
|
|
||||||
#include "GrCaps.h"
|
#include "GrCaps.h"
|
||||||
#include "GrContextFactory.h"
|
#include "GrContextFactory.h"
|
||||||
|
|
||||||
|
#include "Request.h"
|
||||||
|
|
||||||
#include "SkCanvas.h"
|
#include "SkCanvas.h"
|
||||||
#include "SkCommandLineFlags.h"
|
#include "SkCommandLineFlags.h"
|
||||||
#include "SkDebugCanvas.h"
|
|
||||||
#include "SkJSONCanvas.h"
|
#include "SkJSONCanvas.h"
|
||||||
#include "SkJSONCPP.h"
|
|
||||||
#include "SkPicture.h"
|
|
||||||
#include "SkPictureRecorder.h"
|
#include "SkPictureRecorder.h"
|
||||||
#include "SkPixelSerializer.h"
|
#include "SkPixelSerializer.h"
|
||||||
#include "SkStream.h"
|
|
||||||
#include "SkSurface.h"
|
|
||||||
|
|
||||||
#include "UrlDataManager.h"
|
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
@ -59,27 +55,6 @@ SkString generateTemplate(SkString source) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct UploadContext {
|
|
||||||
SkDynamicMemoryWStream fStream;
|
|
||||||
MHD_PostProcessor* fPostProcessor;
|
|
||||||
MHD_Connection* connection;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Request {
|
|
||||||
Request(SkString rootUrl)
|
|
||||||
: fUploadContext(nullptr)
|
|
||||||
, fUrlDataManager(rootUrl)
|
|
||||||
, fGPUEnabled(false) {}
|
|
||||||
|
|
||||||
UploadContext* fUploadContext;
|
|
||||||
SkAutoTUnref<SkPicture> fPicture;
|
|
||||||
SkAutoTUnref<SkDebugCanvas> fDebugCanvas;
|
|
||||||
SkAutoTDelete<GrContextFactory> fContextFactory;
|
|
||||||
SkAutoTUnref<SkSurface> fSurface;
|
|
||||||
UrlDataManager fUrlDataManager;
|
|
||||||
bool fGPUEnabled;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void write_png_callback(png_structp png_ptr, png_bytep data, png_size_t length) {
|
static void write_png_callback(png_structp png_ptr, png_bytep data, png_size_t length) {
|
||||||
SkWStream* out = (SkWStream*) png_get_io_ptr(png_ptr);
|
SkWStream* out = (SkWStream*) png_get_io_ptr(png_ptr);
|
||||||
out->write(data, length);
|
out->write(data, length);
|
||||||
|
Loading…
Reference in New Issue
Block a user