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

Side by Side Diff: src/d8.h

Issue 7754007: Fix memory leak from d8 shell. (Closed) Base URL: git://github.com/v8/v8.git@trunk
Patch Set: fix thread_ as well 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') | no next file with comments »
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 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
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
32 #ifndef V8_SHARED 31 #ifndef V8_SHARED
33 #include "v8.h"
34 #include "allocation.h" 32 #include "allocation.h"
35 #include "hashmap.h" 33 #include "hashmap.h"
34 #include "smart-pointer.h"
35 #include "v8.h"
36 #else 36 #else
37 #include "../include/v8.h" 37 #include "../include/v8.h"
38 #endif // V8_SHARED 38 #endif // V8_SHARED
39 39
40 namespace v8 { 40 namespace v8 {
41 41
42 42
43 #ifndef V8_SHARED 43 #ifndef V8_SHARED
44 // A single counter in a counter collection. 44 // A single counter in a counter collection.
45 class Counter { 45 class Counter {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 }; 115 };
116 #endif // V8_SHARED 116 #endif // V8_SHARED
117 117
118 118
119 class SourceGroup { 119 class SourceGroup {
120 public: 120 public:
121 SourceGroup() : 121 SourceGroup() :
122 #ifndef V8_SHARED 122 #ifndef V8_SHARED
123 next_semaphore_(v8::internal::OS::CreateSemaphore(0)), 123 next_semaphore_(v8::internal::OS::CreateSemaphore(0)),
124 done_semaphore_(v8::internal::OS::CreateSemaphore(0)), 124 done_semaphore_(v8::internal::OS::CreateSemaphore(0)),
125 thread_(NULL),
126 #endif // V8_SHARED 125 #endif // V8_SHARED
127 argv_(NULL), 126 argv_(NULL),
128 begin_offset_(0), 127 begin_offset_(0),
129 end_offset_(0) { } 128 end_offset_(0) {}
130 129
131 void Begin(char** argv, int offset) { 130 void Begin(char** argv, int offset) {
132 argv_ = const_cast<const char**>(argv); 131 argv_ = const_cast<const char**>(argv);
133 begin_offset_ = offset; 132 begin_offset_ = offset;
134 } 133 }
135 134
136 void End(int offset) { end_offset_ = offset; } 135 void End(int offset) { end_offset_ = offset; }
137 136
138 void Execute(); 137 void Execute();
139 138
(...skipping 11 matching lines...) Expand all
151 group_->ExecuteInThread(); 150 group_->ExecuteInThread();
152 } 151 }
153 152
154 private: 153 private:
155 SourceGroup* group_; 154 SourceGroup* group_;
156 }; 155 };
157 156
158 static i::Thread::Options GetThreadOptions(); 157 static i::Thread::Options GetThreadOptions();
159 void ExecuteInThread(); 158 void ExecuteInThread();
160 159
161 i::Semaphore* next_semaphore_; 160 i::SmartPointer<i::Semaphore> next_semaphore_;
162 i::Semaphore* done_semaphore_; 161 i::SmartPointer<i::Semaphore> done_semaphore_;
163 i::Thread* thread_; 162 i::SmartPointer<i::Thread> thread_;
164 #endif // V8_SHARED 163 #endif // V8_SHARED
165 164
166 void ExitShell(int exit_code); 165 void ExitShell(int exit_code);
167 Handle<String> ReadFile(const char* name); 166 Handle<String> ReadFile(const char* name);
168 167
169 const char** argv_; 168 const char** argv_;
170 int begin_offset_; 169 int begin_offset_;
171 int end_offset_; 170 int end_offset_;
172 }; 171 };
173 172
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 LineEditor* next_; 347 LineEditor* next_;
349 static LineEditor* first_; 348 static LineEditor* first_;
350 }; 349 };
351 #endif // V8_SHARED 350 #endif // V8_SHARED
352 351
353 352
354 } // namespace v8 353 } // namespace v8
355 354
356 355
357 #endif // V8_D8_H_ 356 #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