Home | History | Annotate | Download | only in service_worker
      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_on_start)
     27 IPC_STRUCT_END()
     28 
     29 // Parameters structure for EmbeddedWorkerHostMsg_ReportConsoleMessage.
     30 // The data members directly correspond to parameters of
     31 // WorkerMessagingProxy::reportConsoleMessage()
     32 IPC_STRUCT_BEGIN(EmbeddedWorkerHostMsg_ReportConsoleMessage_Params)
     33   IPC_STRUCT_MEMBER(int, source_identifier)
     34   IPC_STRUCT_MEMBER(int, message_level)
     35   IPC_STRUCT_MEMBER(base::string16, message)
     36   IPC_STRUCT_MEMBER(int, line_number)
     37   IPC_STRUCT_MEMBER(GURL, source_url)
     38 IPC_STRUCT_END()
     39 
     40 // Browser -> Renderer message to create a new embedded worker context.
     41 IPC_MESSAGE_CONTROL1(EmbeddedWorkerMsg_StartWorker,
     42                      EmbeddedWorkerMsg_StartWorker_Params /* params */)
     43 
     44 // Browser -> Renderer message to stop (terminate) the embedded worker.
     45 IPC_MESSAGE_CONTROL1(EmbeddedWorkerMsg_StopWorker,
     46                      int /* embedded_worker_id */)
     47 
     48 // Renderer -> Browser message to indicate that the worker has loadedd the
     49 // script.
     50 IPC_MESSAGE_CONTROL1(EmbeddedWorkerHostMsg_WorkerScriptLoaded,
     51                      int /* embedded_worker_id */)
     52 
     53 // Renderer -> Browser message to indicate that the worker has failed to load
     54 // the script.
     55 IPC_MESSAGE_CONTROL1(EmbeddedWorkerHostMsg_WorkerScriptLoadFailed,
     56                      int /* embedded_worker_id */)
     57 
     58 // Renderer -> Browser message to indicate that the worker is started.
     59 IPC_MESSAGE_CONTROL2(EmbeddedWorkerHostMsg_WorkerStarted,
     60                      int /* thread_id */,
     61                      int /* embedded_worker_id */)
     62 
     63 // Renderer -> Browser message to indicate that the worker is stopped.
     64 IPC_MESSAGE_CONTROL1(EmbeddedWorkerHostMsg_WorkerStopped,
     65                      int /* embedded_worker_id */)
     66 
     67 // Renderer -> Browser message to report an exception.
     68 IPC_MESSAGE_CONTROL5(EmbeddedWorkerHostMsg_ReportException,
     69                      int /* embedded_worker_id */,
     70                      base::string16 /* error_message */,
     71                      int /* line_number */,
     72                      int /* column_number */,
     73                      GURL /* source_url */)
     74 
     75 // Renderer -> Browser message to report console message.
     76 IPC_MESSAGE_CONTROL2(
     77     EmbeddedWorkerHostMsg_ReportConsoleMessage,
     78     int /* embedded_worker_id */,
     79     EmbeddedWorkerHostMsg_ReportConsoleMessage_Params /* params */)
     80 
     81 // ---------------------------------------------------------------------------
     82 // For EmbeddedWorkerContext related messages, which are directly sent from
     83 // browser to the worker thread in the child process. We use a new message class
     84 // for this for easier cross-thread message dispatching.
     85 
     86 #undef IPC_MESSAGE_START
     87 #define IPC_MESSAGE_START EmbeddedWorkerContextMsgStart
     88 
     89 // Browser -> Renderer message to send message.
     90 IPC_MESSAGE_CONTROL3(EmbeddedWorkerContextMsg_MessageToWorker,
     91                      int /* thread_id */,
     92                      int /* embedded_worker_id */,
     93                      IPC::Message /* message */)
     94