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

Side by Side Diff: src/api.cc

Issue 13426002: Pass an isolate to GetCurrent() (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Added a test 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 unified diff | Download patch
« no previous file with comments | « include/v8.h ('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 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 4994 matching lines...) Expand 10 before | Expand all | Expand 10 after
5005 if (IsDeadCheck(isolate, "v8::Context::GetCurrent()")) { 5005 if (IsDeadCheck(isolate, "v8::Context::GetCurrent()")) {
5006 return Local<Context>(); 5006 return Local<Context>();
5007 } 5007 }
5008 i::Handle<i::Object> current = isolate->native_context(); 5008 i::Handle<i::Object> current = isolate->native_context();
5009 if (current.is_null()) return Local<Context>(); 5009 if (current.is_null()) return Local<Context>();
5010 i::Handle<i::Context> context = i::Handle<i::Context>::cast(current); 5010 i::Handle<i::Context> context = i::Handle<i::Context>::cast(current);
5011 return Utils::ToLocal(context); 5011 return Utils::ToLocal(context);
5012 } 5012 }
5013 5013
5014 5014
5015 v8::Local<v8::Context> Context::GetCurrent(Isolate* exported_isolate) {
5016 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(exported_isolate);
5017 ASSERT(isolate == i::Isolate::Current());
5018 i::Handle<i::Object> current = isolate->native_context();
5019 if (current.is_null()) return Local<Context>();
5020 i::Handle<i::Context> context = i::Handle<i::Context>::cast(current);
5021 return Utils::ToLocal(context);
5022 }
5023
5024
5015 v8::Local<v8::Context> Context::GetCalling() { 5025 v8::Local<v8::Context> Context::GetCalling() {
5016 i::Isolate* isolate = i::Isolate::Current(); 5026 i::Isolate* isolate = i::Isolate::Current();
5017 if (IsDeadCheck(isolate, "v8::Context::GetCalling()")) { 5027 if (IsDeadCheck(isolate, "v8::Context::GetCalling()")) {
5018 return Local<Context>(); 5028 return Local<Context>();
5019 } 5029 }
5020 i::Handle<i::Object> calling = 5030 i::Handle<i::Object> calling =
5021 isolate->GetCallingNativeContext(); 5031 isolate->GetCallingNativeContext();
5022 if (calling.is_null()) return Local<Context>(); 5032 if (calling.is_null()) return Local<Context>();
5023 i::Handle<i::Context> context = i::Handle<i::Context>::cast(calling); 5033 i::Handle<i::Context> context = i::Handle<i::Context>::cast(calling);
5024 return Utils::ToLocal(context); 5034 return Utils::ToLocal(context);
(...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after
7069 7079
7070 v->VisitPointers(blocks_.first(), first_block_limit_); 7080 v->VisitPointers(blocks_.first(), first_block_limit_);
7071 7081
7072 for (int i = 1; i < blocks_.length(); i++) { 7082 for (int i = 1; i < blocks_.length(); i++) {
7073 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 7083 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
7074 } 7084 }
7075 } 7085 }
7076 7086
7077 7087
7078 } } // namespace v8::internal 7088 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698