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.
5 // Defines messages between the browser and worker process, as well as between
6 // the renderer and worker process.
8 // Multiply-included message file, hence no include guard.
14 #include "base/basictypes.h"
15 #include "base/strings/string16.h"
16 #include "content/common/content_export.h"
17 #include "content/common/content_param_traits.h"
18 #include "ipc/ipc_message_macros.h"
19 #include "ipc/ipc_message_utils.h"
22 #undef IPC_MESSAGE_EXPORT
23 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
24 #define IPC_MESSAGE_START WorkerMsgStart
26 // Parameters structure for WorkerHostMsg_PostConsoleMessageToWorkerObject,
27 // which has too many data parameters to be reasonably put in a predefined
28 // IPC message. The data members directly correspond to parameters of
29 // WebWorkerClient::postConsoleMessageToWorkerObject()
30 IPC_STRUCT_BEGIN(WorkerHostMsg_PostConsoleMessageToWorkerObject_Params)
31 IPC_STRUCT_MEMBER(int, source_identifier)
32 IPC_STRUCT_MEMBER(int, message_type)
33 IPC_STRUCT_MEMBER(int, message_level)
34 IPC_STRUCT_MEMBER(base::string16, message)
35 IPC_STRUCT_MEMBER(int, line_number)
36 IPC_STRUCT_MEMBER(base::string16, source_url)
39 // Parameter structure for WorkerProcessMsg_CreateWorker.
40 IPC_STRUCT_BEGIN(WorkerProcessMsg_CreateWorker_Params)
41 IPC_STRUCT_MEMBER(GURL, url)
42 IPC_STRUCT_MEMBER(base::string16, name)
43 IPC_STRUCT_MEMBER(base::string16, content_security_policy)
44 IPC_STRUCT_MEMBER(blink::WebContentSecurityPolicyType, security_policy_type)
45 IPC_STRUCT_MEMBER(int, route_id)
48 //-----------------------------------------------------------------------------
49 // WorkerProcess messages
50 // These are messages sent from the browser to the worker process.
51 IPC_MESSAGE_CONTROL1(WorkerProcessMsg_CreateWorker,
52 WorkerProcessMsg_CreateWorker_Params)
54 //-----------------------------------------------------------------------------
55 // WorkerProcessHost messages
56 // These are messages sent from the worker process to the browser process.
58 // Sent by the worker process to check whether access to web databases is
60 IPC_SYNC_MESSAGE_CONTROL5_1(WorkerProcessHostMsg_AllowDatabase,
61 int /* worker_route_id */,
62 GURL /* origin url */,
63 base::string16 /* database name */,
64 base::string16 /* database display name */,
65 unsigned long /* estimated size */,
68 // Sent by the worker process to check whether access to file system is allowed.
69 IPC_SYNC_MESSAGE_CONTROL2_1(WorkerProcessHostMsg_AllowFileSystem,
70 int /* worker_route_id */,
71 GURL /* origin url */,
74 // Sent by the worker process to check whether access to IndexedDB is allowed.
75 IPC_SYNC_MESSAGE_CONTROL3_1(WorkerProcessHostMsg_AllowIndexedDB,
76 int /* worker_route_id */,
77 GURL /* origin url */,
78 base::string16 /* database name */,
81 // Sent by the worker process to request being killed.
82 IPC_SYNC_MESSAGE_CONTROL0_0(WorkerProcessHostMsg_ForceKillWorker)
85 //-----------------------------------------------------------------------------
87 // These are messages sent from the renderer process to the worker process.
88 IPC_MESSAGE_ROUTED0(WorkerMsg_TerminateWorkerContext)
90 IPC_MESSAGE_ROUTED2(WorkerMsg_Connect,
91 int /* sent_message_port_id */,
94 IPC_MESSAGE_ROUTED0(WorkerMsg_WorkerObjectDestroyed)
97 //-----------------------------------------------------------------------------
98 // WorkerHost messages
99 // These are messages sent from the worker process to the renderer process.
100 // WorkerMsg_PostMessage is also sent here.
101 IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerContextClosed,
102 int /* worker_route_id */)
104 IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerContextDestroyed,
105 int /* worker_route_id */)
107 IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerScriptLoaded,
108 int /* worker_route_id */)
110 IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerScriptLoadFailed,
111 int /* worker_route_id */)
113 IPC_MESSAGE_CONTROL2(WorkerHostMsg_WorkerConnected,
114 int /* message_port_id */,
115 int /* worker_route_id */)