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: test/cctest/cctest.h

Issue 12033011: Add Isolate parameter to Persistent class. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added explicit Created 7 years, 11 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 | « src/profile-generator.cc ('k') | test/cctest/test-api.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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 // A LocalContext holds a reference to a v8::Context. 173 // A LocalContext holds a reference to a v8::Context.
174 class LocalContext { 174 class LocalContext {
175 public: 175 public:
176 LocalContext(v8::ExtensionConfiguration* extensions = 0, 176 LocalContext(v8::ExtensionConfiguration* extensions = 0,
177 v8::Handle<v8::ObjectTemplate> global_template = 177 v8::Handle<v8::ObjectTemplate> global_template =
178 v8::Handle<v8::ObjectTemplate>(), 178 v8::Handle<v8::ObjectTemplate>(),
179 v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>()) 179 v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>())
180 : context_(v8::Context::New(extensions, global_template, global_object)) { 180 : context_(v8::Context::New(extensions, global_template, global_object)) {
181 context_->Enter(); 181 context_->Enter();
182 // We can't do this later perhaps because of a fatal error.
183 isolate_ = context_->GetIsolate();
182 } 184 }
183 185
184 virtual ~LocalContext() { 186 virtual ~LocalContext() {
185 context_->Exit(); 187 context_->Exit();
186 context_.Dispose(); 188 context_.Dispose(isolate_);
187 } 189 }
188 190
189 v8::Context* operator->() { return *context_; } 191 v8::Context* operator->() { return *context_; }
190 v8::Context* operator*() { return *context_; } 192 v8::Context* operator*() { return *context_; }
191 bool IsReady() { return !context_.IsEmpty(); } 193 bool IsReady() { return !context_.IsEmpty(); }
192 194
193 v8::Local<v8::Context> local() { 195 v8::Local<v8::Context> local() {
194 return v8::Local<v8::Context>::New(context_); 196 return v8::Local<v8::Context>::New(context_);
195 } 197 }
196 198
197 private: 199 private:
198 v8::Persistent<v8::Context> context_; 200 v8::Persistent<v8::Context> context_;
201 v8::Isolate* isolate_;
199 }; 202 };
200 203
201 204
202 static inline v8::Local<v8::Value> v8_num(double x) { 205 static inline v8::Local<v8::Value> v8_num(double x) {
203 return v8::Number::New(x); 206 return v8::Number::New(x);
204 } 207 }
205 208
206 209
207 static inline v8::Local<v8::String> v8_str(const char* x) { 210 static inline v8::Local<v8::String> v8_str(const char* x) {
208 return v8::String::New(x); 211 return v8::String::New(x);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { 256 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) {
254 int old_linear_size = static_cast<int>(space->limit() - space->top()); 257 int old_linear_size = static_cast<int>(space->limit() - space->top());
255 space->Free(space->top(), old_linear_size); 258 space->Free(space->top(), old_linear_size);
256 space->SetTop(space->limit(), space->limit()); 259 space->SetTop(space->limit(), space->limit());
257 space->ResetFreeList(); 260 space->ResetFreeList();
258 space->ClearStats(); 261 space->ClearStats();
259 } 262 }
260 263
261 264
262 #endif // ifndef CCTEST_H_ 265 #endif // ifndef CCTEST_H_
OLDNEW
« no previous file with comments | « src/profile-generator.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698