Commit 44042881 authored by kinuko@chromium.org's avatar kinuko@chromium.org

Separate EmbeddedWorker messages into another file to use different msg class

So that we can rely on IPC_MESSAGE_CLASS(msg) check to
determine which messages we want to relay onto another thread.

Mostly just shuffling,
- Separated EmbeddedWorker messages out of service_worker_messages.h into embedded_worker_messages.h
- Added a new message class for that
- Created a new directory content/common/service_worker (and OWNERS file) as now we have multiple header files for SW under common/

BUG=313530

Review URL: https://codereview.chromium.org/127583002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243871 0039d316-1c4b-4281-b951-d872f2087c98
parent d550b90d
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "content/browser/service_worker/embedded_worker_instance.h" #include "content/browser/service_worker/embedded_worker_instance.h"
#include "content/browser/service_worker/embedded_worker_registry.h" #include "content/browser/service_worker/embedded_worker_registry.h"
#include "content/common/service_worker_messages.h" #include "content/common/service_worker/embedded_worker_messages.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace content { namespace content {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "content/browser/service_worker/embedded_worker_instance.h" #include "content/browser/service_worker/embedded_worker_instance.h"
#include "content/browser/service_worker/embedded_worker_registry.h" #include "content/browser/service_worker/embedded_worker_registry.h"
#include "content/browser/service_worker/service_worker_context_core.h" #include "content/browser/service_worker/service_worker_context_core.h"
#include "content/common/service_worker_messages.h" #include "content/common/service_worker/embedded_worker_messages.h"
#include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_browser_thread_bundle.h"
#include "ipc/ipc_message.h" #include "ipc/ipc_message.h"
#include "ipc/ipc_sender.h" #include "ipc/ipc_sender.h"
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "base/stl_util.h" #include "base/stl_util.h"
#include "content/browser/service_worker/embedded_worker_instance.h" #include "content/browser/service_worker/embedded_worker_instance.h"
#include "content/browser/service_worker/service_worker_context_core.h" #include "content/browser/service_worker/service_worker_context_core.h"
#include "content/common/service_worker_messages.h" #include "content/common/service_worker/embedded_worker_messages.h"
#include "ipc/ipc_message.h" #include "ipc/ipc_message.h"
#include "ipc/ipc_sender.h" #include "ipc/ipc_sender.h"
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
#include "content/browser/service_worker/service_worker_context_core.h" #include "content/browser/service_worker/service_worker_context_core.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/service_worker/service_worker_provider_host.h" #include "content/browser/service_worker/service_worker_provider_host.h"
#include "content/common/service_worker_messages.h" #include "content/common/service_worker/embedded_worker_messages.h"
#include "content/common/service_worker/service_worker_messages.h"
#include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_macros.h"
#include "third_party/WebKit/public/platform/WebServiceWorkerError.h" #include "third_party/WebKit/public/platform/WebServiceWorkerError.h"
#include "url/gurl.h" #include "url/gurl.h"
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "content/browser/browser_thread_impl.h" #include "content/browser/browser_thread_impl.h"
#include "content/browser/service_worker/service_worker_context_core.h" #include "content/browser/service_worker/service_worker_context_core.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/common/service_worker_messages.h" #include "content/common/service_worker/service_worker_messages.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "base/threading/thread_local.h" #include "base/threading/thread_local.h"
#include "content/child/service_worker/web_service_worker_impl.h" #include "content/child/service_worker/web_service_worker_impl.h"
#include "content/child/thread_safe_sender.h" #include "content/child/thread_safe_sender.h"
#include "content/common/service_worker_messages.h" #include "content/common/service_worker/service_worker_messages.h"
#include "third_party/WebKit/public/web/WebSecurityOrigin.h" #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
using blink::WebServiceWorkerError; using blink::WebServiceWorkerError;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "content/child/child_thread.h" #include "content/child/child_thread.h"
#include "content/child/service_worker/service_worker_dispatcher.h" #include "content/child/service_worker/service_worker_dispatcher.h"
#include "content/child/thread_safe_sender.h" #include "content/child/thread_safe_sender.h"
#include "content/common/service_worker_messages.h" #include "content/common/service_worker/service_worker_messages.h"
#include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/platform/WebURL.h"
using blink::WebURL; using blink::WebURL;
......
...@@ -48,7 +48,8 @@ ...@@ -48,7 +48,8 @@
#include "content/common/power_monitor_messages.h" #include "content/common/power_monitor_messages.h"
#include "content/common/quota_messages.h" #include "content/common/quota_messages.h"
#include "content/common/resource_messages.h" #include "content/common/resource_messages.h"
#include "content/common/service_worker_messages.h" #include "content/common/service_worker/embedded_worker_messages.h"
#include "content/common/service_worker/service_worker_messages.h"
#include "content/common/socket_stream_messages.h" #include "content/common/socket_stream_messages.h"
#include "content/common/speech_recognition_messages.h" #include "content/common/speech_recognition_messages.h"
#include "content/common/text_input_client_messages.h" #include "content/common/text_input_client_messages.h"
......
alecflett@chromium.org
kinuko@chromium.org
michaeln@chromium.org
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Message definition file, included multiple times, hence no include guard.
#include <string>
#include "content/common/service_worker/service_worker_types.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_param_traits.h"
#include "url/gurl.h"
#undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerFetchRequest)
IPC_STRUCT_TRAITS_MEMBER(url)
IPC_STRUCT_TRAITS_MEMBER(method)
IPC_STRUCT_TRAITS_MEMBER(headers)
IPC_STRUCT_TRAITS_END()
#define IPC_MESSAGE_START EmbeddedWorkerMsgStart
// Browser -> Renderer message to create a new embedded worker context.
IPC_MESSAGE_CONTROL3(EmbeddedWorkerMsg_StartWorker,
int /* embedded_worker_id */,
int64 /* service_worker_version_id */,
GURL /* script_url */)
// Browser -> Renderer message to stop (terminate) the embedded worker.
IPC_MESSAGE_CONTROL1(EmbeddedWorkerMsg_StopWorker,
int /* embedded_worker_id */)
// Renderer -> Browser message to indicate that the worker is started.
IPC_MESSAGE_CONTROL2(EmbeddedWorkerHostMsg_WorkerStarted,
int /* thread_id */,
int /* embedded_worker_id */)
// Renderer -> Browser message to indicate that the worker is stopped.
IPC_MESSAGE_CONTROL1(EmbeddedWorkerHostMsg_WorkerStopped,
int /* embedded_worker_id */)
// ---------------------------------------------------------------------------
// For EmbeddedWorkerContext related messages, which are directly sent from
// browser to the worker thread in the child process. We use a new message class
// for this for easier cross-thread message dispatching.
#undef IPC_MESSAGE_START
#define IPC_MESSAGE_START EmbeddedWorkerContextMsgStart
IPC_MESSAGE_CONTROL3(EmbeddedWorkerContextMsg_FetchEvent,
int /* thread_id */,
int /* embedded_worker_id */,
content::ServiceWorkerFetchRequest)
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Message definition file, included multiple times, hence no include guard. // Message definition file, included multiple times, hence no include guard.
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "content/common/service_worker_types.h"
#include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_macros.h"
#include "ipc/ipc_param_traits.h" #include "ipc/ipc_param_traits.h"
#include "third_party/WebKit/public/platform/WebServiceWorkerError.h" #include "third_party/WebKit/public/platform/WebServiceWorkerError.h"
#include "url/gurl.h" #include "url/gurl.h"
IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerFetchRequest)
IPC_STRUCT_TRAITS_MEMBER(url)
IPC_STRUCT_TRAITS_MEMBER(method)
IPC_STRUCT_TRAITS_MEMBER(headers)
IPC_STRUCT_TRAITS_END()
#undef IPC_MESSAGE_EXPORT #undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT CONTENT_EXPORT #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
...@@ -66,37 +59,3 @@ IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_ProviderCreated, ...@@ -66,37 +59,3 @@ IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_ProviderCreated,
// Informs the browser of a ServiceWorkerProvider being destroyed. // Informs the browser of a ServiceWorkerProvider being destroyed.
IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_ProviderDestroyed, IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_ProviderDestroyed,
int /* provider_id */) int /* provider_id */)
// For EmbeddedWorker related messages -------------------------------------
// Browser -> Renderer message to create a new embedded worker context.
IPC_MESSAGE_CONTROL3(EmbeddedWorkerMsg_StartWorker,
int /* embedded_worker_id */,
int64 /* service_worker_version_id */,
GURL /* script_url */)
// Browser -> Renderer message to stop (terminate) the embedded worker.
IPC_MESSAGE_CONTROL1(EmbeddedWorkerMsg_StopWorker,
int /* embedded_worker_id */)
// Renderer -> Browser message to indicate that the worker is started.
IPC_MESSAGE_CONTROL2(EmbeddedWorkerHostMsg_WorkerStarted,
int /* thread_id */,
int /* embedded_worker_id */)
// Renderer -> Browser message to indicate that the worker is stopped.
IPC_MESSAGE_CONTROL1(EmbeddedWorkerHostMsg_WorkerStopped,
int /* embedded_worker_id */)
// ---------------------------------------------------------------------------
// For EmbeddedWorkerContext related messages, which are directly sent from
// browser to the worker thread in the child process. We use a new message class
// for this for easier cross-thread message dispatching.
#undef IPC_MESSAGE_START
#define IPC_MESSAGE_START EmbeddedWorkerContextMsgStart
IPC_MESSAGE_CONTROL3(EmbeddedWorkerContextMsg_FetchEvent,
int /* thread_id */,
int /* embedded_worker_id */,
content::ServiceWorkerFetchRequest)
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/common/service_worker_types.h" #include "content/common/service_worker/service_worker_types.h"
namespace content { namespace content {
......
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_COMMON_SERVICE_WORKER_TYPES_H_ #ifndef CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_H_
#define CONTENT_COMMON_SERVICE_WORKER_TYPES_H_ #define CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_H_
#include <map> #include <map>
#include <string> #include <string>
...@@ -35,4 +35,4 @@ struct CONTENT_EXPORT ServiceWorkerFetchRequest { ...@@ -35,4 +35,4 @@ struct CONTENT_EXPORT ServiceWorkerFetchRequest {
} // namespace content } // namespace content
#endif // CONTENT_COMMON_SERVICE_WORKER_TYPES_H_ #endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_H_
...@@ -373,9 +373,10 @@ ...@@ -373,9 +373,10 @@
'common/sandbox_win.h', 'common/sandbox_win.h',
'common/savable_url_schemes.cc', 'common/savable_url_schemes.cc',
'common/savable_url_schemes.h', 'common/savable_url_schemes.h',
'common/service_worker_messages.h', 'common/service_worker/embedded_worker_messages.h',
'common/service_worker_types.cc', 'common/service_worker/service_worker_messages.h',
'common/service_worker_types.h', 'common/service_worker/service_worker_types.cc',
'common/service_worker/service_worker_types.h',
'common/set_process_title.cc', 'common/set_process_title.cc',
'common/set_process_title.h', 'common/set_process_title.h',
'common/set_process_title_linux.cc', 'common/set_process_title_linux.cc',
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "base/pickle.h" #include "base/pickle.h"
#include "base/threading/thread_local.h" #include "base/threading/thread_local.h"
#include "content/child/thread_safe_sender.h" #include "content/child/thread_safe_sender.h"
#include "content/common/service_worker_messages.h" #include "content/common/service_worker/embedded_worker_messages.h"
#include "content/renderer/render_thread_impl.h" #include "content/renderer/render_thread_impl.h"
#include "content/renderer/service_worker/embedded_worker_dispatcher.h" #include "content/renderer/service_worker/embedded_worker_dispatcher.h"
#include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_macros.h"
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "content/child/child_process.h" #include "content/child/child_process.h"
#include "content/child/scoped_child_process_reference.h" #include "content/child/scoped_child_process_reference.h"
#include "content/child/thread_safe_sender.h" #include "content/child/thread_safe_sender.h"
#include "content/common/service_worker_messages.h" #include "content/common/service_worker/embedded_worker_messages.h"
#include "content/renderer/render_thread_impl.h" #include "content/renderer/render_thread_impl.h"
#include "content/renderer/service_worker/embedded_worker_context_client.h" #include "content/renderer/service_worker/embedded_worker_context_client.h"
#include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebString.h"
......
...@@ -92,6 +92,7 @@ enum IPCMessageStart { ...@@ -92,6 +92,7 @@ enum IPCMessageStart {
EncryptedMediaMsgStart, EncryptedMediaMsgStart,
ServiceWorkerMsgStart, ServiceWorkerMsgStart,
MessagePortMsgStart, MessagePortMsgStart,
EmbeddedWorkerMsgStart,
EmbeddedWorkerContextMsgStart, EmbeddedWorkerContextMsgStart,
LastIPCMsgStart // Must come last. LastIPCMsgStart // Must come last.
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment