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