Skip to content
This repository was archived by the owner on Apr 3, 2020. It is now read-only.

Commit d3001c4

Browse files
Raphael Kubo da CostaMaksim Sisov
Raphael Kubo da Costa
authored and
Maksim Sisov
committed
Revert "[XDK] Add in-depth allocation tracker"
This reverts commit 283ac1d. The v8-crosswalk side of this patch was reverted in crosswalk-project/v8-crosswalk#157, so the chromium-crosswalk side needs to be reverted accordingly.
1 parent 7241dea commit d3001c4

File tree

8 files changed

+1
-258
lines changed

8 files changed

+1
-258
lines changed

third_party/WebKit/Source/core/inspector/InspectorHeapProfilerAgent.cpp

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,6 @@ class InspectorHeapProfilerAgent::HeapStatsUpdateTask final {
5353
Timer<HeapStatsUpdateTask> m_timer;
5454
};
5555

56-
class InspectorHeapProfilerAgent::HeapXDKUpdateTask final {
57-
public:
58-
explicit HeapXDKUpdateTask(V8HeapProfilerAgent*);
59-
void startTimer(float sav);
60-
void resetTimer() { m_timer.stop(); }
61-
void onTimer(Timer<HeapXDKUpdateTask>*);
62-
63-
private:
64-
V8HeapProfilerAgent* m_heapProfilerAgent;
65-
Timer<HeapXDKUpdateTask> m_timer;
66-
};
67-
6856
InspectorHeapProfilerAgent::HeapStatsUpdateTask::HeapStatsUpdateTask(V8HeapProfilerAgent* heapProfilerAgent)
6957
: m_heapProfilerAgent(heapProfilerAgent)
7058
, m_timer(this, &HeapStatsUpdateTask::onTimer)
@@ -243,46 +231,4 @@ void InspectorHeapProfilerAgent::stopSampling(ErrorString* errorString, OwnPtr<p
243231
m_v8HeapProfilerAgent->stopSampling(errorString, profile);
244232
}
245233

246-
InspectorHeapProfilerAgent::HeapXDKUpdateTask::HeapXDKUpdateTask(V8HeapProfilerAgent* heapProfilerAgent)
247-
: m_heapProfilerAgent(heapProfilerAgent)
248-
, m_timer(this, &HeapXDKUpdateTask::onTimer)
249-
{
250-
}
251-
252-
void InspectorHeapProfilerAgent::HeapXDKUpdateTask::onTimer(Timer<HeapXDKUpdateTask>*)
253-
{
254-
// The timer is stopped on m_heapProfilerAgent destruction,
255-
// so this method will never be called after m_heapProfilerAgent has been destroyed.
256-
m_heapProfilerAgent->requestHeapXDKUpdate();
257-
}
258-
259-
void InspectorHeapProfilerAgent::HeapXDKUpdateTask::startTimer(float sav)
260-
{
261-
ASSERT(!m_timer.isActive());
262-
m_timer.startRepeating(sav, BLINK_FROM_HERE);
263-
}
264-
265-
void InspectorHeapProfilerAgent::startTrackingHeapXDK(ErrorString* error, const protocol::Maybe<int>& depth, const protocol::Maybe<int>& sav, const protocol::Maybe<bool>& retentions)
266-
{
267-
if (m_heapXDKUpdateTask)
268-
return;
269-
270-
m_v8HeapProfilerAgent->startTrackingHeapXDK(error, depth, sav, retentions);
271-
float savTimer = (float) sav.fromMaybe(1000) / 1000.;
272-
m_heapXDKUpdateTask = adoptPtr(new HeapXDKUpdateTask(m_v8HeapProfilerAgent));
273-
m_heapXDKUpdateTask->startTimer(savTimer);
274-
}
275-
276-
void InspectorHeapProfilerAgent::stopTrackingHeapXDK(ErrorString* error, OwnPtr<protocol::HeapProfiler::HeapEventXDK>* profile)
277-
{
278-
if (!m_heapXDKUpdateTask) {
279-
*error = "Heap object tracking is not started.";
280-
return;
281-
}
282-
283-
m_v8HeapProfilerAgent->stopTrackingHeapXDK(error, profile);
284-
m_heapXDKUpdateTask->resetTimer();
285-
m_heapXDKUpdateTask.clear();
286-
}
287-
288234
} // namespace blink

third_party/WebKit/Source/core/inspector/InspectorHeapProfilerAgent.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include "wtf/Noncopyable.h"
3838
#include "wtf/OwnPtr.h"
3939
#include "wtf/PassOwnPtr.h"
40-
#include <v8-profiler.h>
4140

