forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved ParamTraits specializations that depend on WebKit out of conten…
…t/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
- Loading branch information
grt@chromium.org
committed
Apr 15, 2011
1 parent
ea2a7b9
commit 79d68c6
Showing
20 changed files
with
768 additions
and
599 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.