From 0422c426bf0559a7b261337265d26dd8231d3365 Mon Sep 17 00:00:00 2001 From: "svenpanne@chromium.org" Date: Wed, 16 Apr 2014 08:42:08 +0000 Subject: [PATCH] Protect against API abuse. This makes Chrome's --single-process work again, but the real solution is to pass an Isolate explicitly and fixing things on the Chrome side => follow-up CLs. R=ulan@chromium.org Review URL: https://codereview.chromium.org/239513006 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20787 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/api.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/api.cc b/src/api.cc index fde3b5d050..2d850f755a 100644 --- a/src/api.cc +++ b/src/api.cc @@ -6291,12 +6291,16 @@ void V8::SetCaptureStackTraceForUncaughtExceptions( void V8::SetCounterFunction(CounterLookupCallback callback) { i::Isolate* isolate = i::Isolate::UncheckedCurrent(); + // TODO(svenpanne) The Isolate should really be a parameter. + if (isolate == NULL) return; isolate->stats_table()->SetCounterFunction(callback); } void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) { i::Isolate* isolate = i::Isolate::UncheckedCurrent(); + // TODO(svenpanne) The Isolate should really be a parameter. + if (isolate == NULL) return; isolate->stats_table()->SetCreateHistogramFunction(callback); isolate->InitializeLoggingAndCounters(); isolate->counters()->ResetHistograms(); @@ -6305,6 +6309,8 @@ void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) { void V8::SetAddHistogramSampleFunction(AddHistogramSampleCallback callback) { i::Isolate* isolate = i::Isolate::UncheckedCurrent(); + // TODO(svenpanne) The Isolate should really be a parameter. + if (isolate == NULL) return; isolate->stats_table()-> SetAddHistogramSampleFunction(callback); }