summaryrefslogtreecommitdiff
path: root/chromium/ipc/trace_ipc_message.cc
blob: 11fac5763488fae5193c2eed8c664294646e5cbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ipc/trace_ipc_message.h"

#include <stdint.h>

#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_start.h"
#include "third_party/perfetto/protos/perfetto/trace/track_event/chrome_legacy_ipc.pbzero.h"

namespace IPC {

using perfetto::protos::pbzero::ChromeLegacyIpc;

void WriteIpcMessageIdAsProtozero(uint32_t message_id,
                                  ChromeLegacyIpc* legacy_ipc) {
  ChromeLegacyIpc::MessageClass message_class =
      ChromeLegacyIpc::CLASS_UNSPECIFIED;
  switch (IPC_MESSAGE_ID_CLASS(message_id)) {
    case AutomationMsgStart:
      message_class = ChromeLegacyIpc::CLASS_AUTOMATION;
      break;
    case FrameMsgStart:
      message_class = ChromeLegacyIpc::CLASS_FRAME;
      break;
    case PageMsgStart:
      message_class = ChromeLegacyIpc::CLASS_PAGE;
      break;
    case ViewMsgStart:
      message_class = ChromeLegacyIpc::CLASS_VIEW;
      break;
    case WidgetMsgStart:
      message_class = ChromeLegacyIpc::CLASS_WIDGET;
      break;
    case TestMsgStart:
      message_class = ChromeLegacyIpc::CLASS_TEST;
      break;
    case WorkerMsgStart:
      message_class = ChromeLegacyIpc::CLASS_WORKER;
      break;
    case NaClMsgStart:
      message_class = ChromeLegacyIpc::CLASS_NACL;
      break;
    case GpuChannelMsgStart:
      message_class = ChromeLegacyIpc::CLASS_GPU_CHANNEL;
      break;
    case MediaMsgStart:
      message_class = ChromeLegacyIpc::CLASS_MEDIA;
      break;
    case PpapiMsgStart:
      message_class = ChromeLegacyIpc::CLASS_PPAPI;
      break;
    case ChromeMsgStart:
      message_class = ChromeLegacyIpc::CLASS_CHROME;
      break;
    case DragMsgStart:
      message_class = ChromeLegacyIpc::CLASS_DRAG;
      break;
    case PrintMsgStart:
      message_class = ChromeLegacyIpc::CLASS_PRINT;
      break;
    case ExtensionMsgStart:
      message_class = ChromeLegacyIpc::CLASS_EXTENSION;
      break;
    case TextInputClientMsgStart:
      message_class = ChromeLegacyIpc::CLASS_TEXT_INPUT_CLIENT;
      break;
    case PrerenderMsgStart:
      message_class = ChromeLegacyIpc::CLASS_PRERENDER;
      break;
    case ChromotingMsgStart:
      message_class = ChromeLegacyIpc::CLASS_CHROMOTING;
      break;
    case AndroidWebViewMsgStart:
      message_class = ChromeLegacyIpc::CLASS_ANDROID_WEB_VIEW;
      break;
    case NaClHostMsgStart:
      message_class = ChromeLegacyIpc::CLASS_NACL_HOST;
      break;
    case EncryptedMediaMsgStart:
      message_class = ChromeLegacyIpc::CLASS_ENCRYPTED_MEDIA;
      break;
    case CastMsgStart:
      message_class = ChromeLegacyIpc::CLASS_CAST;
      break;
    case GinJavaBridgeMsgStart:
      message_class = ChromeLegacyIpc::CLASS_GIN_JAVA_BRIDGE;
      break;
    case ChromeUtilityPrintingMsgStart:
      message_class = ChromeLegacyIpc::CLASS_CHROME_UTILITY_PRINTING;
      break;
    case OzoneGpuMsgStart:
      message_class = ChromeLegacyIpc::CLASS_OZONE_GPU;
      break;
    case WebTestMsgStart:
      message_class = ChromeLegacyIpc::CLASS_WEB_TEST;
      break;
    case ExtensionsGuestViewMsgStart:
      message_class = ChromeLegacyIpc::CLASS_EXTENSIONS_GUEST_VIEW;
      break;
    case GuestViewMsgStart:
      message_class = ChromeLegacyIpc::CLASS_GUEST_VIEW;
      break;
    case MediaPlayerDelegateMsgStart:
      message_class = ChromeLegacyIpc::CLASS_MEDIA_PLAYER_DELEGATE;
      break;
    case ExtensionWorkerMsgStart:
      message_class = ChromeLegacyIpc::CLASS_EXTENSION_WORKER;
      break;
    case UnfreezableFrameMsgStart:
      message_class = ChromeLegacyIpc::CLASS_UNFREEZABLE_FRAME;
      break;
  }
  legacy_ipc->set_message_class(message_class);
  legacy_ipc->set_message_line(IPC_MESSAGE_ID_LINE(message_id));
}

}  // namespace IPC