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

Unified Diff: src/profiler/heap-snapshot-generator.cc

Issue 2669393002: [inspector] fixed taskHeapSnapshot on pause (Closed)
Patch Set: updated test expectations Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/inspector/heap-profiler/take-heap-snapshot-on-pause.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profiler/heap-snapshot-generator.cc
diff --git a/src/profiler/heap-snapshot-generator.cc b/src/profiler/heap-snapshot-generator.cc
index 0a9fb03226b61013c8c0f04103ded28bc43ef206..df8167310fb1d261c4d46d915cf8730f8cd4c7bd 100644
--- a/src/profiler/heap-snapshot-generator.cc
+++ b/src/profiler/heap-snapshot-generator.cc
@@ -2492,6 +2492,20 @@ HeapSnapshotGenerator::HeapSnapshotGenerator(
heap_(heap) {
}
+namespace {
+class NullContextScope {
+ public:
+ explicit NullContextScope(Isolate* isolate)
+ : isolate_(isolate), prev_(isolate->context()) {
+ isolate_->set_context(nullptr);
+ }
+ ~NullContextScope() { isolate_->set_context(prev_); }
+
+ private:
+ Isolate* isolate_;
+ Context* prev_;
+};
+} // namespace
bool HeapSnapshotGenerator::GenerateSnapshot() {
v8_heap_explorer_.TagGlobalObjects();
@@ -2505,6 +2519,8 @@ bool HeapSnapshotGenerator::GenerateSnapshot() {
heap_->CollectAllGarbage(Heap::kMakeHeapIterableMask,
GarbageCollectionReason::kHeapProfiler);
+ NullContextScope null_context_scope(heap_->isolate());
+
#ifdef VERIFY_HEAP
Heap* debug_heap = heap_;
if (FLAG_verify_heap) {
« no previous file with comments | « no previous file | test/inspector/heap-profiler/take-heap-snapshot-on-pause.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698