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

Side by Side Diff: src/d8.cc

Issue 7852002: Rename SmartPointer to SmartArrayPointer. (Closed) Base URL: git://github.com/v8/v8.git@trunk
Patch Set: fix col > 80 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 context.Dispose(); 1050 context.Dispose();
1051 } 1051 }
1052 if (!done_semaphore_.is_empty()) done_semaphore_->Signal(); 1052 if (!done_semaphore_.is_empty()) done_semaphore_->Signal();
1053 } while (!Shell::options.last_run); 1053 } while (!Shell::options.last_run);
1054 isolate->Dispose(); 1054 isolate->Dispose();
1055 } 1055 }
1056 1056
1057 1057
1058 void SourceGroup::StartExecuteInThread() { 1058 void SourceGroup::StartExecuteInThread() {
1059 if (thread_.is_empty()) { 1059 if (thread_.is_empty()) {
1060 thread_ = i::SmartPointer<i::Thread>(new IsolateThread(this)); 1060 thread_ = i::SmartArrayPointer<i::Thread>(new IsolateThread(this));
1061 thread_->Start(); 1061 thread_->Start();
1062 } 1062 }
1063 next_semaphore_->Signal(); 1063 next_semaphore_->Signal();
1064 } 1064 }
1065 1065
1066 1066
1067 void SourceGroup::WaitForThread() { 1067 void SourceGroup::WaitForThread() {
1068 if (thread_.is_empty()) return; 1068 if (thread_.is_empty()) return;
1069 if (Shell::options.last_run) { 1069 if (Shell::options.last_run) {
1070 thread_->Join(); 1070 thread_->Join();
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 } 1313 }
1314 1314
1315 } // namespace v8 1315 } // namespace v8
1316 1316
1317 1317
1318 #ifndef GOOGLE3 1318 #ifndef GOOGLE3
1319 int main(int argc, char* argv[]) { 1319 int main(int argc, char* argv[]) {
1320 return v8::Shell::Main(argc, argv); 1320 return v8::Shell::Main(argc, argv);
1321 } 1321 }
1322 #endif 1322 #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