15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Defines messages between the browser and worker process, as well as between 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// the renderer and worker process. 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Multiply-included message file, hence no include guard. 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string> 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <utility> 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <vector> 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h" 157d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "base/strings/string16.h" 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/common/content_export.h" 175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "content/common/content_param_traits.h" 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ipc/ipc_message_macros.h" 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ipc/ipc_message_utils.h" 207dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "url/gurl.h" 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#undef IPC_MESSAGE_EXPORT 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define IPC_MESSAGE_EXPORT CONTENT_EXPORT 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define IPC_MESSAGE_START WorkerMsgStart 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Parameters structure for WorkerHostMsg_PostConsoleMessageToWorkerObject, 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// which has too many data parameters to be reasonably put in a predefined 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// IPC message. The data members directly correspond to parameters of 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// WebWorkerClient::postConsoleMessageToWorkerObject() 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_STRUCT_BEGIN(WorkerHostMsg_PostConsoleMessageToWorkerObject_Params) 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) IPC_STRUCT_MEMBER(int, source_identifier) 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) IPC_STRUCT_MEMBER(int, message_type) 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) IPC_STRUCT_MEMBER(int, message_level) 34a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) IPC_STRUCT_MEMBER(base::string16, message) 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) IPC_STRUCT_MEMBER(int, line_number) 36a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) IPC_STRUCT_MEMBER(base::string16, source_url) 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_STRUCT_END() 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Parameter structure for WorkerProcessMsg_CreateWorker. 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_STRUCT_BEGIN(WorkerProcessMsg_CreateWorker_Params) 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) IPC_STRUCT_MEMBER(GURL, url) 42a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) IPC_STRUCT_MEMBER(base::string16, name) 435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) IPC_STRUCT_MEMBER(base::string16, content_security_policy) 445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) IPC_STRUCT_MEMBER(blink::WebContentSecurityPolicyType, security_policy_type) 45effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch IPC_STRUCT_MEMBER(bool, pause_on_start) 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) IPC_STRUCT_MEMBER(int, route_id) 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_STRUCT_END() 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//----------------------------------------------------------------------------- 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// WorkerProcess messages 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// These are messages sent from the browser to the worker process. 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_MESSAGE_CONTROL1(WorkerProcessMsg_CreateWorker, 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) WorkerProcessMsg_CreateWorker_Params) 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//----------------------------------------------------------------------------- 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// WorkerProcessHost messages 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// These are messages sent from the worker process to the browser process. 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Sent by the worker process to check whether access to web databases is 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// allowed. 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_SYNC_MESSAGE_CONTROL5_1(WorkerProcessHostMsg_AllowDatabase, 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int /* worker_route_id */, 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GURL /* origin url */, 64a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 /* database name */, 65a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 /* database display name */, 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) unsigned long /* estimated size */, 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool /* result */) 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Sent by the worker process to check whether access to file system is allowed. 70cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)IPC_SYNC_MESSAGE_CONTROL2_1(WorkerProcessHostMsg_RequestFileSystemAccessSync, 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int /* worker_route_id */, 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GURL /* origin url */, 735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool /* result */) 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Sent by the worker process to check whether access to IndexedDB is allowed. 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_SYNC_MESSAGE_CONTROL3_1(WorkerProcessHostMsg_AllowIndexedDB, 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int /* worker_route_id */, 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GURL /* origin url */, 79a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 /* database name */, 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool /* result */) 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 82f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Sent by the worker process to request being killed. 83f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)IPC_SYNC_MESSAGE_CONTROL0_0(WorkerProcessHostMsg_ForceKillWorker) 84f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 85f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//----------------------------------------------------------------------------- 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Worker messages 885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// These are messages sent from the renderer process to the worker process. 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_MESSAGE_ROUTED0(WorkerMsg_TerminateWorkerContext) 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_MESSAGE_ROUTED2(WorkerMsg_Connect, 925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int /* sent_message_port_id */, 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int /* routing_id */) 945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_MESSAGE_ROUTED0(WorkerMsg_WorkerObjectDestroyed) 965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//----------------------------------------------------------------------------- 995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// WorkerHost messages 10003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// These are messages sent from the worker (renderer process) to the worker 10103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// host (browser process). 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerContextClosed, 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int /* worker_route_id */) 1045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1055d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerContextDestroyed, 1065d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int /* worker_route_id */) 1075d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 10803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// Renderer -> Browser message to indicate that the worker is ready for 10903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// inspection. 11003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerReadyForInspection, 11103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) int /* worker_route_id */) 11203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 1135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerScriptLoaded, 1145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int /* worker_route_id */) 1155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerScriptLoadFailed, 1175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int /* worker_route_id */) 1185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)IPC_MESSAGE_CONTROL2(WorkerHostMsg_WorkerConnected, 1205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int /* message_port_id */, 1215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int /* worker_route_id */) 122