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

Side by Side Diff: samples/process.cc

Issue 14793004: deprecate Context::New which returns Persistent (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: use Reset instead of operator= Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | src/d8.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Create a template for the global object where we set the 161 // Create a template for the global object where we set the
162 // built-in global functions. 162 // built-in global functions.
163 Handle<ObjectTemplate> global = ObjectTemplate::New(); 163 Handle<ObjectTemplate> global = ObjectTemplate::New();
164 global->Set(String::New("log"), FunctionTemplate::New(LogCallback)); 164 global->Set(String::New("log"), FunctionTemplate::New(LogCallback));
165 165
166 // Each processor gets its own context so different processors don't 166 // Each processor gets its own context so different processors don't
167 // affect each other. Context::New returns a persistent handle which 167 // affect each other. Context::New returns a persistent handle which
168 // is what we need for the reference to remain after we return from 168 // is what we need for the reference to remain after we return from
169 // this method. That persistent handle has to be disposed in the 169 // this method. That persistent handle has to be disposed in the
170 // destructor. 170 // destructor.
171 context_ = Context::New(NULL, global); 171 context_.Reset(GetIsolate(), Context::New(GetIsolate(), NULL, global));
172 172
173 // Enter the new context so all the following operations take place 173 // Enter the new context so all the following operations take place
174 // within it. 174 // within it.
175 Context::Scope context_scope(GetIsolate(), context_); 175 Context::Scope context_scope(GetIsolate(), context_);
176 176
177 // Make the options mapping available within the context 177 // Make the options mapping available within the context
178 if (!InstallMaps(opts, output)) 178 if (!InstallMaps(opts, output))
179 return false; 179 return false;
180 180
181 // Compile and run the script 181 // Compile and run the script
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 JsHttpRequestProcessor processor(isolate, source); 629 JsHttpRequestProcessor processor(isolate, source);
630 map<string, string> output; 630 map<string, string> output;
631 if (!processor.Initialize(&options, &output)) { 631 if (!processor.Initialize(&options, &output)) {
632 fprintf(stderr, "Error initializing processor.\n"); 632 fprintf(stderr, "Error initializing processor.\n");
633 return 1; 633 return 1;
634 } 634 }
635 if (!ProcessEntries(&processor, kSampleSize, kSampleRequests)) 635 if (!ProcessEntries(&processor, kSampleSize, kSampleRequests))
636 return 1; 636 return 1;
637 PrintMap(&output); 637 PrintMap(&output);
638 } 638 }
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/d8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698