4241
namespace v8 {
4342
class Isolate;
@@ -70,13 +69,9 @@ class CORE_EXPORT InspectorHeapProfilerAgent final : public InspectorBaseAgent<I
7069
void getHeapObjectId(ErrorString*, const String16& objectId, String16* heapSnapshotObjectId) override;
7170
void startSampling(ErrorString*) override;
7271
void stopSampling(ErrorString*, OwnPtr<protocol::HeapProfiler::SamplingHeapProfile>*) override;
73-
void startTrackingHeapXDK(ErrorString*, const Maybe<int>& stack_depth, const Maybe<int>& sav, const Maybe<bool>& retentions) override;
74-
void stopTrackingHeapXDK(ErrorString*, OwnPtr<protocol::HeapProfiler::HeapEventXDK>*) override;
7572

7673
private:
7774
class HeapStatsUpdateTask;
78-
class HeapXDKStream;
79-
class HeapXDKUpdateTask;
8075

8176
InspectorHeapProfilerAgent(v8::Isolate*, V8HeapProfilerAgent*);
8277

@@ -86,7 +81,6 @@ class CORE_EXPORT InspectorHeapProfilerAgent final : public InspectorBaseAgent<I
8681

8782
V8HeapProfilerAgent* m_v8HeapProfilerAgent;
8883
OwnPtr<HeapStatsUpdateTask> m_heapStatsUpdateTask;
89-
OwnPtr<HeapXDKUpdateTask> m_heapXDKUpdateTask;
9084
v8::Isolate* m_isolate;
9185
};
9286

third_party/WebKit/Source/devtools/front_end/sdk/HeapProfilerModel.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ WebInspector.HeapProfilerModel.Events = {
1616
LastSeenObjectId: "LastSeenObjectId",
1717
AddHeapSnapshotChunk: "AddHeapSnapshotChunk",
1818
ReportHeapSnapshotProgress: "ReportHeapSnapshotProgress",
19-
ResetProfiles: "ResetProfiles",
20-
HeapXDKUpdate: "HeapXDKUpdate"
19+
ResetProfiles: "ResetProfiles"
2120
}
2221

2322
WebInspector.HeapProfilerModel.prototype = {
@@ -71,14 +70,6 @@ WebInspector.HeapProfilerModel.prototype = {
7170
this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.ResetProfiles);
7271
},
7372

74-
/**
75-
* @param {string} message
76-
*/
77-
heapXDKUpdate: function (message)
78-
{
79-
this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.HeapXDKUpdate, message);
80-
},
81-
8273
__proto__: WebInspector.SDKModel.prototype
8374
}
8475

@@ -138,14 +129,5 @@ WebInspector.HeapProfilerDispatcher.prototype = {
138129
resetProfiles: function()
139130
{
140131
this._heapProfilerModel.resetProfiles();
141-
},
142-
143-
/**
144-
* @override
145-
* @param {string} message
146-
*/
147-
heapXDKUpdate: function(message)
148-
{
149-
this._heapProfilerModel.heapXDKUpdate(message);
150132
}
151133
}

third_party/WebKit/Source/devtools/protocol.json

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3886,7 +3886,6 @@
38863886
{ "name": "columnNumber", "type": "integer", "description": "1-based column number of the function start position." },
38873887
{ "name": "hitCount", "type": "integer", "description": "Number of samples where this node was on top of the call stack." },
38883888
{ "name": "callUID", "type": "number", "description": "Call UID." },
3889-
{ "name": "stackEntryLine", "type": "integer", "description": "Hit line for entry in stack." },
38903889
{ "name": "children", "type": "array", "items": { "$ref": "CPUProfileNode" }, "description": "Child nodes." },
38913890
{ "name": "deoptReason", "type": "string", "description": "The reason of being not optimized. The function may be deoptimized or marked as don't optimize."},
38923891
{ "name": "id", "type": "integer", "description": "Unique id of the node." },
@@ -3991,19 +3990,6 @@
39913990
"properties": [
39923991
{ "name": "head", "$ref": "SamplingHeapProfileNode" }
39933992
]
3994-
},
3995-
{
3996-
"id": "HeapEventXDK",
3997-
"type": "object",
3998-
"description": "",
3999-
"properties": [
4000-
{ "name": "duration", "type": "integer" },
4001-
{ "name": "symbols", "type": "string" },
4002-
{ "name": "frames", "type": "string" },
4003-
{ "name": "types", "type": "string" },
4004-
{ "name": "chunks", "type": "string" },
4005-
{ "name": "retentions", "type": "string" }
4006-
]
40073993
}
40083994
],
40093995
"commands": [
@@ -4026,20 +4012,6 @@
40264012
]
40274013

