summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 18:12:34 +0000
committertsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 18:12:34 +0000
commit026d452a03f70b8b8ba512d8760fa65a150b0202 (patch)
treee09d437e1c276f8a18f02c0fd0fb3d838b1e84ef
parent0c9bf87fe0b87849105fc7a2ea16280e48ee9089 (diff)
downloadchromium_src-026d452a03f70b8b8ba512d8760fa65a150b0202.zip
chromium_src-026d452a03f70b8b8ba512d8760fa65a150b0202.tar.gz
chromium_src-026d452a03f70b8b8ba512d8760fa65a150b0202.tar.bz2
Convert worker, speech_input, and utility messages to use the new macros, eliminating the need for hand coded traits.
Review URL: http://codereview.chromium.org/6610026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76931 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/chrome_common.gypi5
-rw-r--r--chrome/common/common_message_generator.h6
-rw-r--r--chrome/common/speech_input_messages.cc83
-rw-r--r--chrome/common/speech_input_messages.h62
-rw-r--r--chrome/common/utility_messages.cc12
-rw-r--r--chrome/common/utility_messages.h232
-rw-r--r--chrome/common/utility_messages_internal.h159
-rw-r--r--chrome/common/worker_messages.cc117
-rw-r--r--chrome/common/worker_messages.h197
-rw-r--r--chrome/common/worker_messages_internal.h129
10 files changed, 341 insertions, 661 deletions
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index 3fad755..a87b053 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -165,7 +165,6 @@
'common/set_process_title.h',
'common/set_process_title_linux.cc',
'common/set_process_title_linux.h',
- 'common/speech_input_messages.cc',
'common/speech_input_messages.h',
'common/switch_utils.cc',
'common/switch_utils.h',
@@ -374,9 +373,7 @@
'common/thumbnail_score.h',
'common/url_constants.cc',
'common/url_constants.h',
- 'common/utility_messages.cc',
'common/utility_messages.h',
- 'common/utility_messages_internal.h',
'common/view_types.cc',
'common/view_types.h',
'common/visitedlink_common.cc',
@@ -393,9 +390,7 @@
'common/webmessageportchannel_impl.h',
'common/window_container_type.cc',
'common/window_container_type.h',
- 'common/worker_messages.cc',
'common/worker_messages.h',
- 'common/worker_messages_internal.h',
'common/worker_thread_ticker.cc',
'common/worker_thread_ticker.h',
'common/zip.cc', # Requires zlib directly.
diff --git a/chrome/common/common_message_generator.h b/chrome/common/common_message_generator.h
index 946baee..a59e82e 100644
--- a/chrome/common/common_message_generator.h
+++ b/chrome/common/common_message_generator.h
@@ -9,6 +9,9 @@
#include "chrome/common/indexed_db_messages.h"
#include "chrome/common/mime_registry_messages.h"
#include "chrome/common/safebrowsing_messages.h"
+#include "chrome/common/speech_input_messages.h"
+#include "chrome/common/utility_messages.h"
+#include "chrome/common/worker_messages.h"
#if 0 // This feature is not yet enabled for these files.
@@ -23,8 +26,5 @@
#include "chrome/common/plugin_messages.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/service_messages.h"
-#include "chrome/common/speech_input_messages.h"
-#include "chrome/common/utility_messages.h"
-#include "chrome/common/worker_messages.h"
#endif
diff --git a/chrome/common/speech_input_messages.cc b/chrome/common/speech_input_messages.cc
deleted file mode 100644
index c93062f..0000000
--- a/chrome/common/speech_input_messages.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "chrome/common/common_param_traits.h"
-
-#define IPC_MESSAGE_IMPL
-#include "chrome/common/speech_input_messages.h"
-
-SpeechInputHostMsg_StartRecognition_Params::
-SpeechInputHostMsg_StartRecognition_Params()
- : render_view_id(0),
- request_id(0) {
-}
-
-SpeechInputHostMsg_StartRecognition_Params::
-~SpeechInputHostMsg_StartRecognition_Params() {
-}
-
-namespace IPC {
-
-void ParamTraits<speech_input::SpeechInputResultItem>::Write(
- Message* m, const param_type& p) {
- WriteParam(m, p.utterance);
- WriteParam(m, p.confidence);
-}
-
-bool ParamTraits<speech_input::SpeechInputResultItem>::Read(const Message* m,
- void** iter,
- param_type* p) {
- return ReadParam(m, iter, &p->utterance) &&
- ReadParam(m, iter, &p->confidence);
-}
-
-void ParamTraits<speech_input::SpeechInputResultItem>::Log(const param_type& p,
- std::string* l) {
- l->append("(");
- LogParam(p.utterance, l);
- l->append(":");
- LogParam(p.confidence, l);
- l->append(")");
-}
-
-void ParamTraits<SpeechInputHostMsg_StartRecognition_Params>::Write(
- Message* m,
- const param_type& p) {
- WriteParam(m, p.render_view_id);
- WriteParam(m, p.request_id);
- WriteParam(m, p.element_rect);
- WriteParam(m, p.language);
- WriteParam(m, p.grammar);
- WriteParam(m, p.origin_url);
-}
-
-bool ParamTraits<SpeechInputHostMsg_StartRecognition_Params>::Read(
- const Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->render_view_id) &&
- ReadParam(m, iter, &p->request_id) &&
- ReadParam(m, iter, &p->element_rect) &&
- ReadParam(m, iter, &p->language) &&
- ReadParam(m, iter, &p->grammar) &&
- ReadParam(m, iter, &p->origin_url);
-}
-
-void ParamTraits<SpeechInputHostMsg_StartRecognition_Params>::Log(
- const param_type& p, std::string* l) {
- l->append("(");
- LogParam(p.render_view_id, l);
- l->append(", ");
- LogParam(p.request_id, l);
- l->append(", ");
- LogParam(p.element_rect, l);
- l->append(", ");
- LogParam(p.language, l);
- l->append(", ");
- LogParam(p.grammar, l);
- l->append(", ");
- LogParam(p.origin_url, l);
- l->append(")");
-}
-
-} // namespace IPC
diff --git a/chrome/common/speech_input_messages.h b/chrome/common/speech_input_messages.h
index c46ac02..8080db9 100644
--- a/chrome/common/speech_input_messages.h
+++ b/chrome/common/speech_input_messages.h
@@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_COMMON_SPEECH_INPUT_MESSAGES_H_
-#define CHROME_COMMON_SPEECH_INPUT_MESSAGES_H_
-#pragma once
+// Multiply-included message file, hence no include guard.
+#include <string>
+
+#include "chrome/common/common_param_traits.h"
#include "chrome/common/speech_input_result.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_param_traits.h"
@@ -13,42 +14,26 @@
#define IPC_MESSAGE_START SpeechInputMsgStart
-namespace speech_input {
-struct SpeechInputResultItem;
-}
-
// Used to start a speech recognition session.
-struct SpeechInputHostMsg_StartRecognition_Params {
- SpeechInputHostMsg_StartRecognition_Params();
- ~SpeechInputHostMsg_StartRecognition_Params();
-
- int render_view_id; // The render view requesting speech recognition.
- int request_id; // Request ID used within the render view.
- gfx::Rect element_rect; // Position of the UI element in page coordinates.
- std::string language; // Language to use for speech recognition.
- std::string grammar; // Speech grammar given by the speech input element.
- std::string origin_url; // URL of the page (or iframe if applicable).
-};
-
-namespace IPC {
-
-template <>
-struct ParamTraits<speech_input::SpeechInputResultItem> {
- typedef speech_input::SpeechInputResultItem param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-template <>
-struct ParamTraits<SpeechInputHostMsg_StartRecognition_Params> {
- typedef SpeechInputHostMsg_StartRecognition_Params param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-} // namespace IPC
+IPC_STRUCT_BEGIN(SpeechInputHostMsg_StartRecognition_Params)
+ // The render view requesting speech recognition.
+ IPC_STRUCT_MEMBER(int, render_view_id)
+ // Request ID used within the render view.
+ IPC_STRUCT_MEMBER(int, request_id)
+ // Position of the UI element in page coordinates.
+ IPC_STRUCT_MEMBER(gfx::Rect, element_rect)
+ // Language to use for speech recognition.
+ IPC_STRUCT_MEMBER(std::string, language)
+ // Speech grammar given by the speech input element.
+ IPC_STRUCT_MEMBER(std::string, grammar)
+ // URL of the page (or iframe if applicable).
+ IPC_STRUCT_MEMBER(std::string, origin_url)
+IPC_STRUCT_END()
+
+IPC_STRUCT_TRAITS_BEGIN(speech_input::SpeechInputResultItem)
+ IPC_STRUCT_TRAITS_MEMBER(utterance)
+ IPC_STRUCT_TRAITS_MEMBER(confidence)
+IPC_STRUCT_TRAITS_END()
// Speech input messages sent from the renderer to the browser.
@@ -90,4 +75,3 @@ IPC_MESSAGE_ROUTED1(SpeechInputMsg_RecordingComplete,
IPC_MESSAGE_ROUTED1(SpeechInputMsg_RecognitionComplete,
int /* request_id */)
-#endif // CHROME_COMMON_SPEECH_INPUT_MESSAGES_H_
diff --git a/chrome/common/utility_messages.cc b/chrome/common/utility_messages.cc
deleted file mode 100644
index ee079aa..0000000
--- a/chrome/common/utility_messages.cc
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) 2010 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.
-
-#include "base/file_path.h"
-#include "base/values.h"
-#include "chrome/common/common_param_traits.h"
-#include "chrome/common/indexed_db_key.h"
-#include "chrome/common/serialized_script_value.h"
-
-#define IPC_MESSAGE_IMPL
-#include "chrome/common/utility_messages.h"
diff --git a/chrome/common/utility_messages.h b/chrome/common/utility_messages.h
index 3e298d6..7d00790 100644
--- a/chrome/common/utility_messages.h
+++ b/chrome/common/utility_messages.h
@@ -2,75 +2,185 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_COMMON_UTILITY_MESSAGES_H_
-#define CHROME_COMMON_UTILITY_MESSAGES_H_
-#pragma once
+// Multiply-included message file, so no include guard.
#include <string>
+#include <vector>
#include "base/basictypes.h"
+#include "base/file_path.h"
+#include "base/platform_file.h"
+#include "base/values.h"
#include "chrome/common/common_param_traits.h"
#include "chrome/common/extensions/update_manifest.h"
+#include "chrome/common/indexed_db_key.h"
#include "chrome/common/indexed_db_param_traits.h"
+#include "chrome/common/serialized_script_value.h"
+#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_utils.h"
+#include "printing/backend/print_backend.h"
+#include "printing/page_range.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/gfx/rect.h"
-namespace IPC {
+#define IPC_MESSAGE_START UtilityMsgStart
+
+class FilePath;
+class IndexedDBKey;
+class SerializedScriptValue;
+class SkBitmap;
// Traits for UpdateManifest::Result.
-template <>
-struct ParamTraits<UpdateManifest::Result> {
- typedef UpdateManifest::Result param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.extension_id);
- WriteParam(m, p.version);
- WriteParam(m, p.browser_min_version);
- WriteParam(m, p.package_hash);
- WriteParam(m, p.crx_url);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- return ReadParam(m, iter, &p->extension_id) &&
- ReadParam(m, iter, &p->version) &&
- ReadParam(m, iter, &p->browser_min_version) &&
- ReadParam(m, iter, &p->package_hash) &&
- ReadParam(m, iter, &p->crx_url);
- }
- static void Log(const param_type& p, std::string* l) {
- l->append("(");
- LogParam(p.extension_id, l);
- l->append(", ");
- LogParam(p.version, l);
- l->append(", ");
- LogParam(p.browser_min_version, l);
- l->append(", ");
- LogParam(p.package_hash, l);
- l->append(", ");
- LogParam(p.crx_url, l);
- l->append(")");
- }
-};
-
-template<>
-struct ParamTraits<UpdateManifest::Results> {
- typedef UpdateManifest::Results param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.list);
- WriteParam(m, p.daystart_elapsed_seconds);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- return ReadParam(m, iter, &p->list) &&
- ReadParam(m, iter, &p->daystart_elapsed_seconds);
- }
- static void Log(const param_type& p, std::string* l) {
- l->append("(");
- LogParam(p.list, l);
- l->append(", ");
- LogParam(p.daystart_elapsed_seconds, l);
- l->append(")");
- }
-};
-
-} // namespace IPC
-
-#include "chrome/common/utility_messages_internal.h"
-
-#endif // CHROME_COMMON_UTILITY_MESSAGES_H_
+IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Result)
+ IPC_STRUCT_TRAITS_MEMBER(extension_id)
+ IPC_STRUCT_TRAITS_MEMBER(version)
+ IPC_STRUCT_TRAITS_MEMBER(browser_min_version)
+ IPC_STRUCT_TRAITS_MEMBER(package_hash)
+ IPC_STRUCT_TRAITS_MEMBER(crx_url)
+IPC_STRUCT_TRAITS_END()
+
+// Traits for UpdateManifest::Results
+IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Results)
+ IPC_STRUCT_TRAITS_MEMBER(list)
+ IPC_STRUCT_TRAITS_MEMBER(daystart_elapsed_seconds)
+IPC_STRUCT_TRAITS_END()
+
+//------------------------------------------------------------------------------
+// Utility process messages:
+// These are messages from the browser to the utility process.
+// Tell the utility process to unpack the given extension file in its
+// directory and verify that it is valid.
+IPC_MESSAGE_CONTROL1(UtilityMsg_UnpackExtension,
+ FilePath /* extension_filename */)
+
+// Tell the utility process to parse the given JSON data and verify its
+// validity.
+IPC_MESSAGE_CONTROL1(UtilityMsg_UnpackWebResource,
+ std::string /* JSON data */)
+
+// Tell the utility process to parse the given xml document.
+IPC_MESSAGE_CONTROL1(UtilityMsg_ParseUpdateManifest,
+ std::string /* xml document contents */)
+
+// Tell the utility process to decode the given image data.
+IPC_MESSAGE_CONTROL1(UtilityMsg_DecodeImage,
+ std::vector<unsigned char>) // encoded image contents
+
+// Tell the utility process to render the given PDF into a metafile.
+IPC_MESSAGE_CONTROL5(UtilityMsg_RenderPDFPagesToMetafile,
+ base::PlatformFile, // PDF file
+ FilePath, // Location for output metafile
+ gfx::Rect, // Render Area
+ int, // DPI
+ std::vector<printing::PageRange>)
+
+// Tell the utility process to extract the given IDBKeyPath from the
+// SerializedScriptValue vector and reply with the corresponding IDBKeys.
+IPC_MESSAGE_CONTROL3(UtilityMsg_IDBKeysFromValuesAndKeyPath,
+ int, // id
+ std::vector<SerializedScriptValue>,
+ string16) // IDBKeyPath
+
+IPC_MESSAGE_CONTROL3(UtilityMsg_InjectIDBKey,
+ IndexedDBKey /* key */,
+ SerializedScriptValue /* value */,
+ string16 /* key path*/);
+
+// Tells the utility process that it's running in batch mode.
+IPC_MESSAGE_CONTROL0(UtilityMsg_BatchMode_Started)
+
+// Tells the utility process that it can shutdown.
+IPC_MESSAGE_CONTROL0(UtilityMsg_BatchMode_Finished)
+
+// Tells the utility process to get capabilities and defaults for the specified
+// printer. Used on Windows to isolate the service process from printer driver
+// crashes by executing this in a separate process. This does not run in a
+// sandbox.
+IPC_MESSAGE_CONTROL1(UtilityMsg_GetPrinterCapsAndDefaults,
+ std::string /* printer name */)
+
+//------------------------------------------------------------------------------
+// Utility process host messages:
+// These are messages from the utility process to the browser.
+// Reply when the utility process is done unpacking an extension. |manifest|
+// is the parsed manifest.json file.
+// The unpacker should also have written out files containing the decoded
+// images and message catalogs from the extension. See ExtensionUnpacker for
+// details.
+IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackExtension_Succeeded,
+ DictionaryValue /* manifest */)
+
+// Reply when the utility process has failed while unpacking an extension.
+// |error_message| is a user-displayable explanation of what went wrong.
+IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackExtension_Failed,
+ std::string /* error_message, if any */)
+
+// Reply when the utility process is done unpacking and parsing JSON data
+// from a web resource.
+IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackWebResource_Succeeded,
+ DictionaryValue /* json data */)
+
+// Reply when the utility process has failed while unpacking and parsing a
+// web resource. |error_message| is a user-readable explanation of what
+// went wrong.
+IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackWebResource_Failed,
+ std::string /* error_message, if any */)
+
+// Reply when the utility process has succeeded in parsing an update manifest
+// xml document.
+IPC_MESSAGE_CONTROL1(UtilityHostMsg_ParseUpdateManifest_Succeeded,
+ UpdateManifest::Results /* updates */)
+
+// Reply when an error occured parsing the update manifest. |error_message|
+// is a description of what went wrong suitable for logging.
+IPC_MESSAGE_CONTROL1(UtilityHostMsg_ParseUpdateManifest_Failed,
+ std::string /* error_message, if any */)
+
+// Reply when the utility process has succeeded in decoding the image.
+IPC_MESSAGE_CONTROL1(UtilityHostMsg_DecodeImage_Succeeded,
+ SkBitmap) // decoded image
+
+// Reply when an error occured decoding the image.
+IPC_MESSAGE_CONTROL0(UtilityHostMsg_DecodeImage_Failed)
+
+// Reply when the utility process has succeeded in rendering the PDF.
+IPC_MESSAGE_CONTROL1(UtilityHostMsg_RenderPDFPagesToMetafile_Succeeded,
+ int) // Highest rendered page number
+
+// Reply when an error occured rendering the PDF.
+IPC_MESSAGE_CONTROL0(UtilityHostMsg_RenderPDFPagesToMetafile_Failed)
+
+#if defined(OS_WIN)
+// Request that the given font be loaded by the host so it's cached by the
+// OS. Please see ChildProcessHost::PreCacheFont for details.
+IPC_SYNC_MESSAGE_CONTROL1_0(UtilityHostMsg_PreCacheFont,
+ LOGFONT /* font data */)
+#endif // defined(OS_WIN)
+
+// Reply when the utility process has succeeded in obtaining the value for
+// IDBKeyPath.
+IPC_MESSAGE_CONTROL2(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Succeeded,
+ int /* id */,
+ std::vector<IndexedDBKey> /* value */)
+
+// Reply when the utility process has failed in obtaining the value for
+// IDBKeyPath.
+IPC_MESSAGE_CONTROL1(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Failed,
+ int /* id */)
+
+// Reply when the utility process has finished injecting an IDBKey into
+// a SerializedScriptValue.
+IPC_MESSAGE_CONTROL1(UtilityHostMsg_InjectIDBKey_Finished,
+ SerializedScriptValue /* new value */)
+
+// Reply when the utility process has succeeded in obtaining the printer
+// capabilities and defaults.
+IPC_MESSAGE_CONTROL2(UtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded,
+ std::string /* printer name */,
+ printing::PrinterCapsAndDefaults)
+
+// Reply when the utility process has failed to obtain the printer
+// capabilities and defaults.
+IPC_MESSAGE_CONTROL1(UtilityHostMsg_GetPrinterCapsAndDefaults_Failed,
+ std::string /* printer name */)
+
diff --git a/chrome/common/utility_messages_internal.h b/chrome/common/utility_messages_internal.h
deleted file mode 100644
index 162d183..0000000
--- a/chrome/common/utility_messages_internal.h
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright (c) 2009 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.
-
-#include <string>
-#include <vector>
-
-#include "base/platform_file.h"
-#include "ipc/ipc_message_macros.h"
-#include "printing/backend/print_backend.h"
-#include "printing/page_range.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/gfx/rect.h"
-
-#define IPC_MESSAGE_START UtilityMsgStart
-
-class FilePath;
-class IndexedDBKey;
-class SerializedScriptValue;
-class SkBitmap;
-
-//------------------------------------------------------------------------------
-// Utility process messages:
-// These are messages from the browser to the utility process.
-// Tell the utility process to unpack the given extension file in its
-// directory and verify that it is valid.
-IPC_MESSAGE_CONTROL1(UtilityMsg_UnpackExtension,
- FilePath /* extension_filename */)
-
-// Tell the utility process to parse the given JSON data and verify its
-// validity.
-IPC_MESSAGE_CONTROL1(UtilityMsg_UnpackWebResource,
- std::string /* JSON data */)
-
-// Tell the utility process to parse the given xml document.
-IPC_MESSAGE_CONTROL1(UtilityMsg_ParseUpdateManifest,
- std::string /* xml document contents */)
-
-// Tell the utility process to decode the given image data.
-IPC_MESSAGE_CONTROL1(UtilityMsg_DecodeImage,
- std::vector<unsigned char>) // encoded image contents
-
-// Tell the utility process to render the given PDF into a metafile.
-IPC_MESSAGE_CONTROL5(UtilityMsg_RenderPDFPagesToMetafile,
- base::PlatformFile, // PDF file
- FilePath, // Location for output metafile
- gfx::Rect, // Render Area
- int, // DPI
- std::vector<printing::PageRange>)
-
-// Tell the utility process to extract the given IDBKeyPath from the
-// SerializedScriptValue vector and reply with the corresponding IDBKeys.
-IPC_MESSAGE_CONTROL3(UtilityMsg_IDBKeysFromValuesAndKeyPath,
- int, // id
- std::vector<SerializedScriptValue>,
- string16) // IDBKeyPath
-
-IPC_MESSAGE_CONTROL3(UtilityMsg_InjectIDBKey,
- IndexedDBKey /* key */,
- SerializedScriptValue /* value */,
- string16 /* key path*/);
-
-// Tells the utility process that it's running in batch mode.
-IPC_MESSAGE_CONTROL0(UtilityMsg_BatchMode_Started)
-
-// Tells the utility process that it can shutdown.
-IPC_MESSAGE_CONTROL0(UtilityMsg_BatchMode_Finished)
-
-// Tells the utility process to get capabilities and defaults for the specified
-// printer. Used on Windows to isolate the service process from printer driver
-// crashes by executing this in a separate process. This does not run in a
-// sandbox.
-IPC_MESSAGE_CONTROL1(UtilityMsg_GetPrinterCapsAndDefaults,
- std::string /* printer name */)
-
-//------------------------------------------------------------------------------
-// Utility process host messages:
-// These are messages from the utility process to the browser.
-// Reply when the utility process is done unpacking an extension. |manifest|
-// is the parsed manifest.json file.
-// The unpacker should also have written out files containing the decoded
-// images and message catalogs from the extension. See ExtensionUnpacker for
-// details.
-IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackExtension_Succeeded,
- DictionaryValue /* manifest */)
-
-// Reply when the utility process has failed while unpacking an extension.
-// |error_message| is a user-displayable explanation of what went wrong.
-IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackExtension_Failed,
- std::string /* error_message, if any */)
-
-// Reply when the utility process is done unpacking and parsing JSON data
-// from a web resource.
-IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackWebResource_Succeeded,
- DictionaryValue /* json data */)
-
-// Reply when the utility process has failed while unpacking and parsing a
-// web resource. |error_message| is a user-readable explanation of what
-// went wrong.
-IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackWebResource_Failed,
- std::string /* error_message, if any */)
-
-// Reply when the utility process has succeeded in parsing an update manifest
-// xml document.
-IPC_MESSAGE_CONTROL1(UtilityHostMsg_ParseUpdateManifest_Succeeded,
- UpdateManifest::Results /* updates */)
-
-// Reply when an error occured parsing the update manifest. |error_message|
-// is a description of what went wrong suitable for logging.
-IPC_MESSAGE_CONTROL1(UtilityHostMsg_ParseUpdateManifest_Failed,
- std::string /* error_message, if any */)
-
-// Reply when the utility process has succeeded in decoding the image.
-IPC_MESSAGE_CONTROL1(UtilityHostMsg_DecodeImage_Succeeded,
- SkBitmap) // decoded image
-
-// Reply when an error occured decoding the image.
-IPC_MESSAGE_CONTROL0(UtilityHostMsg_DecodeImage_Failed)
-
-// Reply when the utility process has succeeded in rendering the PDF.
-IPC_MESSAGE_CONTROL1(UtilityHostMsg_RenderPDFPagesToMetafile_Succeeded,
- int) // Highest rendered page number
-
-// Reply when an error occured rendering the PDF.
-IPC_MESSAGE_CONTROL0(UtilityHostMsg_RenderPDFPagesToMetafile_Failed)
-
-#if defined(OS_WIN)
-// Request that the given font be loaded by the host so it's cached by the
-// OS. Please see ChildProcessHost::PreCacheFont for details.
-IPC_SYNC_MESSAGE_CONTROL1_0(UtilityHostMsg_PreCacheFont,
- LOGFONT /* font data */)
-#endif // defined(OS_WIN)
-
-// Reply when the utility process has succeeded in obtaining the value for
-// IDBKeyPath.
-IPC_MESSAGE_CONTROL2(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Succeeded,
- int /* id */,
- std::vector<IndexedDBKey> /* value */)
-
-// Reply when the utility process has failed in obtaining the value for
-// IDBKeyPath.
-IPC_MESSAGE_CONTROL1(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Failed,
- int /* id */)
-
-// Reply when the utility process has finished injecting an IDBKey into
-// a SerializedScriptValue.
-IPC_MESSAGE_CONTROL1(UtilityHostMsg_InjectIDBKey_Finished,
- SerializedScriptValue /* new value */)
-
-// Reply when the utility process has succeeded in obtaining the printer
-// capabilities and defaults.
-IPC_MESSAGE_CONTROL2(UtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded,
- std::string /* printer name */,
- printing::PrinterCapsAndDefaults)
-
-// Reply when the utility process has failed to obtain the printer
-// capabilities and defaults.
-IPC_MESSAGE_CONTROL1(UtilityHostMsg_GetPrinterCapsAndDefaults_Failed,
- std::string /* printer name */)
diff --git a/chrome/common/worker_messages.cc b/chrome/common/worker_messages.cc
deleted file mode 100644
index 19b8d23..0000000
--- a/chrome/common/worker_messages.cc
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (c) 2010 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.
-
-#include "chrome/common/common_param_traits.h"
-
-#define IPC_MESSAGE_IMPL
-#include "chrome/common/worker_messages.h"
-
-WorkerHostMsg_PostConsoleMessageToWorkerObject_Params::
-WorkerHostMsg_PostConsoleMessageToWorkerObject_Params()
- : source_identifier(-1),
- message_type(-1),
- message_level(-1),
- line_number(-1) {
-}
-
-WorkerHostMsg_PostConsoleMessageToWorkerObject_Params::
-~WorkerHostMsg_PostConsoleMessageToWorkerObject_Params() {
-}
-
-WorkerProcessMsg_CreateWorker_Params::WorkerProcessMsg_CreateWorker_Params()
- : is_shared(false),
- route_id(-1),
- creator_process_id(-1),
- creator_appcache_host_id(-1),
- shared_worker_appcache_id(-1) {
-}
-
-WorkerProcessMsg_CreateWorker_Params::~WorkerProcessMsg_CreateWorker_Params() {
-}
-
-
-namespace IPC {
-
-void ParamTraits<WorkerHostMsg_PostConsoleMessageToWorkerObject_Params>::Write(
- Message* m, const param_type& p) {
- WriteParam(m, p.source_identifier);
- WriteParam(m, p.message_type);
- WriteParam(m, p.message_level);
- WriteParam(m, p.message);
- WriteParam(m, p.line_number);
- WriteParam(m, p.source_url);
-}
-
-bool ParamTraits<WorkerHostMsg_PostConsoleMessageToWorkerObject_Params>::Read(
- const Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->source_identifier) &&
- ReadParam(m, iter, &p->message_type) &&
- ReadParam(m, iter, &p->message_level) &&
- ReadParam(m, iter, &p->message) &&
- ReadParam(m, iter, &p->line_number) &&
- ReadParam(m, iter, &p->source_url);
-}
-
-void ParamTraits<WorkerHostMsg_PostConsoleMessageToWorkerObject_Params>::Log(
- const param_type& p, std::string* l) {
- l->append("(");
- LogParam(p.source_identifier, l);
- l->append(", ");
- LogParam(p.message_type, l);
- l->append(", ");
- LogParam(p.message_level, l);
- l->append(", ");
- LogParam(p.message, l);
- l->append(", ");
- LogParam(p.line_number, l);
- l->append(", ");
- LogParam(p.source_url, l);
- l->append(")");
-}
-
-void ParamTraits<WorkerProcessMsg_CreateWorker_Params>::Write(
- Message* m, const param_type& p) {
- WriteParam(m, p.url);
- WriteParam(m, p.is_shared);
- WriteParam(m, p.name);
- WriteParam(m, p.route_id);
- WriteParam(m, p.creator_process_id);
- WriteParam(m, p.creator_appcache_host_id);
- WriteParam(m, p.shared_worker_appcache_id);
-}
-
-bool ParamTraits<WorkerProcessMsg_CreateWorker_Params>::Read(const Message* m,
- void** iter,
- param_type* p) {
- return
- ReadParam(m, iter, &p->url) &&
- ReadParam(m, iter, &p->is_shared) &&
- ReadParam(m, iter, &p->name) &&
- ReadParam(m, iter, &p->route_id) &&
- ReadParam(m, iter, &p->creator_process_id) &&
- ReadParam(m, iter, &p->creator_appcache_host_id) &&
- ReadParam(m, iter, &p->shared_worker_appcache_id);
-}
-
-void ParamTraits<WorkerProcessMsg_CreateWorker_Params>::Log(const param_type& p,
- std::string* l) {
- l->append("(");
- LogParam(p.url, l);
- l->append(", ");
- LogParam(p.is_shared, l);
- l->append(", ");
- LogParam(p.name, l);
- l->append(", ");
- LogParam(p.route_id, l);
- l->append(", ");
- LogParam(p.creator_process_id, l);
- l->append(", ");
- LogParam(p.creator_appcache_host_id, l);
- l->append(", ");
- LogParam(p.shared_worker_appcache_id, l);
- l->append(")");
-}
-
-} // namespace IPC
diff --git a/chrome/common/worker_messages.h b/chrome/common/worker_messages.h
index 28fec62..ba33a20 100644
--- a/chrome/common/worker_messages.h
+++ b/chrome/common/worker_messages.h
@@ -5,72 +5,163 @@
// Defines messages between the browser and worker process, as well as between
// the renderer and worker process.
-#ifndef CHROME_COMMON_WORKER_MESSAGES_H_
-#define CHROME_COMMON_WORKER_MESSAGES_H_
-#pragma once
+// Multiply-included message file, hence no include guard.
#include <string>
+#include <utility>
#include <vector>
#include "base/basictypes.h"
+#include "base/string16.h"
#include "googleurl/src/gurl.h"
+#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_utils.h"
typedef std::pair<string16, std::vector<int> > QueuedMessage;
+#define IPC_MESSAGE_START WorkerMsgStart
+
// Parameters structure for WorkerHostMsg_PostConsoleMessageToWorkerObject,
// which has too many data parameters to be reasonably put in a predefined
// IPC message. The data members directly correspond to parameters of
// WebWorkerClient::postConsoleMessageToWorkerObject()
-struct WorkerHostMsg_PostConsoleMessageToWorkerObject_Params {
- WorkerHostMsg_PostConsoleMessageToWorkerObject_Params();
- ~WorkerHostMsg_PostConsoleMessageToWorkerObject_Params();
-
- int source_identifier;
- int message_type;
- int message_level;
- string16 message;
- int line_number;
- string16 source_url;
-};
+IPC_STRUCT_BEGIN(WorkerHostMsg_PostConsoleMessageToWorkerObject_Params)
+ IPC_STRUCT_MEMBER(int, source_identifier)
+ IPC_STRUCT_MEMBER(int, message_type)
+ IPC_STRUCT_MEMBER(int, message_level)
+ IPC_STRUCT_MEMBER(string16, message)
+ IPC_STRUCT_MEMBER(int, line_number)
+ IPC_STRUCT_MEMBER(string16, source_url)
+IPC_STRUCT_END()
// Parameter structure for WorkerProcessMsg_CreateWorker.
-struct WorkerProcessMsg_CreateWorker_Params {
- WorkerProcessMsg_CreateWorker_Params();
- ~WorkerProcessMsg_CreateWorker_Params();
-
- GURL url;
- bool is_shared;
- string16 name;
- int route_id;
- int creator_process_id;
- int creator_appcache_host_id; // Only valid for dedicated workers.
- int64 shared_worker_appcache_id; // Only valid for shared workers.
-};
-
-namespace IPC {
-
-// Traits for WorkerHostMsg_PostConsoleMessageToWorkerObject_Params structure
-// to pack/unpack.
-template <>
-struct ParamTraits<WorkerHostMsg_PostConsoleMessageToWorkerObject_Params> {
- typedef WorkerHostMsg_PostConsoleMessageToWorkerObject_Params param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-// Traits for WorkerProcessMsg_CreateWorker_Params.
-template <>
-struct ParamTraits<WorkerProcessMsg_CreateWorker_Params> {
- typedef WorkerProcessMsg_CreateWorker_Params param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-} // namespace IPC
-
-#include "chrome/common/worker_messages_internal.h"
-
-#endif // CHROME_COMMON_WORKER_MESSAGES_H_
+IPC_STRUCT_BEGIN(WorkerProcessMsg_CreateWorker_Params)
+ IPC_STRUCT_MEMBER(GURL, url)
+ IPC_STRUCT_MEMBER(bool, is_shared)
+ IPC_STRUCT_MEMBER(string16, name)
+ IPC_STRUCT_MEMBER(int, route_id)
+ IPC_STRUCT_MEMBER(int, creator_process_id)
+ // Only valid for dedicated workers.
+ IPC_STRUCT_MEMBER(int, creator_appcache_host_id)
+ // Only valid for shared workers.
+ IPC_STRUCT_MEMBER(int64, shared_worker_appcache_id)
+IPC_STRUCT_END()
+
+//-----------------------------------------------------------------------------
+// WorkerProcess messages
+// These are messages sent from the browser to the worker process.
+IPC_MESSAGE_CONTROL1(WorkerProcessMsg_CreateWorker,
+ WorkerProcessMsg_CreateWorker_Params)
+
+// Note: these Message Port related messages can also be sent to the
+// renderer process. Putting them here since we don't have a shared place
+// like common_messages_internal.h
+IPC_MESSAGE_ROUTED3(WorkerProcessMsg_Message,
+ string16 /* message */,
+ std::vector<int> /* sent_message_port_ids */,
+ std::vector<int> /* new_routing_ids */)
+
+// Tells the Message Port Channel object that there are no more in-flight
+// messages arriving.
+IPC_MESSAGE_ROUTED0(WorkerProcessMsg_MessagesQueued)
+
+
+//-----------------------------------------------------------------------------
+// WorkerProcessHost messages
+// These are messages sent from the worker process to the browser process.
+
+// Note: these Message Port related messages can also be sent out from the
+// renderer process. Putting them here since we don't have a shared place
+// like common_messages_internal.h
+
+// Creates a new Message Port Channel object. The first paramaeter is the
+// message port channel's routing id in this process. The second parameter
+// is the process-wide-unique identifier for that port.
+IPC_SYNC_MESSAGE_CONTROL0_2(WorkerProcessHostMsg_CreateMessagePort,
+ int /* route_id */,
+ int /* message_port_id */)
+
+// Sent when a Message Port Channel object is destroyed.
+IPC_MESSAGE_CONTROL1(WorkerProcessHostMsg_DestroyMessagePort,
+ int /* message_port_id */)
+
+// Sends a message to a message port. Optionally sends a message port as
+// as well if sent_message_port_id != MSG_ROUTING_NONE.
+IPC_MESSAGE_CONTROL3(WorkerProcessHostMsg_PostMessage,
+ int /* sender_message_port_id */,
+ string16 /* message */,
+ std::vector<int> /* sent_message_port_ids */)
+
+// Causes messages sent to the remote port to be delivered to this local port.
+IPC_MESSAGE_CONTROL2(WorkerProcessHostMsg_Entangle,
+ int /* local_message_port_id */,
+ int /* remote_message_port_id */)
+
+// Causes the browser to queue messages sent to this port until the the port
+// has made sure that all in-flight messages were routed to the new
+// destination.
+IPC_MESSAGE_CONTROL1(WorkerProcessHostMsg_QueueMessages,
+ int /* message_port_id */)
+
+// Sends the browser all the queued messages that arrived at this message port
+// after it was sent in a postMessage call.
+// NOTE: MSVS can't compile the macro if std::vector<std::pair<string16, int> >
+// is used, so we typedef it in worker_messages.h.
+IPC_MESSAGE_CONTROL2(WorkerProcessHostMsg_SendQueuedMessages,
+ int /* message_port_id */,
+ std::vector<QueuedMessage> /* queued_messages */)
+
+// Sent by the worker process to check whether access to web databases is
+// granted by content settings.
+IPC_SYNC_MESSAGE_CONTROL5_1(WorkerProcessHostMsg_AllowDatabase,
+ int /* worker_route_id */,
+ GURL /* origin url */,
+ string16 /* database name */,
+ string16 /* database display name */,
+ unsigned long /* estimated size */,
+ bool /* result */)
+
+//-----------------------------------------------------------------------------
+// Worker messages
+// These are messages sent from the renderer process to the worker process.
+IPC_MESSAGE_ROUTED3(WorkerMsg_StartWorkerContext,
+ GURL /* url */,
+ string16 /* user_agent */,
+ string16 /* source_code */)
+
+IPC_MESSAGE_ROUTED0(WorkerMsg_TerminateWorkerContext)
+
+IPC_MESSAGE_ROUTED3(WorkerMsg_PostMessage,
+ string16 /* message */,
+ std::vector<int> /* sent_message_port_ids */,
+ std::vector<int> /* new_routing_ids */)
+
+IPC_MESSAGE_ROUTED2(WorkerMsg_Connect,
+ int /* sent_message_port_id */,
+ int /* routing_id */)
+
+IPC_MESSAGE_ROUTED0(WorkerMsg_WorkerObjectDestroyed)
+
+
+//-----------------------------------------------------------------------------
+// WorkerHost messages
+// These are messages sent from the worker process to the renderer process.
+// WorkerMsg_PostMessage is also sent here.
+IPC_MESSAGE_ROUTED3(WorkerHostMsg_PostExceptionToWorkerObject,
+ string16 /* error_message */,
+ int /* line_number */,
+ string16 /* source_url*/)
+
+IPC_MESSAGE_ROUTED1(WorkerHostMsg_PostConsoleMessageToWorkerObject,
+ WorkerHostMsg_PostConsoleMessageToWorkerObject_Params)
+
+IPC_MESSAGE_ROUTED1(WorkerHostMsg_ConfirmMessageFromWorkerObject,
+ bool /* bool has_pending_activity */)
+
+IPC_MESSAGE_ROUTED1(WorkerHostMsg_ReportPendingActivity,
+ bool /* bool has_pending_activity */)
+
+IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerContextClosed,
+ int /* worker_route_id */)
+IPC_MESSAGE_ROUTED0(WorkerHostMsg_WorkerContextDestroyed)
+
diff --git a/chrome/common/worker_messages_internal.h b/chrome/common/worker_messages_internal.h
deleted file mode 100644
index e661f67..0000000
--- a/chrome/common/worker_messages_internal.h
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright (c) 2009 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.
-
-#include <utility>
-#include <vector>
-#include "base/string16.h"
-#include "googleurl/src/gurl.h"
-#include "ipc/ipc_message_macros.h"
-
-#define IPC_MESSAGE_START WorkerMsgStart
-
-//-----------------------------------------------------------------------------
-// WorkerProcess messages
-// These are messages sent from the browser to the worker process.
-IPC_MESSAGE_CONTROL1(WorkerProcessMsg_CreateWorker,
- WorkerProcessMsg_CreateWorker_Params)
-
-// Note: these Message Port related messages can also be sent to the
-// renderer process. Putting them here since we don't have a shared place
-// like common_messages_internal.h
-IPC_MESSAGE_ROUTED3(WorkerProcessMsg_Message,
- string16 /* message */,
- std::vector<int> /* sent_message_port_ids */,
- std::vector<int> /* new_routing_ids */)
-
-// Tells the Message Port Channel object that there are no more in-flight
-// messages arriving.
-IPC_MESSAGE_ROUTED0(WorkerProcessMsg_MessagesQueued)
-
-
-//-----------------------------------------------------------------------------
-// WorkerProcessHost messages
-// These are messages sent from the worker process to the browser process.
-
-// Note: these Message Port related messages can also be sent out from the
-// renderer process. Putting them here since we don't have a shared place
-// like common_messages_internal.h
-
-// Creates a new Message Port Channel object. The first paramaeter is the
-// message port channel's routing id in this process. The second parameter
-// is the process-wide-unique identifier for that port.
-IPC_SYNC_MESSAGE_CONTROL0_2(WorkerProcessHostMsg_CreateMessagePort,
- int /* route_id */,
- int /* message_port_id */)
-
-// Sent when a Message Port Channel object is destroyed.
-IPC_MESSAGE_CONTROL1(WorkerProcessHostMsg_DestroyMessagePort,
- int /* message_port_id */)
-
-// Sends a message to a message port. Optionally sends a message port as
-// as well if sent_message_port_id != MSG_ROUTING_NONE.
-IPC_MESSAGE_CONTROL3(WorkerProcessHostMsg_PostMessage,
- int /* sender_message_port_id */,
- string16 /* message */,
- std::vector<int> /* sent_message_port_ids */)
-
-// Causes messages sent to the remote port to be delivered to this local port.
-IPC_MESSAGE_CONTROL2(WorkerProcessHostMsg_Entangle,
- int /* local_message_port_id */,
- int /* remote_message_port_id */)
-
-// Causes the browser to queue messages sent to this port until the the port
-// has made sure that all in-flight messages were routed to the new
-// destination.
-IPC_MESSAGE_CONTROL1(WorkerProcessHostMsg_QueueMessages,
- int /* message_port_id */)
-
-// Sends the browser all the queued messages that arrived at this message port
-// after it was sent in a postMessage call.
-// NOTE: MSVS can't compile the macro if std::vector<std::pair<string16, int> >
-// is used, so we typedef it in worker_messages.h.
-IPC_MESSAGE_CONTROL2(WorkerProcessHostMsg_SendQueuedMessages,
- int /* message_port_id */,
- std::vector<QueuedMessage> /* queued_messages */)
-
-// Sent by the worker process to check whether access to web databases is
-// granted by content settings.
-IPC_SYNC_MESSAGE_CONTROL5_1(WorkerProcessHostMsg_AllowDatabase,
- int /* worker_route_id */,
- GURL /* origin url */,
- string16 /* database name */,
- string16 /* database display name */,
- unsigned long /* estimated size */,
- bool /* result */)
-
-//-----------------------------------------------------------------------------
-// Worker messages
-// These are messages sent from the renderer process to the worker process.
-IPC_MESSAGE_ROUTED3(WorkerMsg_StartWorkerContext,
- GURL /* url */,
- string16 /* user_agent */,
- string16 /* source_code */)
-
-IPC_MESSAGE_ROUTED0(WorkerMsg_TerminateWorkerContext)
-
-IPC_MESSAGE_ROUTED3(WorkerMsg_PostMessage,
- string16 /* message */,
- std::vector<int> /* sent_message_port_ids */,
- std::vector<int> /* new_routing_ids */)
-
-IPC_MESSAGE_ROUTED2(WorkerMsg_Connect,
- int /* sent_message_port_id */,
- int /* routing_id */)
-
-IPC_MESSAGE_ROUTED0(WorkerMsg_WorkerObjectDestroyed)
-
-
-//-----------------------------------------------------------------------------
-// WorkerHost messages
-// These are messages sent from the worker process to the renderer process.
-// WorkerMsg_PostMessage is also sent here.
-IPC_MESSAGE_ROUTED3(WorkerHostMsg_PostExceptionToWorkerObject,
- string16 /* error_message */,
- int /* line_number */,
- string16 /* source_url*/)
-
-IPC_MESSAGE_ROUTED1(WorkerHostMsg_PostConsoleMessageToWorkerObject,
- WorkerHostMsg_PostConsoleMessageToWorkerObject_Params)
-
-IPC_MESSAGE_ROUTED1(WorkerHostMsg_ConfirmMessageFromWorkerObject,
- bool /* bool has_pending_activity */)
-
-IPC_MESSAGE_ROUTED1(WorkerHostMsg_ReportPendingActivity,
- bool /* bool has_pending_activity */)
-
-IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerContextClosed,
- int /* worker_route_id */)
-IPC_MESSAGE_ROUTED0(WorkerHostMsg_WorkerContextDestroyed)