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

Side by Side Diff: src/d8.h

Issue 7846022: Release memory of semaphores and thread pointers by using 'delete' instead of SmartPointer. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: 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 | « no previous file | src/d8.cc » ('j') | src/d8.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 13 matching lines...) Expand all
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_D8_H_ 28 #ifndef V8_D8_H_
29 #define V8_D8_H_ 29 #define V8_D8_H_
30 30
31 #ifndef V8_SHARED 31 #ifndef V8_SHARED
32 #include "allocation.h" 32 #include "allocation.h"
33 #include "hashmap.h" 33 #include "hashmap.h"
34 #include "smart-pointer.h"
35 #include "v8.h" 34 #include "v8.h"
36 #else 35 #else
37 #include "../include/v8.h" 36 #include "../include/v8.h"
38 #endif // V8_SHARED 37 #endif // V8_SHARED
39 38
40 namespace v8 { 39 namespace v8 {
41 40
42 41
43 #ifndef V8_SHARED 42 #ifndef V8_SHARED
44 // A single counter in a counter collection. 43 // A single counter in a counter collection.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 }; 114 };
116 #endif // V8_SHARED 115 #endif // V8_SHARED
117 116
118 117
119 class SourceGroup { 118 class SourceGroup {
120 public: 119 public:
121 SourceGroup() : 120 SourceGroup() :
122 #ifndef V8_SHARED 121 #ifndef V8_SHARED
123 next_semaphore_(v8::internal::OS::CreateSemaphore(0)), 122 next_semaphore_(v8::internal::OS::CreateSemaphore(0)),
124 done_semaphore_(v8::internal::OS::CreateSemaphore(0)), 123 done_semaphore_(v8::internal::OS::CreateSemaphore(0)),
124 thread_(NULL),
125 #endif // V8_SHARED 125 #endif // V8_SHARED
126 argv_(NULL), 126 argv_(NULL),
127 begin_offset_(0), 127 begin_offset_(0),
128 end_offset_(0) {} 128 end_offset_(0) {}
129 ~SourceGroup();
Vitaly Repeshko 2011/09/08 22:45:05 nit: Insert a blank line.
129 130
130 void Begin(char** argv, int offset) { 131 void Begin(char** argv, int offset) {
131 argv_ = const_cast<const char**>(argv); 132 argv_ = const_cast<const char**>(argv);
132 begin_offset_ = offset; 133 begin_offset_ = offset;
133 } 134 }
134 135
135 void End(int offset) { end_offset_ = offset; } 136 void End(int offset) { end_offset_ = offset; }
136 137
137 void Execute(); 138 void Execute();
138 139
(...skipping 11 matching lines...) Expand all
150 group_->ExecuteInThread(); 151 group_->ExecuteInThread();
151 } 152 }
152 153
153 private: 154 private:
154 SourceGroup* group_; 155 SourceGroup* group_;
155 }; 156 };
156 157
157 static i::Thread::Options GetThreadOptions(); 158 static i::Thread::Options GetThreadOptions();
158 void ExecuteInThread(); 159 void ExecuteInThread();
159 160
160 i::SmartPointer<i::Semaphore> next_semaphore_; 161 i::Semaphore* next_semaphore_;
161 i::SmartPointer<i::Semaphore> done_semaphore_; 162 i::Semaphore* done_semaphore_;
162 i::SmartPointer<i::Thread> thread_; 163 i::Thread* thread_;
163 #endif // V8_SHARED 164 #endif // V8_SHARED
164 165
165 void ExitShell(int exit_code); 166 void ExitShell(int exit_code);
166 Handle<String> ReadFile(const char* name); 167 Handle<String> ReadFile(const char* name);
167 168
168 const char** argv_; 169 const char** argv_;
169 int begin_offset_; 170 int begin_offset_;
170 int end_offset_; 171 int end_offset_;
171 }; 172 };
172 173
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 LineEditor* next_; 350 LineEditor* next_;
350 static LineEditor* first_; 351 static LineEditor* first_;
351 }; 352 };
352 #endif // V8_SHARED 353 #endif // V8_SHARED
353 354
354 355
355 } // namespace v8 356 } // namespace v8
356 357
357 358
358 #endif // V8_D8_H_ 359 #endif // V8_D8_H_
OLDNEW
« no previous file with comments | « no previous file | src/d8.cc » ('j') | src/d8.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698