summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorgrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-15 21:07:03 +0000
committergrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-15 21:07:03 +0000
commit79d68c6ea3f0ee22789e04bcdcdf64841618f2c1 (patch)
tree99e371bf8e2be6bdbf3ea7a0b24bd50e5eb1cc20 /chrome
parentea2a7b919337fb796c8602f1701b60d8fa2d7f42 (diff)
downloadchromium_src-79d68c6ea3f0ee22789e04bcdcdf64841618f2c1.zip
chromium_src-79d68c6ea3f0ee22789e04bcdcdf64841618f2c1.tar.gz
chromium_src-79d68c6ea3f0ee22789e04bcdcdf64841618f2c1.tar.bz2
Moved ParamTraits specializations that depend on WebKit out of content/common/common_param_traits and into webkit_param_traits. Also pulled some specializations out of chrome/common/render_messages and into chrome/common/common_param_traits. This is done so that the MS toolchain can succeed in discarding more code at link time. This halves the size of npchrome_frame.dll in ordinary "Release" builds. I hope for a similar reduction in official builds.
BUG=77445 TEST=Everything should just work(TM). Review URL: http://codereview.chromium.org/6840044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81803 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/importer/profile_import_process_messages.h1
-rw-r--r--chrome/chrome_common.gypi2
-rw-r--r--chrome/common/autofill_messages.h1
-rw-r--r--chrome/common/automation_messages.cc18
-rw-r--r--chrome/common/automation_messages.h3
-rw-r--r--chrome/common/common_param_traits.cc101
-rw-r--r--chrome/common/common_param_traits.h36
-rw-r--r--chrome/common/render_messages.h4
-rw-r--r--chrome/renderer/blocked_plugin.cc1
9 files changed, 146 insertions, 21 deletions
diff --git a/chrome/browser/importer/profile_import_process_messages.h b/chrome/browser/importer/profile_import_process_messages.h
index 6dd898d..1fbf73d 100644
--- a/chrome/browser/importer/profile_import_process_messages.h
+++ b/chrome/browser/importer/profile_import_process_messages.h
@@ -14,6 +14,7 @@
#include "chrome/browser/importer/profile_writer.h"
#include "chrome/browser/search_engines/template_url.h"
#include "content/common/common_param_traits.h"
+#include "content/common/webkit_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_utils.h"
#include "webkit/glue/password_form.h"
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index 3b2a86a..daff691 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -146,6 +146,8 @@
'common/common_glue.cc',
'common/common_message_generator.cc',
'common/common_message_generator.h',
+ 'common/common_param_traits.cc',
+ 'common/common_param_traits.h',
'common/default_plugin.cc',
'common/default_plugin.h',
'common/deprecated/event_sys-inl.h',
diff --git a/chrome/common/autofill_messages.h b/chrome/common/autofill_messages.h
index 519c4929..250ae17 100644
--- a/chrome/common/autofill_messages.h
+++ b/chrome/common/autofill_messages.h
@@ -6,6 +6,7 @@
#include <string>
+#include "content/common/webkit_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "webkit/glue/form_data.h"
#include "webkit/glue/form_field.h"
diff --git a/chrome/common/automation_messages.cc b/chrome/common/automation_messages.cc
index 12736eb..5f27ac7 100644
--- a/chrome/common/automation_messages.cc
+++ b/chrome/common/automation_messages.cc
@@ -2,6 +2,7 @@
// 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"
#include "content/common/common_param_traits.h"
#define IPC_MESSAGE_IMPL
@@ -677,21 +678,4 @@ void ParamTraits<AttachExternalTabParams>::Log(const param_type& p,
l->append(")");
}
-// The traits for these are defined in render_messages.h
-template <>
-struct ParamTraits<ContentSetting> {
- typedef ContentSetting 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<ContentSettingsType> {
- typedef ContentSettingsType 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
diff --git a/chrome/common/automation_messages.h b/chrome/common/automation_messages.h
index 663012b..42d9cc1 100644
--- a/chrome/common/automation_messages.h
+++ b/chrome/common/automation_messages.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -11,6 +11,7 @@
#include "chrome/common/security_style.h"
#include "content/common/common_param_traits.h"
#include "content/common/page_type.h"
+#include "content/common/webkit_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_utils.h"
#include "net/base/host_port_pair.h"
diff --git a/chrome/common/common_param_traits.cc b/chrome/common/common_param_traits.cc
new file mode 100644
index 0000000..4f2a1e4
--- /dev/null
+++ b/chrome/common/common_param_traits.cc
@@ -0,0 +1,101 @@
+// 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"
+
+#include "ipc/ipc_message.h"
+#include "ipc/ipc_message_utils.h"
+
+namespace IPC {
+
+void ParamTraits<ContentSetting>::Write(Message* m, const param_type& p) {
+ m->WriteInt(static_cast<int>(p));
+}
+
+bool ParamTraits<ContentSetting>::Read(const Message* m, void** iter,
+ param_type* p) {
+ int type;
+ if (!m->ReadInt(iter, &type))
+ return false;
+ *p = static_cast<param_type>(type);
+ return true;
+}
+
+void ParamTraits<ContentSetting>::Log(const param_type& p, std::string* l) {
+ std::string content_setting;
+ switch (p) {
+ case CONTENT_SETTING_DEFAULT:
+ content_setting = "CONTENT_SETTING_DEFAULT";
+ break;
+ case CONTENT_SETTING_ALLOW:
+ content_setting = "CONTENT_SETTING_ALLOW";
+ break;
+ case CONTENT_SETTING_BLOCK:
+ content_setting = "CONTENT_SETTING_BLOCK";
+ break;
+ case CONTENT_SETTING_ASK:
+ content_setting = "CONTENT_SETTING_ASK";
+ break;
+ case CONTENT_SETTING_SESSION_ONLY:
+ content_setting = "CONTENT_SETTING_SESSION_ONLY";
+ break;
+ default:
+ content_setting = "UNKNOWN";
+ break;
+ }
+ LogParam(content_setting, l);
+}
+
+void ParamTraits<ContentSettingsType>::Write(Message* m, const param_type& p) {
+ m->WriteInt(static_cast<int>(p));
+}
+
+bool ParamTraits<ContentSettingsType>::Read(const Message* m, void** iter,
+ param_type* p) {
+ int type;
+ if (!m->ReadInt(iter, &type))
+ return false;
+ *p = static_cast<param_type>(type);
+ return true;
+}
+
+void ParamTraits<ContentSettingsType>::Log(const param_type& p,
+ std::string* l) {
+ std::string setting_type;
+ switch (p) {
+ case CONTENT_SETTINGS_TYPE_DEFAULT:
+ setting_type = "CONTENT_SETTINGS_TYPE_DEFAULT";
+ break;
+ case CONTENT_SETTINGS_TYPE_COOKIES:
+ setting_type = "CONTENT_SETTINGS_TYPE_COOKIES";
+ break;
+ case CONTENT_SETTINGS_TYPE_IMAGES:
+ setting_type = "CONTENT_SETTINGS_TYPE_IMAGES";
+ break;
+ case CONTENT_SETTINGS_TYPE_JAVASCRIPT:
+ setting_type = "CONTENT_SETTINGS_TYPE_JAVASCRIPT";
+ break;
+ case CONTENT_SETTINGS_TYPE_PLUGINS:
+ setting_type = "CONTENT_SETTINGS_TYPE_PLUGINS";
+ break;
+ case CONTENT_SETTINGS_TYPE_POPUPS:
+ setting_type = "CONTENT_SETTINGS_TYPE_POPUPS";
+ break;
+ case CONTENT_SETTINGS_TYPE_GEOLOCATION:
+ setting_type = "CONTENT_SETTINGS_TYPE_GEOLOCATION";
+ break;
+ case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
+ setting_type = "CONTENT_SETTINGS_TYPE_NOTIFICATIONS";
+ break;
+ case CONTENT_SETTINGS_TYPE_PRERENDER:
+ setting_type = "CONTENT_SETTINGS_TYPE_PRERENDER";
+ break;
+ default:
+ setting_type = "UNKNOWN";
+ break;
+ }
+ LogParam(setting_type, l);
+}
+
+} // namespace IPC
diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h
new file mode 100644
index 0000000..08a1853
--- /dev/null
+++ b/chrome/common/common_param_traits.h
@@ -0,0 +1,36 @@
+// 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.
+
+#ifndef CHROME_COMMON_COMMON_PARAM_TRAITS_H_
+#define CHROME_COMMON_COMMON_PARAM_TRAITS_H_
+#pragma once
+
+#include <string>
+
+#include "chrome/common/content_settings.h"
+#include "ipc/ipc_param_traits.h"
+
+namespace IPC {
+
+class Message;
+
+template <>
+struct ParamTraits<ContentSetting> {
+ typedef ContentSetting 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<ContentSettingsType> {
+ typedef ContentSettingsType 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
+
+#endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 9301559..21a95fb 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -17,7 +17,7 @@
#include "base/string16.h"
#include "base/values.h"
#include "build/build_config.h"
-#include "chrome/common/content_settings.h"
+#include "chrome/common/common_param_traits.h"
#include "chrome/common/icon_messages.h"
#include "chrome/common/instant_types.h"
#include "chrome/common/nacl_types.h"
@@ -99,8 +99,6 @@ struct ParamTraits<ContentSettings> {
#define IPC_MESSAGE_START ChromeMsgStart
-IPC_ENUM_TRAITS(ContentSetting)
-IPC_ENUM_TRAITS(ContentSettingsType)
IPC_ENUM_TRAITS(InstantCompleteBehavior)
IPC_ENUM_TRAITS(prerender::PrerenderCancellationReason)
IPC_ENUM_TRAITS(search_provider::OSDDType)
diff --git a/chrome/renderer/blocked_plugin.cc b/chrome/renderer/blocked_plugin.cc
index 5e6c883..6917f21 100644
--- a/chrome/renderer/blocked_plugin.cc
+++ b/chrome/renderer/blocked_plugin.cc
@@ -16,6 +16,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebMenuItemInfo.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h"