diff options
-rw-r--r-- | chrome/browser/utility_process_host.cc | 2 | ||||
-rwxr-xr-x | chrome/chrome.gyp | 3 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 34 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 59 | ||||
-rw-r--r-- | chrome/common/utility_messages.h | 58 | ||||
-rw-r--r-- | chrome/common/utility_messages_internal.h | 74 | ||||
-rw-r--r-- | chrome/utility/utility_thread.cc | 3 | ||||
-rw-r--r-- | ipc/ipc_message_macros.h | 8 | ||||
-rw-r--r-- | ipc/ipc_message_utils.h | 2 |
9 files changed, 143 insertions, 100 deletions
diff --git a/chrome/browser/utility_process_host.cc b/chrome/browser/utility_process_host.cc index 76d24f2..ccef437 100644 --- a/chrome/browser/utility_process_host.cc +++ b/chrome/browser/utility_process_host.cc @@ -11,7 +11,7 @@ #include "base/message_loop.h" #include "chrome/browser/browser_process.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/utility_messages.h" #include "ipc/ipc_switches.h" UtilityProcessHost::UtilityProcessHost(ResourceDispatcherHost* rdh, diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 76229cac..48f1f25 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -602,6 +602,8 @@ 'common/transport_dib_win.cc', 'common/url_constants.cc', 'common/url_constants.h', + 'common/utility_messages.h', + 'common/utility_messages_internal.h', 'common/view_types.cc', 'common/view_types.h', 'common/visitedlink_common.cc', @@ -642,6 +644,7 @@ '-lX11', '-lXrender', '-lXext', + '-lGL', ], }, },], diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index ce25321..9e2e6fc 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -21,7 +21,6 @@ #include "chrome/common/css_colors.h" #include "chrome/common/dom_storage_type.h" #include "chrome/common/edit_command.h" -#include "chrome/common/extensions/update_manifest.h" #include "chrome/common/extensions/url_pattern.h" #include "chrome/common/filter_policy.h" #include "chrome/common/navigation_gesture.h" @@ -2113,39 +2112,6 @@ struct SimilarTypeTraits<ViewType::Type> { typedef int Type; }; -// 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::wstring* l) { - l->append(L"("); - LogParam(p.extension_id, l); - l->append(L", "); - LogParam(p.version, l); - l->append(L", "); - LogParam(p.browser_min_version, l); - l->append(L", "); - LogParam(p.package_hash, l); - l->append(L", "); - LogParam(p.crx_url, l); - l->append(L")"); - } -}; - // Traits for URLPattern. template <> struct ParamTraits<URLPattern> { diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index e8d8676..d043b29 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -802,25 +802,6 @@ IPC_BEGIN_MESSAGES(View) bool /* on or off */) #endif - //--------------------------------------------------------------------------- - // Utility process messages: - // These are messages from the browser to the utility process. They're here - // because we ran out of spare message types. - - // 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 */) - // Socket Stream messages: // These are messages from the browser to the SocketStreamHandle on // a renderer. @@ -1924,46 +1905,6 @@ IPC_BEGIN_MESSAGES(ViewHost) FilePath /* path */, int64 /* result */) - //--------------------------------------------------------------------------- - // Utility process host messages: - // These are messages from the utility process to the browser. They're here - // because we ran out of spare message types. - - // Reply when the utility process is done unpacking an extension. |manifest| - // is the parsed manifest.json file. |catalogs| is the list of all parsed - // message catalogs and relative paths to them. - // The unpacker should also have written out a file containing decoded images - // from the extension. See ExtensionUnpacker for details. - IPC_MESSAGE_CONTROL2(UtilityHostMsg_UnpackExtension_Succeeded, - DictionaryValue /* manifest */, - DictionaryValue /* catalogs */) - - // 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, - std::vector<UpdateManifest::Result> /* 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 */) - // Sent by the renderer process to acknowledge receipt of a // ViewMsg_CSSInsertRequest message and css has been inserted into the frame. IPC_MESSAGE_ROUTED0(ViewHostMsg_OnCSSInserted) diff --git a/chrome/common/utility_messages.h b/chrome/common/utility_messages.h new file mode 100644 index 0000000..eccdc14 --- /dev/null +++ b/chrome/common/utility_messages.h @@ -0,0 +1,58 @@ +// 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. + +#ifndef CHROME_COMMON_UTILITY_MESSAGES_H_ +#define CHROME_COMMON_UTILITY_MESSAGES_H_ + +#include <string> +#include <vector> + +#include "base/basictypes.h" +#include "base/file_path.h" +#include "base/values.h" +#include "chrome/common/common_param_traits.h" +#include "chrome/common/extensions/update_manifest.h" +#include "ipc/ipc_message_utils.h" + +namespace IPC { + +// 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::wstring* l) { + l->append(L"("); + LogParam(p.extension_id, l); + l->append(L", "); + LogParam(p.version, l); + l->append(L", "); + LogParam(p.browser_min_version, l); + l->append(L", "); + LogParam(p.package_hash, l); + l->append(L", "); + LogParam(p.crx_url, l); + l->append(L")"); + } +}; + +} // namespace IPC + +#define MESSAGES_INTERNAL_FILE "chrome/common/utility_messages_internal.h" +#include "ipc/ipc_message_macros.h" + +#endif // CHROME_COMMON_UTILITY_MESSAGES_H_ diff --git a/chrome/common/utility_messages_internal.h b/chrome/common/utility_messages_internal.h new file mode 100644 index 0000000..4947079 --- /dev/null +++ b/chrome/common/utility_messages_internal.h @@ -0,0 +1,74 @@ +// 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. + +// This header is meant to be included in multiple passes, hence no traditional +// header guard. It is included by utility_messages_internal.h +// See ipc_message_macros.h for explanation of the macros and passes. + +// This file needs to be included again, even though we're actually included +// from it via utility_messages.h. +#include "ipc/ipc_message_macros.h" + +//------------------------------------------------------------------------------ +// Utility process messages: +// These are messages from the browser to the utility process. +IPC_BEGIN_MESSAGES(Utility) + + // 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 */) + +IPC_END_MESSAGES(Utility) + +//------------------------------------------------------------------------------ +// Utility process host messages: +// These are messages from the utility process to the browser. +IPC_BEGIN_MESSAGES(UtilityHost) + + // Reply when the utility process is done unpacking an extension. |manifest| + // is the parsed manifest.json file. |catalogs| is the list of all parsed + // message catalogs and relative paths to them. + // The unpacker should also have written out a file containing decoded images + // from the extension. See ExtensionUnpacker for details. + IPC_MESSAGE_CONTROL2(UtilityHostMsg_UnpackExtension_Succeeded, + DictionaryValue /* manifest */, + DictionaryValue /* catalogs */) + + // 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, + std::vector<UpdateManifest::Result> /* 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 */) + +IPC_END_MESSAGES(UtilityHost) diff --git a/chrome/utility/utility_thread.cc b/chrome/utility/utility_thread.cc index 2c59887..69f0790 100644 --- a/chrome/utility/utility_thread.cc +++ b/chrome/utility/utility_thread.cc @@ -9,8 +9,9 @@ #include "chrome/common/child_process.h" #include "chrome/common/extensions/extension_unpacker.h" #include "chrome/common/extensions/update_manifest.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/utility_messages.h" #include "chrome/common/web_resource/web_resource_unpacker.h" +#include "third_party/skia/include/core/SkBitmap.h" UtilityThread::UtilityThread() { ChildProcess::current()->AddRefProcess(); diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h index f948791..6346e8c 100644 --- a/ipc/ipc_message_macros.h +++ b/ipc/ipc_message_macros.h @@ -137,11 +137,9 @@ #if defined(IPC_MESSAGE_MACROS_ENUMS) #undef IPC_MESSAGE_MACROS_ENUMS -// TODO(jabdelmalek): we're using the lowest 12 bits of type for the message -// id, and the highest 4 bits for the channel type. This constrains us to -// 16 channel types (currently using 8) and 4K messages per type. Should -// really make type be 32 bits, but then we break automation with older Chrome -// builds.. +// We're using the lowest 16 bits of type for the message id, and the highest +// 16 bits for the channel type. +// // Do label##PreStart so that automation messages keep the same id as before. #define IPC_BEGIN_MESSAGES(label) \ enum label##MsgType { \ diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index e24f98c..165e7f9 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -46,6 +46,8 @@ enum IPCMessageStart { WorkerHostMsgStart, NaClProcessMsgStart, CommandBufferMsgStart, + UtilityMsgStart, + UtilityHostMsgStart, // NOTE: When you add a new message class, also update // IPCStatusView::IPCStatusView to ensure logging works. LastMsgIndex |