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(bool, pause_on_start
)
46 IPC_STRUCT_MEMBER(int, route_id
)
49 //-----------------------------------------------------------------------------
50 // WorkerProcess messages
51 // These are messages sent from the browser to the worker process.
52 IPC_MESSAGE_CONTROL1(WorkerProcessMsg_CreateWorker
,
53 WorkerProcessMsg_CreateWorker_Params
)
55 //-----------------------------------------------------------------------------
56 // WorkerProcessHost messages
57 // These are messages sent from the worker process to the browser process.
59 // Sent by the worker process to check whether access to web databases is
61 IPC_SYNC_MESSAGE_CONTROL5_1(WorkerProcessHostMsg_AllowDatabase
,
62 int /* worker_route_id */,
63 GURL
/* origin url */,
64 base::string16
/* database name */,
65 base::string16
/* database display name */,
66 unsigned long /* estimated size */,
69 // Sent by the worker process to check whether access to file system is allowed.
70 IPC_SYNC_MESSAGE_CONTROL2_1(WorkerProcessHostMsg_RequestFileSystemAccessSync
,
71 int /* worker_route_id */,
72 GURL
/* origin url */,
75 // Sent by the worker process to check whether access to IndexedDB is allowed.
76 IPC_SYNC_MESSAGE_CONTROL3_1(WorkerProcessHostMsg_AllowIndexedDB
,
77 int /* worker_route_id */,
78 GURL
/* origin url */,
79 base::string16
/* database name */,
82 // Sent by the worker process to request being killed.
83 IPC_SYNC_MESSAGE_CONTROL0_0(WorkerProcessHostMsg_ForceKillWorker
)
86 //-----------------------------------------------------------------------------
88 // These are messages sent from the renderer process to the worker process.
89 IPC_MESSAGE_ROUTED0(WorkerMsg_TerminateWorkerContext
)
91 IPC_MESSAGE_ROUTED2(WorkerMsg_Connect
,
92 int /* sent_message_port_id */,
95 IPC_MESSAGE_ROUTED0(WorkerMsg_WorkerObjectDestroyed
)
98 //-----------------------------------------------------------------------------
99 // WorkerHost messages
100 // These are messages sent from the worker (renderer process) to the worker
101 // host (browser process).
102 IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerContextClosed
,
103 int /* worker_route_id */)
105 IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerContextDestroyed
,
106 int /* worker_route_id */)
108 // Renderer -> Browser message to indicate that the worker is ready for
110 IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerReadyForInspection
,
111 int /* worker_route_id */)
113 IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerScriptLoaded
,
114 int /* worker_route_id */)
116 IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerScriptLoadFailed
,
117 int /* worker_route_id */)
119 IPC_MESSAGE_CONTROL2(WorkerHostMsg_WorkerConnected
,
120 int /* message_port_id */,
121 int /* worker_route_id */)