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

Unified Diff: experimental/webtry/webtry.go

Issue 688433002: rework GUI, scripts, and fiddle main for multiple simultaneous configs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add TODO about polymer port and global namespacing Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « experimental/webtry/templates/sidebar.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/webtry/webtry.go
diff --git a/experimental/webtry/webtry.go b/experimental/webtry/webtry.go
index 6daa43355e12d81f04713cda1ca773c5a6270046..ad0d84ecd57ad90531f0abe4773a387497c4531f 100644
--- a/experimental/webtry/webtry.go
+++ b/experimental/webtry/webtry.go
@@ -79,7 +79,7 @@ var (
iframeLink = regexp.MustCompile("^/iframe/([a-f0-9]+)$")
// imageLink is the regex that matches URLs paths that are direct links to PNGs.
- imageLink = regexp.MustCompile("^/i/([a-z0-9-]+.png)$")
+ imageLink = regexp.MustCompile("^/i/([a-z0-9-_]+.png)$")
// tryInfoLink is the regex that matches URLs paths that are direct links to data about a single try.
tryInfoLink = regexp.MustCompile("^/json/([a-f0-9]+)$")
@@ -407,7 +407,8 @@ func expandGyp(hash string) error {
type response struct {
Message string `json:"message"`
CompileErrors []compileError `json:"compileErrors"`
- Img string `json:"img"`
+ RasterImg string `json:"rasterImg"`
+ GPUImg string `json:"gpuImg"`
Hash string `json:"hash"`
}
@@ -724,6 +725,8 @@ type TryRequest struct {
Width int `json:"width"`
Height int `json:"height"`
GPU bool `json:"gpu"`
+ Raster bool `json:"raster"`
+ PDF bool `json:"pdf"`
Name string `json:"name"` // Optional name of the workspace the code is in.
Source int `json:"source"` // ID of the source image, 0 if none.
}
@@ -858,6 +861,10 @@ func mainHandler(w http.ResponseWriter, r *http.Request) {
reportTryError(w, r, err, "Coulnd't decode JSON.", "")
return
}
+ if !(request.GPU || request.Raster || request.PDF) {
+ reportTryError(w, r, nil, "No run configuration supplied...", "")
+ return
+ }
if hasPreProcessor(request.Code) {
err := fmt.Errorf("Found preprocessor macro in code.")
reportTryError(w, r, err, "Preprocessor macros aren't allowed.", "")
@@ -875,9 +882,15 @@ func mainHandler(w http.ResponseWriter, r *http.Request) {
return
}
cmd := fmt.Sprintf("scripts/fiddle_wrapper %s --width %d --height %d", hash, request.Width, request.Height)
+ if request.Raster {
+ cmd += " --raster"
+ }
if request.GPU {
cmd += " --gpu"
}
+ if request.PDF {
+ cmd += " --pdf"
+ }
if *useChroot {
cmd = "schroot -c webtry --directory=/ -- /skia_build/skia/experimental/webtry/" + cmd
}
@@ -920,16 +933,30 @@ func mainHandler(w http.ResponseWriter, r *http.Request) {
return
}
- png, err := ioutil.ReadFile("../../../inout/" + hash + ".png")
- if err != nil {
- reportTryError(w, r, err, "Failed to open the generated PNG.", hash)
- return
- }
-
m := response{
- Img: base64.StdEncoding.EncodeToString([]byte(png)),
Hash: hash,
}
+
+ if request.Raster {
+ png, err := ioutil.ReadFile("../../../inout/" + hash + "_raster.png")
+ if err != nil {
+ reportTryError(w, r, err, "Failed to open the raster-generated PNG.", hash)
+ return
+ }
+
+ m.RasterImg = base64.StdEncoding.EncodeToString([]byte(png))
+ }
+
+ if request.GPU {
+ png, err := ioutil.ReadFile("../../../inout/" + hash + "_GPU.png")
+ if err != nil {
+ reportTryError(w, r, err, "Failed to open the GPU-generated PNG.", hash)
+ return
+ }
+
+ m.GPUImg = base64.StdEncoding.EncodeToString([]byte(png))
+ }
+
resp, err := json.Marshal(m)
if err != nil {
reportTryError(w, r, err, "Failed to serialize a response.", hash)
« no previous file with comments | « experimental/webtry/templates/sidebar.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698