Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 7c484de53ee1e537a8abeefdce1e0cab69e4952e..fa687bbad090f8cddb47dab6a2bb3ed99cc89881 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -11,6 +11,7 @@ |
#include <cmath> // For isnan. |
#include "include/v8-debug.h" |
#include "include/v8-profiler.h" |
+#include "include/v8-sampler.h" |
#include "include/v8-testing.h" |
#include "src/assert-scope.h" |
#include "src/base/platform/platform.h" |
@@ -30,6 +31,7 @@ |
#include "src/heap-snapshot-generator-inl.h" |
#include "src/icu_util.h" |
#include "src/json-parser.h" |
+#include "src/log.h" |
#include "src/messages.h" |
#include "src/natives.h" |
#include "src/parser.h" |
@@ -7425,6 +7427,23 @@ void HeapProfiler::SetRetainedObjectInfo(UniqueId id, |
reinterpret_cast<i::HeapProfiler*>(this)->SetRetainedObjectInfo(id, info); |
} |
+Sample* Sampler::GetSample(Isolate* isolate, |
+ Sample* sample) { |
+ i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
+ |
+ i::Logger* logger = internal_isolate->logger(); |
+ if (logger == NULL) return NULL; |
+ |
+ i::Sampler* sampler = logger->sampler(); |
+ if (sampler == NULL) return NULL; |
+ |
+ // TODO(gohlap): These checks and getters above are just transitory. |
+ // Get rid of those as we make the API mature. |
+ // We have these right now because we want the new API |
+ // to play well with the current cpu-profiler thread inside v8. |
+ |
+ return sampler->GetSample(sample); |
+} |
v8::Testing::StressType internal::Testing::stress_type_ = |
v8::Testing::kStressTypeOpt; |