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

Side by Side Diff: src/debug.cc

Issue 83323003: Remove usage of deprecated APIs from v8 itself (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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 | « src/api.cc ('k') | src/extensions/externalize-string-extension.cc » ('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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 Script** location = 702 Script** location =
703 reinterpret_cast<Script**>(Utils::OpenPersistent(*obj).location()); 703 reinterpret_cast<Script**>(Utils::OpenPersistent(*obj).location());
704 ASSERT((*location)->IsScript()); 704 ASSERT((*location)->IsScript());
705 705
706 // Remove the entry from the cache. 706 // Remove the entry from the cache.
707 int id = (*location)->id()->value(); 707 int id = (*location)->id()->value();
708 script_cache->Remove(reinterpret_cast<void*>(id), Hash(id)); 708 script_cache->Remove(reinterpret_cast<void*>(id), Hash(id));
709 script_cache->collected_scripts_.Add(id); 709 script_cache->collected_scripts_.Add(id);
710 710
711 // Clear the weak handle. 711 // Clear the weak handle.
712 obj->Dispose(); 712 obj->Reset();
713 } 713 }
714 714
715 715
716 void Debug::SetUp(bool create_heap_objects) { 716 void Debug::SetUp(bool create_heap_objects) {
717 ThreadInit(); 717 ThreadInit();
718 if (create_heap_objects) { 718 if (create_heap_objects) {
719 // Get code to handle debug break on return. 719 // Get code to handle debug break on return.
720 debug_break_return_ = 720 debug_break_return_ =
721 isolate_->builtins()->builtin(Builtins::kReturn_DebugBreak); 721 isolate_->builtins()->builtin(Builtins::kReturn_DebugBreak);
722 ASSERT(debug_break_return_->IsCode()); 722 ASSERT(debug_break_return_->IsCode());
(...skipping 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after
3064 3064
3065 // Clear the flag indicating that the debugger should be unloaded. 3065 // Clear the flag indicating that the debugger should be unloaded.
3066 debugger_unload_pending_ = false; 3066 debugger_unload_pending_ = false;
3067 } 3067 }
3068 3068
3069 3069
3070 void Debugger::NotifyMessageHandler(v8::DebugEvent event, 3070 void Debugger::NotifyMessageHandler(v8::DebugEvent event,
3071 Handle<JSObject> exec_state, 3071 Handle<JSObject> exec_state,
3072 Handle<JSObject> event_data, 3072 Handle<JSObject> event_data,
3073 bool auto_continue) { 3073 bool auto_continue) {
3074 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(isolate_);
3074 HandleScope scope(isolate_); 3075 HandleScope scope(isolate_);
3075 3076
3076 if (!isolate_->debug()->Load()) return; 3077 if (!isolate_->debug()->Load()) return;
3077 3078
3078 // Process the individual events. 3079 // Process the individual events.
3079 bool sendEventMessage = false; 3080 bool sendEventMessage = false;
3080 switch (event) { 3081 switch (event) {
3081 case v8::Break: 3082 case v8::Break:
3082 case v8::BreakForCommand: 3083 case v8::BreakForCommand:
3083 sendEventMessage = !auto_continue; 3084 sendEventMessage = !auto_continue;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
3124 return; 3125 return;
3125 } 3126 }
3126 3127
3127 v8::TryCatch try_catch; 3128 v8::TryCatch try_catch;
3128 3129
3129 // DebugCommandProcessor goes here. 3130 // DebugCommandProcessor goes here.
3130 v8::Local<v8::Object> cmd_processor; 3131 v8::Local<v8::Object> cmd_processor;
3131 { 3132 {
3132 v8::Local<v8::Object> api_exec_state = 3133 v8::Local<v8::Object> api_exec_state =
3133 v8::Utils::ToLocal(Handle<JSObject>::cast(exec_state)); 3134 v8::Utils::ToLocal(Handle<JSObject>::cast(exec_state));
3134 v8::Local<v8::String> fun_name = 3135 v8::Local<v8::String> fun_name = v8::String::NewFromUtf8(
3135 v8::String::New("debugCommandProcessor"); 3136 isolate, "debugCommandProcessor");
3136 v8::Local<v8::Function> fun = 3137 v8::Local<v8::Function> fun =
3137 v8::Local<v8::Function>::Cast(api_exec_state->Get(fun_name)); 3138 v8::Local<v8::Function>::Cast(api_exec_state->Get(fun_name));
3138 3139
3139 v8::Handle<v8::Boolean> running = v8::Boolean::New(auto_continue); 3140 v8::Handle<v8::Boolean> running = v8::Boolean::New(auto_continue);
3140 static const int kArgc = 1; 3141 static const int kArgc = 1;
3141 v8::Handle<Value> argv[kArgc] = { running }; 3142 v8::Handle<Value> argv[kArgc] = { running };
3142 cmd_processor = v8::Local<v8::Object>::Cast( 3143 cmd_processor = v8::Local<v8::Object>::Cast(
3143 fun->Call(api_exec_state, kArgc, argv)); 3144 fun->Call(api_exec_state, kArgc, argv));
3144 if (try_catch.HasCaught()) { 3145 if (try_catch.HasCaught()) {
3145 PrintLn(try_catch.Exception()); 3146 PrintLn(try_catch.Exception());
(...skipping 26 matching lines...) Expand all
3172 // Delete command text and user data. 3173 // Delete command text and user data.
3173 command.Dispose(); 3174 command.Dispose();
3174 return; 3175 return;
3175 } 3176 }
3176 3177
3177 // Invoke JavaScript to process the debug request. 3178 // Invoke JavaScript to process the debug request.
3178 v8::Local<v8::String> fun_name; 3179 v8::Local<v8::String> fun_name;
3179 v8::Local<v8::Function> fun; 3180 v8::Local<v8::Function> fun;
3180 v8::Local<v8::Value> request; 3181 v8::Local<v8::Value> request;
3181 v8::TryCatch try_catch; 3182 v8::TryCatch try_catch;
3182 fun_name = v8::String::New("processDebugRequest"); 3183 fun_name = v8::String::NewFromUtf8(isolate, "processDebugRequest");
3183 fun = v8::Local<v8::Function>::Cast(cmd_processor->Get(fun_name)); 3184 fun = v8::Local<v8::Function>::Cast(cmd_processor->Get(fun_name));
3184 3185
3185 request = v8::String::New(command.text().start(), 3186 request = v8::String::NewFromTwoByte(isolate, command.text().start(),
3186 command.text().length()); 3187 v8::String::kNormalString,
3188 command.text().length());
3187 static const int kArgc = 1; 3189 static const int kArgc = 1;
3188 v8::Handle<Value> argv[kArgc] = { request }; 3190 v8::Handle<Value> argv[kArgc] = { request };
3189 v8::Local<v8::Value> response_val = fun->Call(cmd_processor, kArgc, argv); 3191 v8::Local<v8::Value> response_val = fun->Call(cmd_processor, kArgc, argv);
3190 3192
3191 // Get the response. 3193 // Get the response.
3192 v8::Local<v8::String> response; 3194 v8::Local<v8::String> response;
3193 if (!try_catch.HasCaught()) { 3195 if (!try_catch.HasCaught()) {
3194 // Get response string. 3196 // Get response string.
3195 if (!response_val->IsUndefined()) { 3197 if (!response_val->IsUndefined()) {
3196 response = v8::Local<v8::String>::Cast(response_val); 3198 response = v8::Local<v8::String>::Cast(response_val);
3197 } else { 3199 } else {
3198 response = v8::String::New(""); 3200 response = v8::String::NewFromUtf8(isolate, "");
3199 } 3201 }
3200 3202
3201 // Log the JSON request/response. 3203 // Log the JSON request/response.
3202 if (FLAG_trace_debug_json) { 3204 if (FLAG_trace_debug_json) {
3203 PrintLn(request); 3205 PrintLn(request);
3204 PrintLn(response); 3206 PrintLn(response);
3205 } 3207 }
3206 3208
3207 // Get the running state. 3209 // Get the running state.
3208 fun_name = v8::String::New("isRunning"); 3210 fun_name = v8::String::NewFromUtf8(isolate, "isRunning");
3209 fun = v8::Local<v8::Function>::Cast(cmd_processor->Get(fun_name)); 3211 fun = v8::Local<v8::Function>::Cast(cmd_processor->Get(fun_name));
3210 static const int kArgc = 1; 3212 static const int kArgc = 1;
3211 v8::Handle<Value> argv[kArgc] = { response }; 3213 v8::Handle<Value> argv[kArgc] = { response };
3212 v8::Local<v8::Value> running_val = fun->Call(cmd_processor, kArgc, argv); 3214 v8::Local<v8::Value> running_val = fun->Call(cmd_processor, kArgc, argv);
3213 if (!try_catch.HasCaught()) { 3215 if (!try_catch.HasCaught()) {
3214 running = running_val->ToBoolean()->Value(); 3216 running = running_val->ToBoolean()->Value();
3215 } 3217 }
3216 } else { 3218 } else {
3217 // In case of failure the result text is the exception text. 3219 // In case of failure the result text is the exception text.
3218 response = try_catch.Exception()->ToString(); 3220 response = try_catch.Exception()->ToString();
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
3852 { 3854 {
3853 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); 3855 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_));
3854 isolate_->debugger()->CallMessageDispatchHandler(); 3856 isolate_->debugger()->CallMessageDispatchHandler();
3855 } 3857 }
3856 } 3858 }
3857 } 3859 }
3858 3860
3859 #endif // ENABLE_DEBUGGER_SUPPORT 3861 #endif // ENABLE_DEBUGGER_SUPPORT
3860 3862
3861 } } // namespace v8::internal 3863 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/extensions/externalize-string-extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698