40284014
},
4029-
{
4030-
"name": "startTrackingHeapXDK",
4031-
"parameters": [
4032-
{ "name": "stack_depth", "type": "integer", "optional": true },
4033-
{ "name": "sav", "type": "integer", "optional": true },
4034-
{ "name": "retentions", "type": "boolean", "optional": true }
4035-
]
4036-
},
4037-
{
4038-
"name": "stopTrackingHeapXDK",
4039-
"returns": [
4040-
{ "name": "profileXDK", "$ref": "HeapEventXDK", "description": "Recorded profile." }
4041-
]
4042-
},
40434015
{
40444016
"name": "takeHeapSnapshot",
40454017
"parameters": [
@@ -4117,16 +4089,6 @@
41174089
"parameters": [
41184090
{ "name": "statsUpdate", "type": "array", "items": { "type": "integer" }, "description": "An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment."}
41194091
]
4120-
},
4121-
{
4122-
"name": "heapXDKUpdate",
4123-
"parameters": [
4124-
{ "name": "symbols", "type": "string" },
4125-
{ "name": "frames", "type": "string" },
4126-
{ "name": "types", "type": "string" },
4127-
{ "name": "chunks", "type": "string" },
4128-
{ "name": "retentions", "type": "string" }
4129-
]
41304092
}
41314093
]
41324094
},

third_party/WebKit/Source/platform/v8_inspector/V8HeapProfilerAgentImpl.cpp

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -362,113 +362,4 @@ void V8HeapProfilerAgentImpl::stopSampling(ErrorString* errorString, OwnPtr<prot
362362
#endif
363363
}
364364

365-
class HeapXDKStream : public v8::OutputStream {
366-
public:
367-
HeapXDKStream(protocol::Frontend::HeapProfiler* frontend)
368-
: m_frontend(frontend)
369-
{
370-
}
371-
void EndOfStream() override { }
372-
373-
WriteResult WriteAsciiChunk(char* data, int size) override
374-
{
375-
ASSERT(false);
376-
return kAbort;
377-
}
378-
379-
WriteResult WriteHeapXDKChunk(const char* symbols, size_t symbolsSize, const char* frames, size_t framesSize, const char* types, size_t typesSize,
380-
const char* chunks, size_t chunksSize, const char* retentions, size_t retentionSize) override
381-
{
382-
m_frontend->heapXDKUpdate(String(symbols, symbolsSize), String(frames, framesSize), String(types, typesSize), String(chunks, chunksSize), String(retentions, retentionSize));
383-
return kContinue;
384-
}
385-
386-
private:
387-
protocol::Frontend::HeapProfiler* m_frontend;
388-
};
389-
390-
static PassOwnPtr<protocol::HeapProfiler::HeapEventXDK> createHeapProfileXDK(const HeapProfileXDK& heapProfileXDK)
391-
{
392-
OwnPtr<protocol::HeapProfiler::HeapEventXDK> profile = protocol::HeapProfiler::HeapEventXDK::create()
393-
.setDuration(heapProfileXDK.getDuration())
394-
.setSymbols(heapProfileXDK.getSymbols())
395-
.setFrames(heapProfileXDK.getFrames())
396-
.setTypes(heapProfileXDK.getTypes())
397-
.setChunks(heapProfileXDK.getChunks())
398-
.setRetentions(heapProfileXDK.getRetentions()).build();
399-
return profile.release();
400-
}
401-
402-
void V8HeapProfilerAgentImpl::startTrackingHeapXDK(ErrorString* error, const protocol::Maybe<int>& depth, const protocol::Maybe<int>& sav, const protocol::Maybe<bool>& retentions)
403-
{
404-
v8::HeapProfiler* profiler = m_isolate->GetHeapProfiler();
405-
if (!profiler) {
406-
*error = "Cannot access v8 heap profiler";
407-
return;
408-
}
409-
410-
m_state->setBoolean(HeapProfilerAgentState::heapObjectsTrackingEnabled, true);
411-
int stackDepth = depth.fromMaybe(8);
412-
bool needRetentions = retentions.fromMaybe(false);
413-
profiler->StartTrackingHeapObjectsXDK(stackDepth, needRetentions);
414-
}
415-
416-
void V8HeapProfilerAgentImpl::stopTrackingHeapXDK(ErrorString* error, OwnPtr<protocol::HeapProfiler::HeapEventXDK>* profile)
417-
{
418-
v8::HeapProfiler* profiler = m_isolate->GetHeapProfiler();
419-
if (!profiler) {
420-
*error = "Cannot access v8 heap profiler";
421-
return;
422-
}
423-
424-
OwnPtr<HeapProfileXDK> heapProfileXDK = HeapProfileXDK::create(
425-
profiler->StopTrackingHeapObjectsXDK(), m_isolate);
426-
*profile = createHeapProfileXDK(*heapProfileXDK);
427-
m_state->setBoolean(HeapProfilerAgentState::heapObjectsTrackingEnabled, false);
428-
}
429-
430-
void V8HeapProfilerAgentImpl::requestHeapXDKUpdate()
431-
{
432-
if (!m_frontend)
433-
return;
434-
HeapXDKStream heapXDKStream(m_frontend);
435-
m_isolate->GetHeapProfiler()->GetHeapXDKStats(
436-
&heapXDKStream);
437-
}
438-
439-
String HeapProfileXDK::getSymbols() const
440-
{
441-
v8::HandleScope handleScope(m_isolate);
442-
return String(m_event->getSymbols());
443-
}
444-
445-
String HeapProfileXDK::getFrames() const
446-
{
447-
v8::HandleScope handleScope(m_isolate);
448-
return String(m_event->getFrames());
449-
}
450-
451-
String HeapProfileXDK::getTypes() const
452-
{
453-
v8::HandleScope handleScope(m_isolate);
454-
return String(m_event->getTypes());
455-
}
456-
457-
String HeapProfileXDK::getChunks() const
458-
{
459-
v8::HandleScope handleScope(m_isolate);
460-
return String(m_event->getChunks());
461-
}
462-
463-
int HeapProfileXDK::getDuration() const
464-
{
465-
return (int)m_event->getDuration();
466-
}
467-
468-
String HeapProfileXDK::getRetentions() const
469-
{
470-
v8::HandleScope handleScope(m_isolate);
471-
return String(m_event->getRetentions());
472-
}
473-
474365
} // namespace blink

