Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / content / common / child_process_messages.h
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Common IPC messages used for child processes.
6 // Multiply-included message file, hence no include guard.
7
8 #include <string>
9 #include <vector>
10
11 #include "base/memory/shared_memory.h"
12 #include "base/tracked_objects.h"
13 #include "base/values.h"
14 #include "content/common/content_export.h"
15 #include "ipc/ipc_message_macros.h"
16 #include "ui/gfx/gpu_memory_buffer.h"
17
18 IPC_ENUM_TRAITS_MAX_VALUE(tracked_objects::ThreadData::Status,
19                           tracked_objects::ThreadData::STATUS_LAST)
20
21 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::LocationSnapshot)
22   IPC_STRUCT_TRAITS_MEMBER(file_name)
23   IPC_STRUCT_TRAITS_MEMBER(function_name)
24   IPC_STRUCT_TRAITS_MEMBER(line_number)
25 IPC_STRUCT_TRAITS_END()
26
27 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::BirthOnThreadSnapshot)
28   IPC_STRUCT_TRAITS_MEMBER(location)
29   IPC_STRUCT_TRAITS_MEMBER(thread_name)
30 IPC_STRUCT_TRAITS_END()
31
32 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::DeathDataSnapshot)
33   IPC_STRUCT_TRAITS_MEMBER(count)
34   IPC_STRUCT_TRAITS_MEMBER(run_duration_sum)
35   IPC_STRUCT_TRAITS_MEMBER(run_duration_max)
36   IPC_STRUCT_TRAITS_MEMBER(run_duration_sample)
37   IPC_STRUCT_TRAITS_MEMBER(queue_duration_sum)
38   IPC_STRUCT_TRAITS_MEMBER(queue_duration_max)
39   IPC_STRUCT_TRAITS_MEMBER(queue_duration_sample)
40 IPC_STRUCT_TRAITS_END()
41
42 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::TaskSnapshot)
43   IPC_STRUCT_TRAITS_MEMBER(birth)
44   IPC_STRUCT_TRAITS_MEMBER(death_data)
45   IPC_STRUCT_TRAITS_MEMBER(death_thread_name)
46 IPC_STRUCT_TRAITS_END()
47
48 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::ParentChildPairSnapshot)
49   IPC_STRUCT_TRAITS_MEMBER(parent)
50   IPC_STRUCT_TRAITS_MEMBER(child)
51 IPC_STRUCT_TRAITS_END()
52
53 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::ProcessDataSnapshot)
54   IPC_STRUCT_TRAITS_MEMBER(tasks)
55   IPC_STRUCT_TRAITS_MEMBER(descendants)
56   IPC_STRUCT_TRAITS_MEMBER(process_id)
57 IPC_STRUCT_TRAITS_END()
58
59 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBufferType,
60                           gfx::GPU_MEMORY_BUFFER_TYPE_LAST)
61
62 IPC_STRUCT_TRAITS_BEGIN(gfx::GpuMemoryBufferHandle)
63   IPC_STRUCT_TRAITS_MEMBER(type)
64   IPC_STRUCT_TRAITS_MEMBER(handle)
65 #if defined(OS_MACOSX)
66   IPC_STRUCT_TRAITS_MEMBER(io_surface_id)
67 #endif
68 IPC_STRUCT_TRAITS_END()
69
70 #undef IPC_MESSAGE_EXPORT
71 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
72
73 #define IPC_MESSAGE_START ChildProcessMsgStart
74
75 // Messages sent from the browser to the child process.
76
77 // Sent in response to ChildProcessHostMsg_ShutdownRequest to tell the child
78 // process that it's safe to shutdown.
79 IPC_MESSAGE_CONTROL0(ChildProcessMsg_Shutdown)
80
81 #if defined(IPC_MESSAGE_LOG_ENABLED)
82 // Tell the child process to begin or end IPC message logging.
83 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetIPCLoggingEnabled,
84                      bool /* on or off */)
85 #endif
86
87 // Tell the child process to enable or disable the profiler status.
88 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetProfilerStatus,
89                      tracked_objects::ThreadData::Status /* profiler status */)
90
91 // Send to all the child processes to send back profiler data (ThreadData in
92 // tracked_objects).
93 IPC_MESSAGE_CONTROL1(ChildProcessMsg_GetChildProfilerData,
94                      int /* sequence_number */)
95
96 // Send to all the child processes to send back histogram data.
97 IPC_MESSAGE_CONTROL1(ChildProcessMsg_GetChildHistogramData,
98                      int /* sequence_number */)
99
100 // Sent to child processes to dump their handle table.
101 IPC_MESSAGE_CONTROL0(ChildProcessMsg_DumpHandles)
102
103 #if defined(USE_TCMALLOC)
104 // Sent to child process to request tcmalloc stats.
105 IPC_MESSAGE_CONTROL0(ChildProcessMsg_GetTcmallocStats)
106 #endif
107
108 ////////////////////////////////////////////////////////////////////////////////
109 // Messages sent from the child process to the browser.
110
111 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ShutdownRequest)
112
113 // Send back profiler data (ThreadData in tracked_objects).
114 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_ChildProfilerData,
115                      int, /* sequence_number */
116                      tracked_objects::ProcessDataSnapshot /* profiler_data */)
117
118 // Send back histograms as vector of pickled-histogram strings.
119 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_ChildHistogramData,
120                      int, /* sequence_number */
121                      std::vector<std::string> /* histogram_data */)
122
123 // Request a histogram from the browser. The browser will send the histogram
124 // data only if it has been passed the command line flag
125 // switches::kDomAutomationController.
126 IPC_SYNC_MESSAGE_CONTROL1_1(ChildProcessHostMsg_GetBrowserHistogram,
127                             std::string, /* histogram_name */
128                             std::string /* histogram_json */)
129
130 // Reply to ChildProcessMsg_DumpHandles when handle table dump is complete.
131 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_DumpHandlesDone)
132
133 #if defined(OS_WIN)
134 // Request that the given font be loaded by the host so it's cached by the
135 // OS. Please see ChildProcessHost::PreCacheFont for details.
136 IPC_SYNC_MESSAGE_CONTROL1_0(ChildProcessHostMsg_PreCacheFont,
137                             LOGFONT /* font data */)
138
139 // Release the cached font
140 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ReleaseCachedFonts)
141 #endif  // defined(OS_WIN)
142
143 // Asks the browser to create a block of shared memory for the child process to
144 // fill in and pass back to the browser.
145 IPC_SYNC_MESSAGE_CONTROL1_1(ChildProcessHostMsg_SyncAllocateSharedMemory,
146                             uint32 /* buffer size */,
147                             base::SharedMemoryHandle)
148
149 #if defined(USE_TCMALLOC)
150 // Reply to ChildProcessMsg_GetTcmallocStats.
151 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_TcmallocStats,
152                      std::string /* output */)
153 #endif
154
155 // Asks the browser to create a gpu memory buffer.
156 IPC_SYNC_MESSAGE_CONTROL3_1(ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer,
157                             uint32 /* width */,
158                             uint32 /* height */,
159                             uint32 /* internalformat */,
160                             gfx::GpuMemoryBufferHandle)