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

Side by Side Diff: src/api.cc

Issue 11968011: Implement Context::GetIsolate() (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 7 years, 11 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 4686 matching lines...) Expand 10 before | Expand all | Expand 10 after
4697 i::Handle<i::Context> env = Utils::OpenHandle(this); 4697 i::Handle<i::Context> env = Utils::OpenHandle(this);
4698 return env->has_out_of_memory(); 4698 return env->has_out_of_memory();
4699 } 4699 }
4700 4700
4701 4701
4702 bool Context::InContext() { 4702 bool Context::InContext() {
4703 return i::Isolate::Current()->context() != NULL; 4703 return i::Isolate::Current()->context() != NULL;
4704 } 4704 }
4705 4705
4706 4706
4707 v8::Isolate* Context::GetIsolate() {
4708 i::Handle<i::Context> env = Utils::OpenHandle(this);
4709 return reinterpret_cast<Isolate*>(env->GetIsolate());
4710 }
4711
4712
4707 v8::Local<v8::Context> Context::GetEntered() { 4713 v8::Local<v8::Context> Context::GetEntered() {
4708 i::Isolate* isolate = i::Isolate::Current(); 4714 i::Isolate* isolate = i::Isolate::Current();
4709 if (!EnsureInitializedForIsolate(isolate, "v8::Context::GetEntered()")) { 4715 if (!EnsureInitializedForIsolate(isolate, "v8::Context::GetEntered()")) {
4710 return Local<Context>(); 4716 return Local<Context>();
4711 } 4717 }
4712 i::Handle<i::Object> last = 4718 i::Handle<i::Object> last =
4713 isolate->handle_scope_implementer()->LastEnteredContext(); 4719 isolate->handle_scope_implementer()->LastEnteredContext();
4714 if (last.is_null()) return Local<Context>(); 4720 if (last.is_null()) return Local<Context>();
4715 i::Handle<i::Context> context = i::Handle<i::Context>::cast(last); 4721 i::Handle<i::Context> context = i::Handle<i::Context>::cast(last);
4716 return Utils::ToLocal(context); 4722 return Utils::ToLocal(context);
(...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after
6767 6773
6768 v->VisitPointers(blocks_.first(), first_block_limit_); 6774 v->VisitPointers(blocks_.first(), first_block_limit_);
6769 6775
6770 for (int i = 1; i < blocks_.length(); i++) { 6776 for (int i = 1; i < blocks_.length(); i++) {
6771 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6777 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6772 } 6778 }
6773 } 6779 }
6774 6780
6775 6781
6776 } } // namespace v8::internal 6782 } } // 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