c8f2fa267b7faf2c52c83d9745e98c07ab2362f1
[platform/framework/web/crosswalk.git] / src / content / common / service_worker / embedded_worker_messages.h
1 // Copyright 2014 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 // Message definition file, included multiple times, hence no include guard.
6
7 #include <string>
8
9 #include "ipc/ipc_message.h"
10 #include "ipc/ipc_message_macros.h"
11 #include "ipc/ipc_param_traits.h"
12 #include "url/gurl.h"
13
14 #undef IPC_MESSAGE_EXPORT
15 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
16
17 #define IPC_MESSAGE_START EmbeddedWorkerMsgStart
18
19 // Parameters structure for EmbeddedWorkerMsg_StartWorker.
20 IPC_STRUCT_BEGIN(EmbeddedWorkerMsg_StartWorker_Params)
21   IPC_STRUCT_MEMBER(int, embedded_worker_id)
22   IPC_STRUCT_MEMBER(int64, service_worker_version_id)
23   IPC_STRUCT_MEMBER(GURL, scope)
24   IPC_STRUCT_MEMBER(GURL, script_url)
25   IPC_STRUCT_MEMBER(int, worker_devtools_agent_route_id)
26   IPC_STRUCT_MEMBER(bool, pause_after_download)
27   IPC_STRUCT_MEMBER(bool, wait_for_debugger)
28 IPC_STRUCT_END()
29
30 // Parameters structure for EmbeddedWorkerHostMsg_ReportConsoleMessage.
31 // The data members directly correspond to parameters of
32 // WorkerMessagingProxy::reportConsoleMessage()
33 IPC_STRUCT_BEGIN(EmbeddedWorkerHostMsg_ReportConsoleMessage_Params)
34   IPC_STRUCT_MEMBER(int, source_identifier)
35   IPC_STRUCT_MEMBER(int, message_level)
36   IPC_STRUCT_MEMBER(base::string16, message)
37   IPC_STRUCT_MEMBER(int, line_number)
38   IPC_STRUCT_MEMBER(GURL, source_url)
39 IPC_STRUCT_END()
40
41 // Browser -> Renderer message to create a new embedded worker context.
42 IPC_MESSAGE_CONTROL1(EmbeddedWorkerMsg_StartWorker,
43                      EmbeddedWorkerMsg_StartWorker_Params /* params */)
44
45 // Browser -> Renderer message to resume a worker that has been started
46 // with the pause_after_download option.
47 IPC_MESSAGE_CONTROL1(EmbeddedWorkerMsg_ResumeAfterDownload,
48                      int /* embedded_worker_id */)
49
50 // Browser -> Renderer message to stop (terminate) the embedded worker.
51 IPC_MESSAGE_CONTROL1(EmbeddedWorkerMsg_StopWorker,
52                      int /* embedded_worker_id */)
53
54 // Renderer -> Browser message to indicate that the worker script has been
55 // downloaded and the embedded worker is in paused state.
56 IPC_MESSAGE_CONTROL1(EmbeddedWorkerHostMsg_DidPauseAfterDownload,
57                      int /* embedded_worker_id */)
58
59 // Renderer -> Browser message to indicate that the worker has loadedd the
60 // script.
61 IPC_MESSAGE_CONTROL1(EmbeddedWorkerHostMsg_WorkerScriptLoaded,
62                      int /* embedded_worker_id */)
63
64 // Renderer -> Browser message to indicate that the worker has failed to load
65 // the script.
66 IPC_MESSAGE_CONTROL1(EmbeddedWorkerHostMsg_WorkerScriptLoadFailed,
67                      int /* embedded_worker_id */)
68
69 // Renderer -> Browser message to indicate that the worker is started.
70 IPC_MESSAGE_CONTROL2(EmbeddedWorkerHostMsg_WorkerStarted,
71                      int /* thread_id */,
72                      int /* embedded_worker_id */)
73
74 // Renderer -> Browser message to indicate that the worker is stopped.
75 IPC_MESSAGE_CONTROL1(EmbeddedWorkerHostMsg_WorkerStopped,
76                      int /* embedded_worker_id */)
77
78 // Renderer -> Browser message to report an exception.
79 IPC_MESSAGE_CONTROL5(EmbeddedWorkerHostMsg_ReportException,
80                      int /* embedded_worker_id */,
81                      base::string16 /* error_message */,
82                      int /* line_number */,
83                      int /* column_number */,
84                      GURL /* source_url */)
85
86 // Renderer -> Browser message to report console message.
87 IPC_MESSAGE_CONTROL2(
88     EmbeddedWorkerHostMsg_ReportConsoleMessage,
89     int /* embedded_worker_id */,
90     EmbeddedWorkerHostMsg_ReportConsoleMessage_Params /* params */)
91
92 // ---------------------------------------------------------------------------
93 // For EmbeddedWorkerContext related messages, which are directly sent from
94 // browser to the worker thread in the child process. We use a new message class
95 // for this for easier cross-thread message dispatching.
96
97 #undef IPC_MESSAGE_START
98 #define IPC_MESSAGE_START EmbeddedWorkerContextMsgStart
99
100 // Browser -> Renderer message to send message.
101 IPC_MESSAGE_CONTROL3(EmbeddedWorkerContextMsg_MessageToWorker,
102                      int /* thread_id */,
103                      int /* embedded_worker_id */,
104                      IPC::Message /* message */)