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

Side by Side Diff: src/d8.cc

Issue 78453002: Reland r17907 - 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: updates 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
« no previous file with comments | « include/v8.h ('k') | src/isolate.h » ('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 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 static Handle<Value> Throw(const char* message) { 83 static Handle<Value> Throw(const char* message) {
84 return ThrowException(String::New(message)); 84 return ThrowException(String::New(message));
85 } 85 }
86 86
87 87
88 88
89 class PerIsolateData { 89 class PerIsolateData {
90 public: 90 public:
91 explicit PerIsolateData(Isolate* isolate) : isolate_(isolate), realms_(NULL) { 91 explicit PerIsolateData(Isolate* isolate) : isolate_(isolate), realms_(NULL) {
92 HandleScope scope(isolate); 92 HandleScope scope(isolate);
93 isolate->SetData(this); 93 isolate->SetData(0, this);
94 } 94 }
95 95
96 ~PerIsolateData() { 96 ~PerIsolateData() {
97 isolate_->SetData(NULL); // Not really needed, just to be sure... 97 isolate_->SetData(0, NULL); // Not really needed, just to be sure...
98 } 98 }
99 99
100 inline static PerIsolateData* Get(Isolate* isolate) { 100 inline static PerIsolateData* Get(Isolate* isolate) {
101 return reinterpret_cast<PerIsolateData*>(isolate->GetData()); 101 return reinterpret_cast<PerIsolateData*>(isolate->GetData(0));
102 } 102 }
103 103
104 class RealmScope { 104 class RealmScope {
105 public: 105 public:
106 explicit RealmScope(PerIsolateData* data); 106 explicit RealmScope(PerIsolateData* data);
107 ~RealmScope(); 107 ~RealmScope();
108 private: 108 private:
109 PerIsolateData* data_; 109 PerIsolateData* data_;
110 }; 110 };
111 111
(...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 } 1785 }
1786 1786
1787 } // namespace v8 1787 } // namespace v8
1788 1788
1789 1789
1790 #ifndef GOOGLE3 1790 #ifndef GOOGLE3
1791 int main(int argc, char* argv[]) { 1791 int main(int argc, char* argv[]) {
1792 return v8::Shell::Main(argc, argv); 1792 return v8::Shell::Main(argc, argv);
1793 } 1793 }
1794 #endif 1794 #endif
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698