Remove internal uses of HandleScope::Close().

R=dslomov@chromium.org

Review URL: https://codereview.chromium.org/104183002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18254 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 784b8207
...@@ -311,7 +311,7 @@ Persistent<ObjectTemplate> JsHttpRequestProcessor::map_template_; ...@@ -311,7 +311,7 @@ Persistent<ObjectTemplate> JsHttpRequestProcessor::map_template_;
// JavaScript object. // JavaScript object.
Handle<Object> JsHttpRequestProcessor::WrapMap(map<string, string>* obj) { Handle<Object> JsHttpRequestProcessor::WrapMap(map<string, string>* obj) {
// Handle scope for temporary handles. // Handle scope for temporary handles.
HandleScope handle_scope(GetIsolate()); EscapableHandleScope handle_scope(GetIsolate());
// Fetch the template for creating JavaScript map wrappers. // Fetch the template for creating JavaScript map wrappers.
// It only has to be created once, which we do on demand. // It only has to be created once, which we do on demand.
...@@ -323,7 +323,7 @@ Handle<Object> JsHttpRequestProcessor::WrapMap(map<string, string>* obj) { ...@@ -323,7 +323,7 @@ Handle<Object> JsHttpRequestProcessor::WrapMap(map<string, string>* obj) {
Local<ObjectTemplate>::New(GetIsolate(), map_template_); Local<ObjectTemplate>::New(GetIsolate(), map_template_);
// Create an empty map wrapper. // Create an empty map wrapper.
Handle<Object> result = templ->NewInstance(); Local<Object> result = templ->NewInstance();
// Wrap the raw C++ pointer in an External so it can be referenced // Wrap the raw C++ pointer in an External so it can be referenced
// from within JavaScript. // from within JavaScript.
...@@ -336,7 +336,7 @@ Handle<Object> JsHttpRequestProcessor::WrapMap(map<string, string>* obj) { ...@@ -336,7 +336,7 @@ Handle<Object> JsHttpRequestProcessor::WrapMap(map<string, string>* obj) {
// of these handles will go away when the handle scope is deleted // of these handles will go away when the handle scope is deleted
// we need to call Close to let one, the result, escape into the // we need to call Close to let one, the result, escape into the
// outer handle scope. // outer handle scope.
return handle_scope.Close(result); return handle_scope.Escape(result);
} }
...@@ -399,14 +399,14 @@ void JsHttpRequestProcessor::MapSet(Local<String> name, ...@@ -399,14 +399,14 @@ void JsHttpRequestProcessor::MapSet(Local<String> name,
Handle<ObjectTemplate> JsHttpRequestProcessor::MakeMapTemplate( Handle<ObjectTemplate> JsHttpRequestProcessor::MakeMapTemplate(
Isolate* isolate) { Isolate* isolate) {
HandleScope handle_scope(isolate); EscapableHandleScope handle_scope(isolate);
Handle<ObjectTemplate> result = ObjectTemplate::New(); Local<ObjectTemplate> result = ObjectTemplate::New();
result->SetInternalFieldCount(1); result->SetInternalFieldCount(1);
result->SetNamedPropertyHandler(MapGet, MapSet); result->SetNamedPropertyHandler(MapGet, MapSet);
// Again, return the result through the current handle scope. // Again, return the result through the current handle scope.
return handle_scope.Close(result); return handle_scope.Escape(result);
} }
...@@ -420,7 +420,7 @@ Handle<ObjectTemplate> JsHttpRequestProcessor::MakeMapTemplate( ...@@ -420,7 +420,7 @@ Handle<ObjectTemplate> JsHttpRequestProcessor::MakeMapTemplate(
*/ */
Handle<Object> JsHttpRequestProcessor::WrapRequest(HttpRequest* request) { Handle<Object> JsHttpRequestProcessor::WrapRequest(HttpRequest* request) {
// Handle scope for temporary handles. // Handle scope for temporary handles.
HandleScope handle_scope(GetIsolate()); EscapableHandleScope handle_scope(GetIsolate());
// Fetch the template for creating JavaScript http request wrappers. // Fetch the template for creating JavaScript http request wrappers.
// It only has to be created once, which we do on demand. // It only has to be created once, which we do on demand.
...@@ -432,7 +432,7 @@ Handle<Object> JsHttpRequestProcessor::WrapRequest(HttpRequest* request) { ...@@ -432,7 +432,7 @@ Handle<Object> JsHttpRequestProcessor::WrapRequest(HttpRequest* request) {
Local<ObjectTemplate>::New(GetIsolate(), request_template_); Local<ObjectTemplate>::New(GetIsolate(), request_template_);
// Create an empty http request wrapper. // Create an empty http request wrapper.
Handle<Object> result = templ->NewInstance(); Local<Object> result = templ->NewInstance();
// Wrap the raw C++ pointer in an External so it can be referenced // Wrap the raw C++ pointer in an External so it can be referenced
// from within JavaScript. // from within JavaScript.
...@@ -445,7 +445,7 @@ Handle<Object> JsHttpRequestProcessor::WrapRequest(HttpRequest* request) { ...@@ -445,7 +445,7 @@ Handle<Object> JsHttpRequestProcessor::WrapRequest(HttpRequest* request) {
// of these handles will go away when the handle scope is deleted // of these handles will go away when the handle scope is deleted
// we need to call Close to let one, the result, escape into the // we need to call Close to let one, the result, escape into the
// outer handle scope. // outer handle scope.
return handle_scope.Close(result); return handle_scope.Escape(result);
} }
...@@ -509,9 +509,9 @@ void JsHttpRequestProcessor::GetUserAgent( ...@@ -509,9 +509,9 @@ void JsHttpRequestProcessor::GetUserAgent(
Handle<ObjectTemplate> JsHttpRequestProcessor::MakeRequestTemplate( Handle<ObjectTemplate> JsHttpRequestProcessor::MakeRequestTemplate(
Isolate* isolate) { Isolate* isolate) {
HandleScope handle_scope(isolate); EscapableHandleScope handle_scope(isolate);
Handle<ObjectTemplate> result = ObjectTemplate::New(); Local<ObjectTemplate> result = ObjectTemplate::New();
result->SetInternalFieldCount(1); result->SetInternalFieldCount(1);
// Add accessors for each of the fields of the request. // Add accessors for each of the fields of the request.
...@@ -529,7 +529,7 @@ Handle<ObjectTemplate> JsHttpRequestProcessor::MakeRequestTemplate( ...@@ -529,7 +529,7 @@ Handle<ObjectTemplate> JsHttpRequestProcessor::MakeRequestTemplate(
GetUserAgent); GetUserAgent);
// Again, return the result through the current handle scope. // Again, return the result through the current handle scope.
return handle_scope.Close(result); return handle_scope.Escape(result);
} }
......
...@@ -610,19 +610,19 @@ void Shell::ReportException(Isolate* isolate, v8::TryCatch* try_catch) { ...@@ -610,19 +610,19 @@ void Shell::ReportException(Isolate* isolate, v8::TryCatch* try_catch) {
Handle<Array> Shell::GetCompletions(Isolate* isolate, Handle<Array> Shell::GetCompletions(Isolate* isolate,
Handle<String> text, Handle<String> text,
Handle<String> full) { Handle<String> full) {
HandleScope handle_scope(isolate); EscapableHandleScope handle_scope(isolate);
v8::Local<v8::Context> utility_context = v8::Local<v8::Context> utility_context =
v8::Local<v8::Context>::New(isolate, utility_context_); v8::Local<v8::Context>::New(isolate, utility_context_);
v8::Context::Scope context_scope(utility_context); v8::Context::Scope context_scope(utility_context);
Handle<Object> global = utility_context->Global(); Handle<Object> global = utility_context->Global();
Handle<Value> fun = Local<Value> fun =
global->Get(String::NewFromUtf8(isolate, "GetCompletions")); global->Get(String::NewFromUtf8(isolate, "GetCompletions"));
static const int kArgc = 3; static const int kArgc = 3;
v8::Local<v8::Context> evaluation_context = v8::Local<v8::Context> evaluation_context =
v8::Local<v8::Context>::New(isolate, evaluation_context_); v8::Local<v8::Context>::New(isolate, evaluation_context_);
Handle<Value> argv[kArgc] = { evaluation_context->Global(), text, full }; Handle<Value> argv[kArgc] = { evaluation_context->Global(), text, full };
Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv); Local<Value> val = Local<Function>::Cast(fun)->Call(global, kArgc, argv);
return handle_scope.Close(Handle<Array>::Cast(val)); return handle_scope.Escape(Local<Array>::Cast(val));
} }
...@@ -966,7 +966,7 @@ Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) { ...@@ -966,7 +966,7 @@ Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) {
#endif // V8_SHARED #endif // V8_SHARED
// Initialize the global objects // Initialize the global objects
Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate);
HandleScope handle_scope(isolate); EscapableHandleScope handle_scope(isolate);
Local<Context> context = Context::New(isolate, NULL, global_template); Local<Context> context = Context::New(isolate, NULL, global_template);
ASSERT(!context.IsEmpty()); ASSERT(!context.IsEmpty());
Context::Scope scope(context); Context::Scope scope(context);
...@@ -986,7 +986,7 @@ Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) { ...@@ -986,7 +986,7 @@ Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) {
context->Global()->Set(String::NewFromUtf8(isolate, "arguments"), context->Global()->Set(String::NewFromUtf8(isolate, "arguments"),
Utils::ToLocal(arguments_jsarray)); Utils::ToLocal(arguments_jsarray));
#endif // V8_SHARED #endif // V8_SHARED
return handle_scope.Close(context); return handle_scope.Escape(context);
} }
......
...@@ -1195,14 +1195,14 @@ void FastReturnValueCallback<Object>( ...@@ -1195,14 +1195,14 @@ void FastReturnValueCallback<Object>(
template<typename T> template<typename T>
Handle<Value> TestFastReturnValues() { Handle<Value> TestFastReturnValues() {
LocalContext env; LocalContext env;
v8::HandleScope scope(env->GetIsolate()); v8::EscapableHandleScope scope(env->GetIsolate());
v8::Handle<v8::ObjectTemplate> object_template = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> object_template = v8::ObjectTemplate::New();
v8::FunctionCallback callback = &FastReturnValueCallback<T>; v8::FunctionCallback callback = &FastReturnValueCallback<T>;
object_template->Set(env->GetIsolate(), "callback", object_template->Set(env->GetIsolate(), "callback",
v8::FunctionTemplate::New(callback)); v8::FunctionTemplate::New(callback));
v8::Local<v8::Object> object = object_template->NewInstance(); v8::Local<v8::Object> object = object_template->NewInstance();
(*env)->Global()->Set(v8_str("callback_object"), object); (*env)->Global()->Set(v8_str("callback_object"), object);
return scope.Close(CompileRun("callback_object.callback()")); return scope.Escape(CompileRun("callback_object.callback()"));
} }
...@@ -4188,12 +4188,12 @@ THREADED_TEST(Array) { ...@@ -4188,12 +4188,12 @@ THREADED_TEST(Array) {
void HandleF(const v8::FunctionCallbackInfo<v8::Value>& args) { void HandleF(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::HandleScope scope(args.GetIsolate()); v8::EscapableHandleScope scope(args.GetIsolate());
ApiTestFuzzer::Fuzz(); ApiTestFuzzer::Fuzz();
Local<v8::Array> result = v8::Array::New(args.GetIsolate(), args.Length()); Local<v8::Array> result = v8::Array::New(args.GetIsolate(), args.Length());
for (int i = 0; i < args.Length(); i++) for (int i = 0; i < args.Length(); i++)
result->Set(i, args[i]); result->Set(i, args[i]);
args.GetReturnValue().Set(scope.Close(result)); args.GetReturnValue().Set(scope.Escape(result));
} }
...@@ -13236,10 +13236,10 @@ THREADED_TEST(CheckForCrossContextObjectLiterals) { ...@@ -13236,10 +13236,10 @@ THREADED_TEST(CheckForCrossContextObjectLiterals) {
static v8::Handle<Value> NestedScope(v8::Local<Context> env) { static v8::Handle<Value> NestedScope(v8::Local<Context> env) {
v8::HandleScope inner(env->GetIsolate()); v8::EscapableHandleScope inner(env->GetIsolate());
env->Enter(); env->Enter();
v8::Handle<Value> three = v8_num(3); v8::Local<Value> three = v8_num(3);
v8::Handle<Value> value = inner.Close(three); v8::Local<Value> value = inner.Escape(three);
env->Exit(); env->Exit();
return value; return value;
} }
...@@ -13865,10 +13865,10 @@ THREADED_TEST(Regress54) { ...@@ -13865,10 +13865,10 @@ THREADED_TEST(Regress54) {
v8::HandleScope outer(isolate); v8::HandleScope outer(isolate);
static v8::Persistent<v8::ObjectTemplate> templ; static v8::Persistent<v8::ObjectTemplate> templ;
if (templ.IsEmpty()) { if (templ.IsEmpty()) {
v8::HandleScope inner(isolate); v8::EscapableHandleScope inner(isolate);
v8::Handle<v8::ObjectTemplate> local = v8::ObjectTemplate::New(); v8::Local<v8::ObjectTemplate> local = v8::ObjectTemplate::New();
local->SetInternalFieldCount(1); local->SetInternalFieldCount(1);
templ.Reset(isolate, inner.Close(local)); templ.Reset(isolate, inner.Escape(local));
} }
v8::Handle<v8::Object> result = v8::Handle<v8::Object> result =
v8::Local<v8::ObjectTemplate>::New(isolate, templ)->NewInstance(); v8::Local<v8::ObjectTemplate>::New(isolate, templ)->NewInstance();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment