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