Index: experimental/SkV8Example/SkV8Example.cpp |
diff --git a/experimental/SkV8Example/SkV8Example.cpp b/experimental/SkV8Example/SkV8Example.cpp |
index 6eb8d89e047fa403dfdbac9a28d839595034175f..ae32a863ab48e826b61394a8095dcd2b2aa0f823 100644 |
--- a/experimental/SkV8Example/SkV8Example.cpp |
+++ b/experimental/SkV8Example/SkV8Example.cpp |
@@ -156,6 +156,22 @@ SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) { |
Isolate* isolate = Isolate::GetCurrent(); |
Global* global = new Global(isolate); |
+ |
+ // Set up things to look like a browser by creating |
+ // a console object that invokes our print function. |
+ const char* startupScript = |
robertphillips
2014/01/10 20:54:34
can this be intended to the right?
jcgregorio
2014/01/10 20:57:59
Done. Also done for below.
On 2014/01/10 20:54:34
|
+"function Console() {}; \n" |
+"Console.prototype.log = function() { \n" |
+" var args = Array.prototype.slice.call(arguments).join(' '); \n" |
+" print(args); \n" |
+"}; \n" |
+"console = new Console(); \n"; |
+ |
+ if (!global->parseScript(startupScript)) { |
+ printf("Failed to parse startup script: %s.\n", FLAGS_infile[0]); |
+ exit(1); |
+ } |
+ |
const char* script = |
"function onDraw(canvas) { \n" |
" canvas.fillStyle = '#00FF00'; \n" |
@@ -179,6 +195,7 @@ SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) { |
exit(1); |
} |
+ |
JsContext* jsContext = new JsContext(global); |
if (!jsContext->initialize()) { |