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