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

Side by Side Diff: src/d8.cc

Issue 27330: Unify the handling of the event and response JSON in developer shell debugger... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 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 | « src/d8.h ('k') | src/d8.js » ('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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 Context::Scope context_scope(utility_context_); 225 Context::Scope context_scope(utility_context_);
226 Handle<Object> global = utility_context_->Global(); 226 Handle<Object> global = utility_context_->Global();
227 Handle<Value> fun = global->Get(String::New("GetCompletions")); 227 Handle<Value> fun = global->Get(String::New("GetCompletions"));
228 static const int kArgc = 3; 228 static const int kArgc = 3;
229 Handle<Value> argv[kArgc] = { evaluation_context_->Global(), text, full }; 229 Handle<Value> argv[kArgc] = { evaluation_context_->Global(), text, full };
230 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv); 230 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv);
231 return handle_scope.Close(Handle<Array>::Cast(val)); 231 return handle_scope.Close(Handle<Array>::Cast(val));
232 } 232 }
233 233
234 234
235 Handle<String> Shell::DebugEventToText(Handle<String> event) { 235 Handle<Object> Shell::DebugMessageDetails(Handle<String> message) {
236 HandleScope handle_scope;
237 Context::Scope context_scope(utility_context_); 236 Context::Scope context_scope(utility_context_);
238 Handle<Object> global = utility_context_->Global(); 237 Handle<Object> global = utility_context_->Global();
239 Handle<Value> fun = global->Get(String::New("DebugEventToText")); 238 Handle<Value> fun = global->Get(String::New("DebugMessageDetails"));
240 TryCatch try_catch;
241 try_catch.SetVerbose(true);
242 static const int kArgc = 1; 239 static const int kArgc = 1;
243 Handle<Value> argv[kArgc] = { event }; 240 Handle<Value> argv[kArgc] = { message };
244 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv); 241 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv);
245 if (try_catch.HasCaught()) { 242 return Handle<Object>::Cast(val);
246 return handle_scope.Close(try_catch.Exception()->ToString());
247 } else {
248 return handle_scope.Close(Handle<String>::Cast(val));
249 }
250 } 243 }
251 244
252 245
253 Handle<Value> Shell::DebugCommandToJSONRequest(Handle<String> command) { 246 Handle<Value> Shell::DebugCommandToJSONRequest(Handle<String> command) {
254 Context::Scope context_scope(utility_context_); 247 Context::Scope context_scope(utility_context_);
255 Handle<Object> global = utility_context_->Global(); 248 Handle<Object> global = utility_context_->Global();
256 Handle<Value> fun = global->Get(String::New("DebugCommandToJSONRequest")); 249 Handle<Value> fun = global->Get(String::New("DebugCommandToJSONRequest"));
257 static const int kArgc = 1; 250 static const int kArgc = 1;
258 Handle<Value> argv[kArgc] = { command }; 251 Handle<Value> argv[kArgc] = { command };
259 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv); 252 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv);
260 return val; 253 return val;
261 } 254 }
262 255
263 256
264 Handle<Object> Shell::DebugResponseDetails(Handle<String> response) {
265 Context::Scope context_scope(utility_context_);
266 Handle<Object> global = utility_context_->Global();
267 Handle<Value> fun = global->Get(String::New("DebugResponseDetails"));
268 static const int kArgc = 1;
269 Handle<Value> argv[kArgc] = { response };
270 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv);
271 return Handle<Object>::Cast(val);
272 }
273
274
275 int32_t* Counter::Bind(const char* name) { 257 int32_t* Counter::Bind(const char* name) {
276 int i; 258 int i;
277 for (i = 0; i < kMaxNameSize - 1 && name[i]; i++) 259 for (i = 0; i < kMaxNameSize - 1 && name[i]; i++)
278 name_[i] = static_cast<char>(name[i]); 260 name_[i] = static_cast<char>(name[i]);
279 name_[i] = '\0'; 261 name_[i] = '\0';
280 return &counter_; 262 return &counter_;
281 } 263 }
282 264
283 265
284 CounterCollection::CounterCollection() { 266 CounterCollection::CounterCollection() {
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 return 0; 587 return 0;
606 } 588 }
607 589
608 590
609 } // namespace v8 591 } // namespace v8
610 592
611 593
612 int main(int argc, char* argv[]) { 594 int main(int argc, char* argv[]) {
613 return v8::Shell::Main(argc, argv); 595 return v8::Shell::Main(argc, argv);
614 } 596 }
OLDNEW
« no previous file with comments | « src/d8.h ('k') | src/d8.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698