Revision: 9274
Author:   [email protected]
Date:     Wed Sep 14 04:27:14 2011
Log:      Reverting r9272.

Review URL: http://codereview.chromium.org/7889033
http://code.google.com/p/v8/source/detail?r=9274

Modified:
 /branches/bleeding_edge/src/d8.cc
 /branches/bleeding_edge/src/d8.h

=======================================
--- /branches/bleeding_edge/src/d8.cc   Wed Sep 14 04:05:07 2011
+++ /branches/bleeding_edge/src/d8.cc   Wed Sep 14 04:27:14 2011
@@ -117,7 +117,6 @@
 CounterCollection* Shell::counters_ = &local_counters_;
 i::Mutex* Shell::context_mutex_(i::OS::CreateMutex());
 Persistent<Context> Shell::utility_context_;
-LineEditor* Shell::console = NULL;
 #endif  // V8_SHARED

 Persistent<Context> Shell::evaluation_context_;
@@ -792,7 +791,6 @@

 #ifndef V8_SHARED
 void Shell::OnExit() {
-  console->Close();
   if (i::FLAG_dump_counters) {
     printf("+----------------------------------------+-------------+\n");
     printf("| Name                                   | Value       |\n");
@@ -897,20 +895,20 @@
   HandleScope outer_scope;
   Handle<String> name = String::New("(d8)");
 #ifndef V8_SHARED
-  console = LineEditor::Get();
- printf("V8 version %s [console: %s]\n", V8::GetVersion(), console->name());
+  LineEditor* editor = LineEditor::Get();
+ printf("V8 version %s [console: %s]\n", V8::GetVersion(), editor->name());
   if (i::FLAG_debugger) {
     printf("JavaScript debugger enabled\n");
   }
-  console->Open();
+  editor->Open();
   while (true) {
-    i::SmartArrayPointer<char> input = console->Prompt(Shell::kPrompt);
+    i::SmartArrayPointer<char> input = editor->Prompt(Shell::kPrompt);
     if (input.is_empty()) break;
-    console->AddHistory(*input);
+    editor->AddHistory(*input);
     HandleScope inner_scope;
     ExecuteString(String::New(*input), name, true, true);
   }
-  console->Close();
+  editor->Close();
 #else
printf("V8 version %s [D8 light using shared library]\n", V8::GetVersion());
   static const int kBufferSize = 256;
=======================================
--- /branches/bleeding_edge/src/d8.h    Wed Sep 14 04:05:07 2011
+++ /branches/bleeding_edge/src/d8.h    Wed Sep 14 04:27:14 2011
@@ -116,29 +116,6 @@
 #endif  // V8_SHARED


-#ifndef V8_SHARED
-class LineEditor {
- public:
-  enum Type { DUMB = 0, READLINE = 1 };
-  LineEditor(Type type, const char* name);
-  virtual ~LineEditor() { }
-
-  virtual i::SmartArrayPointer<char> Prompt(const char* prompt) = 0;
-  virtual bool Open() { return true; }
-  virtual bool Close() { return true; }
-  virtual void AddHistory(const char* str) { }
-
-  const char* name() { return name_; }
-  static LineEditor* Get();
- private:
-  Type type_;
-  const char* name_;
-  LineEditor* next_;
-  static LineEditor* first_;
-};
-#endif  // V8_SHARED
-
-
 class SourceGroup {
  public:
   SourceGroup() :
@@ -336,7 +313,6 @@
   static void AddOSMethods(Handle<ObjectTemplate> os_template);
 #ifndef V8_SHARED
   static const char* kHistoryFileName;
-  static LineEditor* console;
 #endif  // V8_SHARED
   static const char* kPrompt;
   static ShellOptions options;
@@ -367,6 +343,29 @@
 };


+#ifndef V8_SHARED
+class LineEditor {
+ public:
+  enum Type { DUMB = 0, READLINE = 1 };
+  LineEditor(Type type, const char* name);
+  virtual ~LineEditor() { }
+
+  virtual i::SmartArrayPointer<char> Prompt(const char* prompt) = 0;
+  virtual bool Open() { return true; }
+  virtual bool Close() { return true; }
+  virtual void AddHistory(const char* str) { }
+
+  const char* name() { return name_; }
+  static LineEditor* Get();
+ private:
+  Type type_;
+  const char* name_;
+  LineEditor* next_;
+  static LineEditor* first_;
+};
+#endif  // V8_SHARED
+
+
 }  // namespace v8


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to