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

Side by Side Diff: src/d8.cc

Issue 77913003: Make it possible to add more than one piece of embedder data to isolates (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 static Handle<Value> Throw(const char* message) { 85 static Handle<Value> Throw(const char* message) {
86 return ThrowException(String::New(message)); 86 return ThrowException(String::New(message));
87 } 87 }
88 88
89 89
90 90
91 class PerIsolateData { 91 class PerIsolateData {
92 public: 92 public:
93 explicit PerIsolateData(Isolate* isolate) : isolate_(isolate), realms_(NULL) { 93 explicit PerIsolateData(Isolate* isolate) : isolate_(isolate), realms_(NULL) {
94 HandleScope scope(isolate); 94 HandleScope scope(isolate);
95 isolate->SetData(this); 95 isolate->SetData(0, this);
96 } 96 }
97 97
98 ~PerIsolateData() { 98 ~PerIsolateData() {
99 isolate_->SetData(NULL); // Not really needed, just to be sure... 99 isolate_->SetData(0, NULL); // Not really needed, just to be sure...
100 } 100 }
101 101
102 inline static PerIsolateData* Get(Isolate* isolate) { 102 inline static PerIsolateData* Get(Isolate* isolate) {
103 return reinterpret_cast<PerIsolateData*>(isolate->GetData()); 103 return reinterpret_cast<PerIsolateData*>(isolate->GetData(0));
104 } 104 }
105 105
106 class RealmScope { 106 class RealmScope {
107 public: 107 public:
108 explicit RealmScope(PerIsolateData* data); 108 explicit RealmScope(PerIsolateData* data);
109 ~RealmScope(); 109 ~RealmScope();
110 private: 110 private:
111 PerIsolateData* data_; 111 PerIsolateData* data_;
112 }; 112 };
113 113
(...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after
1787 } 1787 }
1788 1788
1789 } // namespace v8 1789 } // namespace v8
1790 1790
1791 1791
1792 #ifndef GOOGLE3 1792 #ifndef GOOGLE3
1793 int main(int argc, char* argv[]) { 1793 int main(int argc, char* argv[]) {
1794 return v8::Shell::Main(argc, argv); 1794 return v8::Shell::Main(argc, argv);
1795 } 1795 }
1796 #endif 1796 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698