OLD | NEW |
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // but we shouldn't worry about this. | 123 // but we shouldn't worry about this. |
124 // | 124 // |
125 // All we have to do is to set context and call ProcessDebugMessages. | 125 // All we have to do is to set context and call ProcessDebugMessages. |
126 // | 126 // |
127 // We should decide which V8 context to use here. This is important for | 127 // We should decide which V8 context to use here. This is important for |
128 // "evaluate" command, because it must be executed some context. | 128 // "evaluate" command, because it must be executed some context. |
129 // In our sample we have only one context, so there is nothing really to | 129 // In our sample we have only one context, so there is nothing really to |
130 // think about. | 130 // think about. |
131 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 131 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
132 v8::HandleScope handle_scope(isolate); | 132 v8::HandleScope handle_scope(isolate); |
133 v8::Context::Scope scope(isolate, debug_message_context); | 133 v8::Local<v8::Context> context = |
| 134 v8::Local<v8::Context>::New(isolate, debug_message_context); |
| 135 v8::Context::Scope scope(context); |
134 | 136 |
135 v8::Debug::ProcessDebugMessages(); | 137 v8::Debug::ProcessDebugMessages(); |
136 } | 138 } |
137 #endif // ENABLE_DEBUGGER_SUPPORT | 139 #endif // ENABLE_DEBUGGER_SUPPORT |
138 | 140 |
139 | 141 |
140 int RunMain(int argc, char* argv[]) { | 142 int RunMain(int argc, char* argv[]) { |
141 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); | 143 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); |
142 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 144 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
143 v8::HandleScope handle_scope(isolate); | 145 v8::HandleScope handle_scope(isolate); |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 } | 443 } |
442 // Remove newline char | 444 // Remove newline char |
443 for (char* pos = buffer; *pos != '\0'; pos++) { | 445 for (char* pos = buffer; *pos != '\0'; pos++) { |
444 if (*pos == '\n') { | 446 if (*pos == '\n') { |
445 *pos = '\0'; | 447 *pos = '\0'; |
446 break; | 448 break; |
447 } | 449 } |
448 } | 450 } |
449 return v8::String::New(buffer); | 451 return v8::String::New(buffer); |
450 } | 452 } |
OLD | NEW |