Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlprofilereventtype.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant
4
7
8#include <QtCore/qdatastream.h>
9
10QT_BEGIN_NAMESPACE
11
12QDataStream &operator>>(QDataStream &stream, QQmlProfilerEventType &type)
13{
14 quint8 message;
15 quint8 rangeType;
16 stream >> type.m_displayName >> type.m_data >> type.m_location >> message >> rangeType
17 >> type.m_detailType;
18 type.m_message = static_cast<Message>(message);
19 type.m_rangeType = static_cast<RangeType>(rangeType);
20
21 // If the trace is from before Quick3D events were introduced, the value that's now
22 // Quick3DFrame is MaximumMessage and denoted a range. Check for that.
23 if (type.m_message == Quick3DFrame && type.m_rangeType != MaximumRangeType)
24 type.m_message = MaximumMessage;
25
26 return stream;
27}
28
29QDataStream &operator<<(QDataStream &stream, const QQmlProfilerEventType &type)
30{
31 return stream << type.m_displayName << type.m_data << type.m_location
32 << static_cast<quint8>(type.m_message) << static_cast<quint8>(type.m_rangeType)
33 << type.m_detailType;
34}
35
36ProfileFeature QQmlProfilerEventType::feature() const
37{
38 switch (m_message) {
39 case Event: {
40 switch (m_detailType) {
41 case Mouse:
42 case Key:
43 return ProfileInputEvents;
44 case AnimationFrame:
45 return ProfileAnimations;
46 default:
47 return MaximumProfileFeature;
48 }
49 }
50 case PixmapCacheEvent:
51 return ProfilePixmapCache;
52 case SceneGraphFrame:
53 return ProfileSceneGraph;
54 case MemoryAllocation:
55 return ProfileMemory;
56 case DebugMessage:
57 return ProfileDebugMessages;
58 case Quick3DFrame:
59 return ProfileQuick3D;
60 default:
61 break;
62 }
63
64 switch (m_rangeType) {
65 case Painting:
66 return ProfilePainting;
67 case Compiling:
68 return ProfileCompiling;
69 case Creating:
70 return ProfileCreating;
71 case Binding:
72 return ProfileBinding;
73 case HandlingSignal:
74 return ProfileHandlingSignal;
75 case Javascript:
76 return ProfileJavaScript;
77 default:
78 return MaximumProfileFeature;
79 }
80}
81
82
83QT_END_NAMESPACE