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

Unified Diff: test/cctest/cctest.h

Issue 12729023: first step to remove unsafe handles (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: issue with debug build Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/v8.h ('k') | test/cctest/cctest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/cctest.h
diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h
index 854d89e157857380399048145783b05795bd8213..30cbe799f902b37460efbe9e35758d585a3977ee 100644
--- a/test/cctest/cctest.h
+++ b/test/cctest/cctest.h
@@ -87,13 +87,16 @@ class CcTest {
default_isolate_ = default_isolate;
}
static v8::Isolate* default_isolate() { return default_isolate_; }
- static v8::Isolate* isolate() { return context_->GetIsolate(); }
- static v8::Handle<v8::Context> env() { return context_; }
+ static v8::Isolate* isolate() { return context()->GetIsolate(); }
+ static v8::Handle<v8::Context> env() { return context(); }
// Helper function to initialize the VM.
static void InitializeVM(CcTestExtensionFlags extensions = NO_EXTENSIONS);
private:
+ static v8::Handle<v8::Context> context() {
+ return *reinterpret_cast<v8::Handle<v8::Context>*>(&context_);
+ }
TestFunction* callback_;
const char* file_;
const char* name_;
@@ -195,7 +198,7 @@ class RegisterThreadedTest {
const char* name_;
};
-
+namespace v8 {
// A LocalContext holds a reference to a v8::Context.
class LocalContext {
public:
@@ -219,14 +222,15 @@ class LocalContext {
bool IsReady() { return !context_.IsEmpty(); }
v8::Local<v8::Context> local() {
- return v8::Local<v8::Context>::New(context_);
+ return v8::Local<v8::Context>::New(isolate_, context_);
}
private:
v8::Persistent<v8::Context> context_;
v8::Isolate* isolate_;
};
-
+}
+typedef v8::LocalContext LocalContext;
static inline v8::Local<v8::Value> v8_num(double x) {
return v8::Number::New(x);
« no previous file with comments | « src/v8.h ('k') | test/cctest/cctest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698