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

Side by Side Diff: src/api.cc

Issue 16943006: V8 API: Add a missing NULL check into Isolate::GetCurrentContext(). (Closed) Base URL: https://chromium.googlesource.com/external/v8.git@master
Patch Set: Created 7 years, 6 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 | « no previous file | 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 6520 matching lines...) Expand 10 before | Expand all | Expand 10 after
6531 6531
6532 CpuProfiler* Isolate::GetCpuProfiler() { 6532 CpuProfiler* Isolate::GetCpuProfiler() {
6533 i::CpuProfiler* cpu_profiler = 6533 i::CpuProfiler* cpu_profiler =
6534 reinterpret_cast<i::Isolate*>(this)->cpu_profiler(); 6534 reinterpret_cast<i::Isolate*>(this)->cpu_profiler();
6535 return reinterpret_cast<CpuProfiler*>(cpu_profiler); 6535 return reinterpret_cast<CpuProfiler*>(cpu_profiler);
6536 } 6536 }
6537 6537
6538 6538
6539 v8::Local<v8::Context> Isolate::GetCurrentContext() { 6539 v8::Local<v8::Context> Isolate::GetCurrentContext() {
6540 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); 6540 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this);
6541 i::Handle<i::Object> current = internal_isolate->native_context(); 6541 i::Context* context = internal_isolate->context();
6542 if (current.is_null()) return Local<Context>(); 6542 if (context == NULL) return Local<Context>();
6543 i::Handle<i::Context> context = i::Handle<i::Context>::cast(current); 6543 i::Context* native_context = context->global_object()->native_context();
6544 return Utils::ToLocal(context); 6544 if (native_context == NULL) return Local<Context>();
6545 return Utils::ToLocal(i::Handle<i::Context>(native_context));
6545 } 6546 }
6546 6547
6547 6548
6548 void Isolate::SetObjectGroupId(const Persistent<Value>& object, 6549 void Isolate::SetObjectGroupId(const Persistent<Value>& object,
6549 UniqueId id) { 6550 UniqueId id) {
6550 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); 6551 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this);
6551 internal_isolate->global_handles()->SetObjectGroupId( 6552 internal_isolate->global_handles()->SetObjectGroupId(
6552 Utils::OpenPersistent(object).location(), 6553 Utils::OpenPersistent(object).location(),
6553 id); 6554 id);
6554 } 6555 }
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
8050 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8051 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8051 Address callback_address = 8052 Address callback_address =
8052 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8053 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8053 VMState<EXTERNAL> state(isolate); 8054 VMState<EXTERNAL> state(isolate);
8054 ExternalCallbackScope call_scope(isolate, callback_address); 8055 ExternalCallbackScope call_scope(isolate, callback_address);
8055 return callback(info); 8056 return callback(info);
8056 } 8057 }
8057 8058
8058 8059
8059 } } // namespace v8::internal 8060 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698