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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8HeapProfilerAgentImpl.cpp

Issue 1967933002: [DevTools] Dispatch messages to V8InspectorSession directly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@1936593002
Patch Set: rebased Created 4 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/v8_inspector/V8HeapProfilerAgentImpl.h" 5 #include "platform/v8_inspector/V8HeapProfilerAgentImpl.h"
6 6
7 #include "platform/v8_inspector/InjectedScript.h" 7 #include "platform/v8_inspector/InjectedScript.h"
8 #include "platform/v8_inspector/V8DebuggerImpl.h" 8 #include "platform/v8_inspector/V8DebuggerImpl.h"
9 #include "platform/v8_inspector/V8InspectorSessionImpl.h" 9 #include "platform/v8_inspector/V8InspectorSessionImpl.h"
10 #include "platform/v8_inspector/V8StringUtil.h" 10 #include "platform/v8_inspector/V8StringUtil.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 m_frontend->heapStatsUpdate(std::move(statsDiff)); 142 m_frontend->heapStatsUpdate(std::move(statsDiff));
143 return kContinue; 143 return kContinue;
144 } 144 }
145 145
146 private: 146 private:
147 protocol::Frontend::HeapProfiler* m_frontend; 147 protocol::Frontend::HeapProfiler* m_frontend;
148 }; 148 };
149 149
150 } // namespace 150 } // namespace
151 151
152 V8HeapProfilerAgentImpl::V8HeapProfilerAgentImpl(V8InspectorSessionImpl* session ) 152 V8HeapProfilerAgentImpl::V8HeapProfilerAgentImpl(V8InspectorSessionImpl* session , protocol::Frontend::HeapProfiler* frontend, protocol::DictionaryValue* state)
153 : m_session(session) 153 : m_session(session)
154 , m_isolate(session->debugger()->isolate()) 154 , m_isolate(session->debugger()->isolate())
155 , m_frontend(frontend)
156 , m_state(state)
155 , m_hasTimer(false) 157 , m_hasTimer(false)
156 { 158 {
157 } 159 }
158 160
159 V8HeapProfilerAgentImpl::~V8HeapProfilerAgentImpl() 161 V8HeapProfilerAgentImpl::~V8HeapProfilerAgentImpl()
160 { 162 {
161 } 163 }
162 164
163 void V8HeapProfilerAgentImpl::clearFrontend()
164 {
165 ErrorString error;
166 disable(&error);
167 DCHECK(m_frontend);
168 m_frontend = nullptr;
169 }
170
171 void V8HeapProfilerAgentImpl::restore() 165 void V8HeapProfilerAgentImpl::restore()
172 { 166 {
173 if (m_state->booleanProperty(HeapProfilerAgentState::heapProfilerEnabled, fa lse)) 167 if (m_state->booleanProperty(HeapProfilerAgentState::heapProfilerEnabled, fa lse))
174 m_frontend->resetProfiles(); 168 m_frontend->resetProfiles();
175 if (m_state->booleanProperty(HeapProfilerAgentState::heapObjectsTrackingEnab led, false)) 169 if (m_state->booleanProperty(HeapProfilerAgentState::heapObjectsTrackingEnab led, false))
176 startTrackingHeapObjectsInternal(m_state->booleanProperty(HeapProfilerAg entState::allocationTrackingEnabled, false)); 170 startTrackingHeapObjectsInternal(m_state->booleanProperty(HeapProfilerAg entState::allocationTrackingEnabled, false));
177 #if V8_MAJOR_VERSION >= 5 171 #if V8_MAJOR_VERSION >= 5
178 if (m_state->booleanProperty(HeapProfilerAgentState::samplingHeapProfilerEna bled, false)) { 172 if (m_state->booleanProperty(HeapProfilerAgentState::samplingHeapProfilerEna bled, false)) {
179 ErrorString error; 173 ErrorString error;
180 double samplingInterval = m_state->numberProperty(HeapProfilerAgentState ::samplingHeapProfilerInterval, -1); 174 double samplingInterval = m_state->numberProperty(HeapProfilerAgentState ::samplingHeapProfilerInterval, -1);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 *errorString = "Cannot access v8 sampled heap profile."; 394 *errorString = "Cannot access v8 sampled heap profile.";
401 return; 395 return;
402 } 396 }
403 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); 397 v8::AllocationProfile::Node* root = v8Profile->GetRootNode();
404 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() 398 *profile = protocol::HeapProfiler::SamplingHeapProfile::create()
405 .setHead(buildSampingHeapProfileNode(root)).build(); 399 .setHead(buildSampingHeapProfileNode(root)).build();
406 #endif 400 #endif
407 } 401 }
408 402
409 } // namespace blink 403 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698