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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 return read_history(kHistoryFileName) == 0; | 84 return read_history(kHistoryFileName) == 0; |
85 } | 85 } |
86 | 86 |
87 | 87 |
88 bool ReadLineEditor::Close() { | 88 bool ReadLineEditor::Close() { |
89 return write_history(kHistoryFileName) == 0; | 89 return write_history(kHistoryFileName) == 0; |
90 } | 90 } |
91 | 91 |
92 | 92 |
93 Handle<String> ReadLineEditor::Prompt(const char* prompt) { | 93 Handle<String> ReadLineEditor::Prompt(const char* prompt) { |
94 char* result = readline(prompt); | 94 char* result = NULL; |
| 95 { // Release lock for blocking input. |
| 96 Unlocker unlock(Isolate::GetCurrent()); |
| 97 result = readline(prompt); |
| 98 } |
95 if (result != NULL) { | 99 if (result != NULL) { |
96 AddHistory(result); | 100 AddHistory(result); |
97 } else { | 101 } else { |
98 return Handle<String>(); | 102 return Handle<String>(); |
99 } | 103 } |
100 return String::New(result); | 104 return String::New(result); |
101 } | 105 } |
102 | 106 |
103 | 107 |
104 void ReadLineEditor::AddHistory(const char* str) { | 108 void ReadLineEditor::AddHistory(const char* str) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 return strdup(*str); | 151 return strdup(*str); |
148 } else { | 152 } else { |
149 current_completions.Dispose(); | 153 current_completions.Dispose(); |
150 current_completions.Clear(); | 154 current_completions.Clear(); |
151 return NULL; | 155 return NULL; |
152 } | 156 } |
153 } | 157 } |
154 | 158 |
155 | 159 |
156 } // namespace v8 | 160 } // namespace v8 |
OLD | NEW |