Revision: 20787
Author:   [email protected]
Date:     Wed Apr 16 08:42:08 2014 UTC
Log:      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.

[email protected]

Review URL: https://codereview.chromium.org/239513006
http://code.google.com/p/v8/source/detail?r=20787

Modified:
 /branches/bleeding_edge/src/api.cc

=======================================
--- /branches/bleeding_edge/src/api.cc  Tue Apr 15 10:45:34 2014 UTC
+++ /branches/bleeding_edge/src/api.cc  Wed Apr 16 08:42:08 2014 UTC
@@ -6291,12 +6291,16 @@

 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::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);
 }

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to