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

Side by Side Diff: test/cctest/cctest.h

Issue 15038002: Revert "deprecate Context::New which returns Persistent" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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/mksnapshot.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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 const char* name_; 200 const char* name_;
201 }; 201 };
202 202
203 namespace v8 { 203 namespace v8 {
204 // A LocalContext holds a reference to a v8::Context. 204 // A LocalContext holds a reference to a v8::Context.
205 class LocalContext { 205 class LocalContext {
206 public: 206 public:
207 LocalContext(v8::ExtensionConfiguration* extensions = 0, 207 LocalContext(v8::ExtensionConfiguration* extensions = 0,
208 v8::Handle<v8::ObjectTemplate> global_template = 208 v8::Handle<v8::ObjectTemplate> global_template =
209 v8::Handle<v8::ObjectTemplate>(), 209 v8::Handle<v8::ObjectTemplate>(),
210 v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>()) { 210 v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>())
211 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 211 : context_(v8::Context::New(extensions, global_template, global_object)) {
212 HandleScope scope(isolate);
213 context_.Reset(isolate,
214 Context::New(isolate,
215 extensions,
216 global_template,
217 global_object));
218 context_->Enter(); 212 context_->Enter();
219 // We can't do this later perhaps because of a fatal error. 213 // We can't do this later perhaps because of a fatal error.
220 isolate_ = context_->GetIsolate(); 214 isolate_ = context_->GetIsolate();
221 } 215 }
222 216
223 virtual ~LocalContext() { 217 virtual ~LocalContext() {
224 context_->Exit(); 218 context_->Exit();
225 context_.Dispose(isolate_); 219 context_.Dispose(isolate_);
226 } 220 }
227 221
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { 288 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) {
295 int old_linear_size = static_cast<int>(space->limit() - space->top()); 289 int old_linear_size = static_cast<int>(space->limit() - space->top());
296 space->Free(space->top(), old_linear_size); 290 space->Free(space->top(), old_linear_size);
297 space->SetTop(space->limit(), space->limit()); 291 space->SetTop(space->limit(), space->limit());
298 space->ResetFreeList(); 292 space->ResetFreeList();
299 space->ClearStats(); 293 space->ClearStats();
300 } 294 }
301 295
302 296
303 #endif // ifndef CCTEST_H_ 297 #endif // ifndef CCTEST_H_
OLDNEW
« no previous file with comments | « src/mksnapshot.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698