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

Side by Side Diff: src/d8.cc

Issue 7860011: Rename SmartPointer to SmartArrayPointer. (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: rebase it again to get more fixes Created 9 years, 3 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
« no previous file with comments | « src/d8.h ('k') | src/d8-debug.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 best = current; 88 best = current;
89 current = current->next_; 89 current = current->next_;
90 } 90 }
91 return best; 91 return best;
92 } 92 }
93 93
94 94
95 class DumbLineEditor: public LineEditor { 95 class DumbLineEditor: public LineEditor {
96 public: 96 public:
97 DumbLineEditor() : LineEditor(LineEditor::DUMB, "dumb") { } 97 DumbLineEditor() : LineEditor(LineEditor::DUMB, "dumb") { }
98 virtual i::SmartPointer<char> Prompt(const char* prompt); 98 virtual i::SmartArrayPointer<char> Prompt(const char* prompt);
99 }; 99 };
100 100
101 101
102 static DumbLineEditor dumb_line_editor; 102 static DumbLineEditor dumb_line_editor;
103 103
104 104
105 i::SmartPointer<char> DumbLineEditor::Prompt(const char* prompt) { 105 i::SmartArrayPointer<char> DumbLineEditor::Prompt(const char* prompt) {
106 static const int kBufferSize = 256; 106 static const int kBufferSize = 256;
107 char buffer[kBufferSize]; 107 char buffer[kBufferSize];
108 printf("%s", prompt); 108 printf("%s", prompt);
109 char* str = fgets(buffer, kBufferSize, stdin); 109 char* str = fgets(buffer, kBufferSize, stdin);
110 return i::SmartPointer<char>(str ? i::StrDup(str) : str); 110 return i::SmartArrayPointer<char>(str ? i::StrDup(str) : str);
111 } 111 }
112 112
113 113
114 CounterMap* Shell::counter_map_; 114 CounterMap* Shell::counter_map_;
115 i::OS::MemoryMappedFile* Shell::counters_file_ = NULL; 115 i::OS::MemoryMappedFile* Shell::counters_file_ = NULL;
116 CounterCollection Shell::local_counters_; 116 CounterCollection Shell::local_counters_;
117 CounterCollection* Shell::counters_ = &local_counters_; 117 CounterCollection* Shell::counters_ = &local_counters_;
118 i::Mutex* Shell::context_mutex_(i::OS::CreateMutex()); 118 i::Mutex* Shell::context_mutex_(i::OS::CreateMutex());
119 Persistent<Context> Shell::utility_context_; 119 Persistent<Context> Shell::utility_context_;
120 #endif // V8_SHARED 120 #endif // V8_SHARED
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 HandleScope outer_scope; 883 HandleScope outer_scope;
884 Handle<String> name = String::New("(d8)"); 884 Handle<String> name = String::New("(d8)");
885 #ifndef V8_SHARED 885 #ifndef V8_SHARED
886 LineEditor* editor = LineEditor::Get(); 886 LineEditor* editor = LineEditor::Get();
887 printf("V8 version %s [console: %s]\n", V8::GetVersion(), editor->name()); 887 printf("V8 version %s [console: %s]\n", V8::GetVersion(), editor->name());
888 if (i::FLAG_debugger) { 888 if (i::FLAG_debugger) {
889 printf("JavaScript debugger enabled\n"); 889 printf("JavaScript debugger enabled\n");
890 } 890 }
891 editor->Open(); 891 editor->Open();
892 while (true) { 892 while (true) {
893 i::SmartPointer<char> input = editor->Prompt(Shell::kPrompt); 893 i::SmartArrayPointer<char> input = editor->Prompt(Shell::kPrompt);
894 if (input.is_empty()) break; 894 if (input.is_empty()) break;
895 editor->AddHistory(*input); 895 editor->AddHistory(*input);
896 HandleScope inner_scope; 896 HandleScope inner_scope;
897 ExecuteString(String::New(*input), name, true, true); 897 ExecuteString(String::New(*input), name, true, true);
898 } 898 }
899 editor->Close(); 899 editor->Close();
900 #else 900 #else
901 printf("V8 version %s [D8 light using shared library]\n", V8::GetVersion()); 901 printf("V8 version %s [D8 light using shared library]\n", V8::GetVersion());
902 static const int kBufferSize = 256; 902 static const int kBufferSize = 256;
903 while (true) { 903 while (true) {
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 } 1325 }
1326 1326
1327 } // namespace v8 1327 } // namespace v8
1328 1328
1329 1329
1330 #ifndef GOOGLE3 1330 #ifndef GOOGLE3
1331 int main(int argc, char* argv[]) { 1331 int main(int argc, char* argv[]) {
1332 return v8::Shell::Main(argc, argv); 1332 return v8::Shell::Main(argc, argv);
1333 } 1333 }
1334 #endif 1334 #endif
OLDNEW
« no previous file with comments | « src/d8.h ('k') | src/d8-debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698