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

Unified Diff: samples/shell.cc

Issue 12729023: first step to remove unsafe handles (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: issue with debug build Created 7 years, 8 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 | « samples/process.cc ('k') | src/api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/shell.cc
diff --git a/samples/shell.cc b/samples/shell.cc
index 0b71c2c6dc0047dc8611dd1cdd881807dd7c8a93..da18cc71d3b906a267ae4eed2317da3a8bbc0962 100644
--- a/samples/shell.cc
+++ b/samples/shell.cc
@@ -25,6 +25,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// TODO(dcarney): remove this
+#define V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR
+#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
+#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW
+
#include <v8.h>
#include <assert.h>
#include <fcntl.h>
@@ -45,7 +50,7 @@
*/
-v8::Persistent<v8::Context> CreateShellContext();
+v8::Handle<v8::Context> CreateShellContext(v8::Isolate* isolate);
void RunShell(v8::Handle<v8::Context> context);
int RunMain(v8::Isolate* isolate, int argc, char* argv[]);
bool ExecuteString(v8::Isolate* isolate,
@@ -72,7 +77,7 @@ int main(int argc, char* argv[]) {
int result;
{
v8::HandleScope handle_scope(isolate);
- v8::Persistent<v8::Context> context = CreateShellContext();
+ v8::Handle<v8::Context> context = CreateShellContext(isolate);
if (context.IsEmpty()) {
fprintf(stderr, "Error creating context\n");
return 1;
@@ -81,7 +86,6 @@ int main(int argc, char* argv[]) {
result = RunMain(isolate, argc, argv);
if (run_shell) RunShell(context);
context->Exit();
- context.Dispose(isolate);
}
v8::V8::Dispose();
return result;
@@ -96,7 +100,7 @@ const char* ToCString(const v8::String::Utf8Value& value) {
// Creates a new execution environment containing the built-in
// functions.
-v8::Persistent<v8::Context> CreateShellContext() {
+v8::Handle<v8::Context> CreateShellContext(v8::Isolate* isolate) {
// Create a template for the global object.
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
// Bind the global 'print' function to the C++ Print callback.
@@ -110,7 +114,7 @@ v8::Persistent<v8::Context> CreateShellContext() {
// Bind the 'version' function
global->Set(v8::String::New("version"), v8::FunctionTemplate::New(Version));
- return v8::Context::New(NULL, global);
+ return v8::Context::New(isolate, NULL, global);
}
« no previous file with comments | « samples/process.cc ('k') | src/api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698