diff options
author | Greg Humphreys <humper@google.com> | 2014-10-28 13:33:54 -0400 |
---|---|---|
committer | Greg Humphreys <humper@google.com> | 2014-10-28 13:33:54 -0400 |
commit | 9571567802ab7db17ab6d5d7087981c7600f0dcb (patch) | |
tree | 9452be737e9cc30ec354a5c938fa66ef7dd44b6e /experimental | |
parent | 6f726addf3178b01949bb389ef83cf14a1d7b6b2 (diff) |
remove the GPU checkbox from the hash / database
We decided last week that GPU rendering wouldn't be associated
with the fiddle itself; options in the left bar will be split into
ones that are bound to the fiddle (so appear in the hash and database)
and ones that are run-specific (like the rendering mode).
This will leave us better placed to do things like rendering in multiple
modes at once.
BUG=skia:
R=jcgregorio@google.com
Review URL: https://codereview.chromium.org/685543002
Diffstat (limited to 'experimental')
-rw-r--r-- | experimental/webtry/README.md | 2 | ||||
-rw-r--r-- | experimental/webtry/TODO.md | 1 | ||||
-rw-r--r-- | experimental/webtry/templates/sidebar.html | 2 | ||||
-rw-r--r-- | experimental/webtry/webtry.go | 44 |
4 files changed, 19 insertions, 30 deletions
diff --git a/experimental/webtry/README.md b/experimental/webtry/README.md index 87046c7f59..6ca9669e52 100644 --- a/experimental/webtry/README.md +++ b/experimental/webtry/README.md @@ -3,7 +3,7 @@ WebTry Server Allows trying out Skia code in the browser. Run a local webserver and from the pages it serves try out Skia code and see the results -immediately. To make sandboxing easier this must be built w/GPU off. +immediately. Running Locally diff --git a/experimental/webtry/TODO.md b/experimental/webtry/TODO.md index b42149a5d9..dd0f1488b6 100644 --- a/experimental/webtry/TODO.md +++ b/experimental/webtry/TODO.md @@ -1,6 +1,5 @@ Public facing feature requests ------------------------------ - - ability to render against multiple targets (gpu/cpu) - versioning (which version of skia was this run against) - magnifying glass (both client side and server side) - specify scale, rotate, clip (possibly animating over a range) diff --git a/experimental/webtry/templates/sidebar.html b/experimental/webtry/templates/sidebar.html index b511987ea3..cd0a35a9ef 100644 --- a/experimental/webtry/templates/sidebar.html +++ b/experimental/webtry/templates/sidebar.html @@ -21,7 +21,7 @@ </div> <div class="checkbox"> <label> - <input id="use-gpu" type="checkbox" value=""{{if .GPU}} checked{{end}}> + <input id="use-gpu" type="checkbox" value=""> Ganesh </label> </div> diff --git a/experimental/webtry/webtry.go b/experimental/webtry/webtry.go index bfb97ba7ae..6daa43355e 100644 --- a/experimental/webtry/webtry.go +++ b/experimental/webtry/webtry.go @@ -244,7 +244,6 @@ func Init() { hash CHAR(64) DEFAULT '' NOT NULL, width INTEGER DEFAULT 256 NOT NULL, height INTEGER DEFAULT 256 NOT NULL, - gpu BOOL DEFAULT 0 NOT NULL, source_image_id INTEGER DEFAULT 0 NOT NULL, PRIMARY KEY(hash) @@ -270,7 +269,6 @@ func Init() { hash CHAR(64) DEFAULT '' NOT NULL, width INTEGER DEFAULT 256 NOT NULL, height INTEGER DEFAULT 256 NOT NULL, - gpu BOOL DEFAULT 0 NOT NULL, hidden INTEGER DEFAULT 0 NOT NULL, source_image_id INTEGER DEFAULT 0 NOT NULL, @@ -343,7 +341,6 @@ type userCode struct { Hash string Width int Height int - GPU bool Source int Titlebar Titlebar } @@ -370,7 +367,7 @@ func expandToFile(filename string, code string, t *template.Template) error { // expandCode expands the template into a file and calculates the MD5 hash. // We include the width and height here so that a single hash can capture // both the code and the supplied width/height parameters. -func expandCode(code string, source int, width, height int, gpu bool) (string, error) { +func expandCode(code string, source int, width, height int) (string, error) { // in order to support fonts in the chroot jail, we need to make sure // we're using portable typefaces. // TODO(humper): Make this more robust, supporting things like setTypeface @@ -379,7 +376,6 @@ func expandCode(code string, source int, width, height int, gpu bool) (string, e outputCodeLines := []string{ "DECLARE_bool(portableFonts);", fmt.Sprintf("// WxH: %d, %d", width, height), - fmt.Sprintf("// GPU: %v", gpu), } for _, line := range inputCodeLines { outputCodeLines = append(outputCodeLines, line) @@ -476,15 +472,15 @@ func reportCompileError(w http.ResponseWriter, r *http.Request, compileErrors [] w.Write(resp) } -func writeToDatabase(hash string, code string, workspaceName string, source int, width, height int, gpu bool) { +func writeToDatabase(hash string, code string, workspaceName string, source int, width, height int) { if db == nil { return } - if _, err := db.Exec("INSERT INTO webtry (code, hash, width, height, gpu, source_image_id) VALUES(?, ?, ?, ?, ?, ?)", code, hash, width, height, gpu, source); err != nil { + if _, err := db.Exec("INSERT INTO webtry (code, hash, width, height, source_image_id) VALUES(?, ?, ?, ?, ?)", code, hash, width, height, source); err != nil { glog.Errorf("Failed to insert code into database: %q\n", err) } if workspaceName != "" { - if _, err := db.Exec("INSERT INTO workspacetry (name, hash, width, height, gpu, source_image_id) VALUES(?, ?, ?, ?, ?, ?)", workspaceName, hash, width, height, gpu, source); err != nil { + if _, err := db.Exec("INSERT INTO workspacetry (name, hash, width, height, source_image_id) VALUES(?, ?, ?, ?, ?)", workspaceName, hash, width, height, source); err != nil { glog.Errorf("Failed to insert into workspacetry table: %q\n", err) } } @@ -627,7 +623,6 @@ type Workspace struct { Width int Height int Source int - GPU bool Tries []Try Titlebar Titlebar } @@ -649,17 +644,16 @@ func newWorkspace() (string, error) { } // getCode returns the code for a given hash, or the empty string if not found. -func getCode(hash string) (string, int, int, int, bool, error) { +func getCode(hash string) (string, int, int, int, error) { code := "" width := 0 height := 0 source := 0 - gpu := false - if err := db.QueryRow("SELECT code, width, height, gpu, source_image_id FROM webtry WHERE hash=?", hash).Scan(&code, &width, &height, &gpu, &source); err != nil { + if err := db.QueryRow("SELECT code, width, height, source_image_id FROM webtry WHERE hash=?", hash).Scan(&code, &width, &height, &source); err != nil { glog.Errorf("Code for hash is missing: %q\n", err) - return code, width, height, source, gpu, err + return code, width, height, source, err } - return code, width, height, source, gpu, nil + return code, width, height, source, nil } func workspaceHandler(w http.ResponseWriter, r *http.Request) { @@ -692,17 +686,16 @@ func workspaceHandler(w http.ResponseWriter, r *http.Request) { var width int var height int source := 0 - gpu := false if len(tries) == 0 { code = DEFAULT_SAMPLE width = 256 height = 256 } else { hash = tries[len(tries)-1].Hash - code, width, height, source, gpu, _ = getCode(hash) + code, width, height, source, _ = getCode(hash) } w.Header().Set("Content-Type", "text/html") - if err := workspaceTemplate.Execute(w, Workspace{Tries: tries, Code: code, Name: name, Hash: hash, Width: width, Height: height, GPU: gpu, Source: source, Titlebar: Titlebar{GitHash: gitHash, GitInfo: gitInfo}}); err != nil { + if err := workspaceTemplate.Execute(w, Workspace{Tries: tries, Code: code, Name: name, Hash: hash, Width: width, Height: height, Source: source, Titlebar: Titlebar{GitHash: gitHash, GitInfo: gitInfo}}); err != nil { glog.Errorf("Failed to expand template: %q\n", err) } } else if r.Method == "POST" { @@ -753,14 +746,14 @@ func iframeHandler(w http.ResponseWriter, r *http.Request) { return } var code string - code, width, height, source, gpu, err := getCode(hash) + code, width, height, source, err := getCode(hash) if err != nil { http.NotFound(w, r) return } // Expand the template. w.Header().Set("Content-Type", "text/html") - if err := iframeTemplate.Execute(w, userCode{Code: code, Width: width, Height: height, GPU: gpu, Hash: hash, Source: source}); err != nil { + if err := iframeTemplate.Execute(w, userCode{Code: code, Width: width, Height: height, Hash: hash, Source: source}); err != nil { glog.Errorf("Failed to expand template: %q\n", err) } } @@ -770,7 +763,6 @@ type TryInfo struct { Code string `json:"code"` Width int `json:"width"` Height int `json:"height"` - GPU bool `json:"gpu"` Source int `json:"source"` } @@ -787,7 +779,7 @@ func tryInfoHandler(w http.ResponseWriter, r *http.Request) { return } hash := match[1] - code, width, height, source, gpu, err := getCode(hash) + code, width, height, source, err := getCode(hash) if err != nil { http.NotFound(w, r) return @@ -797,7 +789,6 @@ func tryInfoHandler(w http.ResponseWriter, r *http.Request) { Code: code, Width: width, Height: height, - GPU: gpu, Source: source, } resp, err := json.Marshal(m) @@ -830,7 +821,6 @@ func mainHandler(w http.ResponseWriter, r *http.Request) { source := 0 width := 256 height := 256 - gpu := false match := directLink.FindStringSubmatch(r.URL.Path) var hash string if len(match) == 2 && r.URL.Path != "/" { @@ -840,14 +830,14 @@ func mainHandler(w http.ResponseWriter, r *http.Request) { return } // Update 'code' with the code found in the database. - if err := db.QueryRow("SELECT code, width, height, gpu, source_image_id FROM webtry WHERE hash=?", hash).Scan(&code, &width, &height, &gpu, &source); err != nil { + if err := db.QueryRow("SELECT code, width, height, source_image_id FROM webtry WHERE hash=?", hash).Scan(&code, &width, &height, &source); err != nil { http.NotFound(w, r) return } } // Expand the template. w.Header().Set("Content-Type", "text/html") - if err := indexTemplate.Execute(w, userCode{Code: code, Hash: hash, Source: source, Width: width, Height: height, GPU: gpu, Titlebar: Titlebar{GitHash: gitHash, GitInfo: gitInfo}}); err != nil { + if err := indexTemplate.Execute(w, userCode{Code: code, Hash: hash, Source: source, Width: width, Height: height, Titlebar: Titlebar{GitHash: gitHash, GitInfo: gitInfo}}); err != nil { glog.Errorf("Failed to expand template: %q\n", err) } } else if r.Method == "POST" { @@ -873,12 +863,12 @@ func mainHandler(w http.ResponseWriter, r *http.Request) { reportTryError(w, r, err, "Preprocessor macros aren't allowed.", "") return } - hash, err := expandCode(LineNumbers(request.Code), request.Source, request.Width, request.Height, request.GPU) + hash, err := expandCode(LineNumbers(request.Code), request.Source, request.Width, request.Height) if err != nil { reportTryError(w, r, err, "Failed to write the code to compile.", hash) return } - writeToDatabase(hash, request.Code, request.Name, request.Source, request.Width, request.Height, request.GPU) + writeToDatabase(hash, request.Code, request.Name, request.Source, request.Width, request.Height) err = expandGyp(hash) if err != nil { reportTryError(w, r, err, "Failed to write the gyp file.", hash) |