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

Unified Diff: experimental/SkV8Example/Global.cpp

Issue 121303004: Fleshed out a lot of the Path interfac (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: unused imports Created 6 years, 11 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/SkV8Example/Global.h ('k') | experimental/SkV8Example/JsContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/SkV8Example/Global.cpp
diff --git a/experimental/SkV8Example/Global.cpp b/experimental/SkV8Example/Global.cpp
index b45d2de3c67e27cd27fa1cf97fad9af6543cdbd2..998f92bb73726236b59e2b131809634312ffc276 100644
--- a/experimental/SkV8Example/Global.cpp
+++ b/experimental/SkV8Example/Global.cpp
@@ -190,6 +190,17 @@ Handle<Context> Global::createRootContext() {
return Context::New(fIsolate, NULL, global);
}
+void Global::initialize() {
+ // Create a stack-allocated handle scope.
+ HandleScope handleScope(fIsolate);
+
+ // Create a new context.
+ Handle<Context> context = this->createRootContext();
+
+ // Make the context persistent.
+ fContext.Reset(fIsolate, context);
+}
+
// Creates the root context, parses the script into it, then stores the
// context in a global.
@@ -201,10 +212,8 @@ bool Global::parseScript(const char script[]) {
// Create a stack-allocated handle scope.
HandleScope handleScope(fIsolate);
- printf("Before create context\n");
-
- // Create a new context.
- Handle<Context> context = this->createRootContext();
+ // Get the global context.
+ Handle<Context> context = this->getContext();
// Enter the scope so all operations take place in the scope.
Context::Scope contextScope(context);
@@ -213,16 +222,13 @@ bool Global::parseScript(const char script[]) {
// Compile the source code.
Handle<String> source = String::NewFromUtf8(fIsolate, script);
- printf("Before Compile\n");
Handle<Script> compiledScript = Script::Compile(source);
- printf("After Compile\n");
if (compiledScript.IsEmpty()) {
// Print errors that happened during compilation.
this->reportException(&tryCatch);
return false;
}
- printf("After Exception.\n");
// Try running it now to create the onDraw function.
Handle<Value> result = compiledScript->Run();
@@ -235,7 +241,5 @@ bool Global::parseScript(const char script[]) {
return false;
}
- // Also make the context persistent.
- fContext.Reset(fIsolate, context);
return true;
}
« no previous file with comments | « experimental/SkV8Example/Global.h ('k') | experimental/SkV8Example/JsContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698