Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Common IPC messages used for child processes. | 5 // Common IPC messages used for child processes. |
| 6 // Multiply-included message file, hence no include guard. | 6 // Multiply-included message file, hence no include guard. |
| 7 | 7 |
| 8 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
| 9 #include "base/tracked_objects.h" | 9 #include "base/tracked_objects.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 #include "content/public/common/process_type.h" | |
| 12 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 13 #include "ipc/ipc_message_macros.h" | 14 #include "ipc/ipc_message_macros.h" |
| 14 | 15 |
| 16 IPC_ENUM_TRAITS(content::ProcessType) | |
| 15 IPC_ENUM_TRAITS(tracked_objects::ThreadData::Status) | 17 IPC_ENUM_TRAITS(tracked_objects::ThreadData::Status) |
| 16 | 18 |
| 19 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::SerializedLocation) | |
| 20 IPC_STRUCT_TRAITS_MEMBER(file_name) | |
| 21 IPC_STRUCT_TRAITS_MEMBER(function_name) | |
| 22 IPC_STRUCT_TRAITS_MEMBER(line_number) | |
| 23 IPC_STRUCT_TRAITS_END() | |
| 24 | |
| 25 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::SerializedBirthOnThread) | |
| 26 IPC_STRUCT_TRAITS_MEMBER(location) | |
| 27 IPC_STRUCT_TRAITS_MEMBER(thread_name) | |
| 28 IPC_STRUCT_TRAITS_END() | |
| 29 | |
| 30 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::SerializedDeathData) | |
| 31 IPC_STRUCT_TRAITS_MEMBER(count) | |
| 32 IPC_STRUCT_TRAITS_MEMBER(run_duration_sum) | |
| 33 IPC_STRUCT_TRAITS_MEMBER(run_duration_max) | |
| 34 IPC_STRUCT_TRAITS_MEMBER(run_duration_sample) | |
| 35 IPC_STRUCT_TRAITS_MEMBER(queue_duration_sum) | |
| 36 IPC_STRUCT_TRAITS_MEMBER(queue_duration_max) | |
| 37 IPC_STRUCT_TRAITS_MEMBER(queue_duration_sample) | |
| 38 IPC_STRUCT_TRAITS_END() | |
| 39 | |
| 40 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::SerializedSnapshot) | |
| 41 IPC_STRUCT_TRAITS_MEMBER(birth) | |
| 42 IPC_STRUCT_TRAITS_MEMBER(death_data) | |
| 43 IPC_STRUCT_TRAITS_MEMBER(death_thread_name) | |
| 44 IPC_STRUCT_TRAITS_END() | |
| 45 | |
| 46 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::SerializedParentChildPair) | |
| 47 IPC_STRUCT_TRAITS_MEMBER(parent) | |
| 48 IPC_STRUCT_TRAITS_MEMBER(child) | |
| 49 IPC_STRUCT_TRAITS_END() | |
| 50 | |
| 51 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::SerializedProcessData) | |
| 52 IPC_STRUCT_TRAITS_MEMBER(snapshots) | |
| 53 IPC_STRUCT_TRAITS_MEMBER(descendants) | |
| 54 IPC_STRUCT_TRAITS_MEMBER(process_id) | |
| 55 IPC_STRUCT_TRAITS_END() | |
| 56 | |
| 17 #undef IPC_MESSAGE_EXPORT | 57 #undef IPC_MESSAGE_EXPORT |
| 18 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | 58 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
| 19 | 59 |
| 20 #define IPC_MESSAGE_START ChildProcessMsgStart | 60 #define IPC_MESSAGE_START ChildProcessMsgStart |
| 21 | 61 |
| 22 // Messages sent from the browser to the child process. | 62 // Messages sent from the browser to the child process. |
| 23 | 63 |
| 24 // Sent in response to ChildProcessHostMsg_ShutdownRequest to tell the child | 64 // Sent in response to ChildProcessHostMsg_ShutdownRequest to tell the child |
| 25 // process that it's safe to shutdown. | 65 // process that it's safe to shutdown. |
| 26 IPC_MESSAGE_CONTROL0(ChildProcessMsg_Shutdown) | 66 IPC_MESSAGE_CONTROL0(ChildProcessMsg_Shutdown) |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 42 // Sent to all child processes to get trace buffer fullness. | 82 // Sent to all child processes to get trace buffer fullness. |
| 43 IPC_MESSAGE_CONTROL0(ChildProcessMsg_GetTraceBufferPercentFull) | 83 IPC_MESSAGE_CONTROL0(ChildProcessMsg_GetTraceBufferPercentFull) |
| 44 | 84 |
| 45 // Tell the child process to enable or disable the profiler status. | 85 // Tell the child process to enable or disable the profiler status. |
| 46 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetProfilerStatus, | 86 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetProfilerStatus, |
| 47 tracked_objects::ThreadData::Status /* profiler status */) | 87 tracked_objects::ThreadData::Status /* profiler status */) |
| 48 | 88 |
| 49 // Send to all the child processes to send back profiler data (ThreadData in | 89 // Send to all the child processes to send back profiler data (ThreadData in |
| 50 // tracked_objects). | 90 // tracked_objects). |
| 51 IPC_MESSAGE_CONTROL2(ChildProcessMsg_GetChildProfilerData, | 91 IPC_MESSAGE_CONTROL2(ChildProcessMsg_GetChildProfilerData, |
| 52 int, /* sequence number. */ | 92 int, /* sequence number */ |
|
jam
2012/03/18 19:31:54
there's no need to tell the child process what typ
Ilya Sherman
2012/03/19 22:01:24
Done.
| |
| 53 std::string /* pickled Value of process type. */) | 93 content::ProcessType /* child process type */) |
| 54 | 94 |
| 55 // Sent to child processes to dump their handle table. | 95 // Sent to child processes to dump their handle table. |
| 56 IPC_MESSAGE_CONTROL0(ChildProcessMsg_DumpHandles) | 96 IPC_MESSAGE_CONTROL0(ChildProcessMsg_DumpHandles) |
| 57 | 97 |
| 58 //////////////////////////////////////////////////////////////////////////////// | 98 //////////////////////////////////////////////////////////////////////////////// |
| 59 // Messages sent from the child process to the browser. | 99 // Messages sent from the child process to the browser. |
| 60 | 100 |
| 61 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ShutdownRequest) | 101 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ShutdownRequest) |
| 62 | 102 |
| 63 // Notify the browser that this child process supports tracing. | 103 // Notify the browser that this child process supports tracing. |
| 64 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ChildSupportsTracing) | 104 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ChildSupportsTracing) |
| 65 | 105 |
| 66 // Reply from child processes acking ChildProcessMsg_TraceChangeStatus(false). | 106 // Reply from child processes acking ChildProcessMsg_TraceChangeStatus(false). |
| 67 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_EndTracingAck, | 107 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_EndTracingAck, |
| 68 std::vector<std::string> /* known_categories */) | 108 std::vector<std::string> /* known_categories */) |
| 69 | 109 |
| 70 // Sent if the trace buffer becomes full. | 110 // Sent if the trace buffer becomes full. |
| 71 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_TraceBufferFull) | 111 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_TraceBufferFull) |
| 72 | 112 |
| 73 // Child processes send trace data back in JSON chunks. | 113 // Child processes send trace data back in JSON chunks. |
| 74 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_TraceDataCollected, | 114 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_TraceDataCollected, |
| 75 std::string /*json trace data*/) | 115 std::string /*json trace data*/) |
| 76 | 116 |
| 77 // Reply to ChildProcessMsg_GetTraceBufferPercentFull. | 117 // Reply to ChildProcessMsg_GetTraceBufferPercentFull. |
| 78 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_TraceBufferPercentFullReply, | 118 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_TraceBufferPercentFullReply, |
| 79 float /*trace buffer percent full*/) | 119 float /*trace buffer percent full*/) |
| 80 | 120 |
| 81 // Send back profiler data (ThreadData in tracked_objects). | 121 // Send back profiler data (ThreadData in tracked_objects). |
| 82 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_ChildProfilerData, | 122 IPC_MESSAGE_CONTROL3(ChildProcessHostMsg_ChildProfilerData, |
| 83 int, /* sequence number. */ | 123 int, /* sequence number */ |
| 84 DictionaryValue /* profiler data. */) | 124 tracked_objects::SerializedProcessData, /* profiler data */ |
| 125 content::ProcessType /* child process type */) | |
| 85 | 126 |
| 86 // Reply to ChildProcessMsg_DumpHandles when handle table dump is complete. | 127 // Reply to ChildProcessMsg_DumpHandles when handle table dump is complete. |
| 87 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_DumpHandlesDone) | 128 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_DumpHandlesDone) |
| 88 | 129 |
| 89 #if defined(OS_WIN) | 130 #if defined(OS_WIN) |
| 90 // Request that the given font be loaded by the host so it's cached by the | 131 // Request that the given font be loaded by the host so it's cached by the |
| 91 // OS. Please see ChildProcessHost::PreCacheFont for details. | 132 // OS. Please see ChildProcessHost::PreCacheFont for details. |
| 92 IPC_SYNC_MESSAGE_CONTROL1_0(ChildProcessHostMsg_PreCacheFont, | 133 IPC_SYNC_MESSAGE_CONTROL1_0(ChildProcessHostMsg_PreCacheFont, |
| 93 LOGFONT /* font data */) | 134 LOGFONT /* font data */) |
| 94 | 135 |
| 95 // Release the cached font | 136 // Release the cached font |
| 96 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ReleaseCachedFonts) | 137 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ReleaseCachedFonts) |
| 97 #endif // defined(OS_WIN) | 138 #endif // defined(OS_WIN) |
| 98 | 139 |
| 99 // Asks the browser to create a block of shared memory for the child process to | 140 // Asks the browser to create a block of shared memory for the child process to |
| 100 // fill in and pass back to the browser. | 141 // fill in and pass back to the browser. |
| 101 IPC_SYNC_MESSAGE_CONTROL1_1(ChildProcessHostMsg_SyncAllocateSharedMemory, | 142 IPC_SYNC_MESSAGE_CONTROL1_1(ChildProcessHostMsg_SyncAllocateSharedMemory, |
| 102 uint32 /* buffer size */, | 143 uint32 /* buffer size */, |
| 103 base::SharedMemoryHandle) | 144 base::SharedMemoryHandle) |
| OLD | NEW |