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

Side by Side Diff: src/d8.h

Issue 12330171: Simplify line editor choice in d8. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: make it even simpler Created 7 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 | « no previous file | src/d8.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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 private: 111 private:
112 static int Hash(const char* name); 112 static int Hash(const char* name);
113 static bool Match(void* key1, void* key2); 113 static bool Match(void* key1, void* key2);
114 i::HashMap hash_map_; 114 i::HashMap hash_map_;
115 }; 115 };
116 #endif // V8_SHARED 116 #endif // V8_SHARED
117 117
118 118
119 class LineEditor { 119 class LineEditor {
120 public: 120 public:
121 enum Type { DUMB = 0, READLINE = 1 }; 121 explicit LineEditor(Isolate* isolate) : isolate_(isolate) { Open(); }
122 LineEditor(Type type, const char* name); 122 ~LineEditor();
123 virtual ~LineEditor() { } 123 void Open();
124 124 const char* name();
125 virtual Handle<String> Prompt(const char* prompt) = 0; 125 void AddHistory(const char* str);
126 virtual bool Open() { return true; } 126 Handle<String> Prompt(const char* prompt);
127 virtual bool Close() { return true; }
128 virtual void AddHistory(const char* str) { }
129
130 const char* name() { return name_; }
131 static LineEditor* Get();
132 private: 127 private:
133 Type type_; 128 Isolate* isolate_;
134 const char* name_;
135 LineEditor* next_;
136 static LineEditor* first_;
137 }; 129 };
138 130
139 131
140 class SourceGroup { 132 class SourceGroup {
141 public: 133 public:
142 SourceGroup() : 134 SourceGroup() :
143 #ifndef V8_SHARED 135 #ifndef V8_SHARED
144 next_semaphore_(v8::internal::OS::CreateSemaphore(0)), 136 next_semaphore_(v8::internal::OS::CreateSemaphore(0)),
145 done_semaphore_(v8::internal::OS::CreateSemaphore(0)), 137 done_semaphore_(v8::internal::OS::CreateSemaphore(0)),
146 thread_(NULL), 138 thread_(NULL),
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 static void ExternalArrayWeakCallback(Isolate* isolate, 399 static void ExternalArrayWeakCallback(Isolate* isolate,
408 Persistent<Value> object, 400 Persistent<Value> object,
409 void* data); 401 void* data);
410 }; 402 };
411 403
412 404
413 } // namespace v8 405 } // namespace v8
414 406
415 407
416 #endif // V8_D8_H_ 408 #endif // V8_D8_H_
OLDNEW
« no previous file with comments | « no previous file | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698