third_party/WebKit/Source/platform/v8_inspector/V8HeapProfilerAgentImpl.h

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,13 @@
77

88
#include "platform/inspector_protocol/Allocator.h"
99
#include "platform/v8_inspector/public/V8HeapProfilerAgent.h"
10-
#include <v8-profiler.h>
1110

1211
namespace blink {
1312

1413
class V8InspectorSessionImpl;
1514

1615
using protocol::Maybe;
1716

18-
class HeapProfileXDK final {
19-
public:
20-
static PassOwnPtr<HeapProfileXDK> create(v8::HeapEventXDK* event, v8::Isolate* isolate)
21-
{
22-
return adoptPtr(new HeapProfileXDK(event, isolate));
23-
}
24-
25-
String getSymbols() const;
26-
String getFrames() const;
27-
String getTypes() const;
28-
String getChunks() const;
29-
String getRetentions() const;
30-
int getDuration() const;
31-
32-
private:
33-
HeapProfileXDK(v8::HeapEventXDK* event, v8::Isolate* isolate)
34-
: m_event(event),
35-
m_isolate(isolate)
36-
{
37-
}
38-
39-
v8::HeapEventXDK* m_event;
40-
v8::Isolate* m_isolate;
41-
};
42-
4317
class V8HeapProfilerAgentImpl : public V8HeapProfilerAgent {
4418
PROTOCOL_DISALLOW_COPY(V8HeapProfilerAgentImpl);
4519
public:
@@ -65,14 +39,10 @@ class V8HeapProfilerAgentImpl : public V8HeapProfilerAgent {
6539
void addInspectedHeapObject(ErrorString*, const String16& inspectedHeapObjectId) override;
6640
void getHeapObjectId(ErrorString*, const String16& objectId, String16* heapSnapshotObjectId) override;
6741

68-
void startTrackingHeapXDK(ErrorString*, const Maybe<int>& depth, const Maybe<int>& sav, const Maybe<bool>& retentions) override;
69-
void stopTrackingHeapXDK(ErrorString*, OwnPtr<protocol::HeapProfiler::HeapEventXDK>*) override;
70-
7142
void startSampling(ErrorString*) override;
7243
void stopSampling(ErrorString*, OwnPtr<protocol::HeapProfiler::SamplingHeapProfile>*) override;
7344

7445
void requestHeapStatsUpdate() override;
75-
void requestHeapXDKUpdate() override;
7646

7747
private:
7848
void startTrackingHeapObjectsInternal(bool trackAllocations);

third_party/WebKit/Source/platform/v8_inspector/V8ProfilerAgentImpl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ PassOwnPtr<protocol::Profiler::CPUProfileNode> buildInspectorObjectFor(v8::Isola
6161
.setColumnNumber(node->GetColumnNumber())
6262
.setHitCount(node->GetHitCount())
6363
.setCallUID(node->GetCallUid())
64-
.setStackEntryLine(node->GetSrcLine())
6564
.setChildren(children.release())
6665
.setPositionTicks(positionTicks.release())
6766
.setDeoptReason(node->GetBailoutReason())

third_party/WebKit/Source/platform/v8_inspector/public/V8HeapProfilerAgent.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class PLATFORM_EXPORT V8HeapProfilerAgent : public protocol::Backend::HeapProfil
1818
virtual ~V8HeapProfilerAgent() { }
1919

2020
virtual void requestHeapStatsUpdate() = 0;
21-
virtual void requestHeapXDKUpdate() = 0;
2221
};
2322

2423
} // namespace blink

0 commit comments

Comments
 (0)