Commit f98f509f authored by vangelis@chromium.org's avatar vangelis@chromium.org

Add command line flags for compositor's default tile size and

max untiled layer size.
BUG=128740
Review URL: https://chromiumcodereview.appspot.com/10386213

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137983 0039d316-1c4b-4281-b951-d872f2087c98
parent 24f9d02c
......@@ -220,6 +220,18 @@ void MakeNavigateParams(const NavigationEntryImpl& entry,
delegate->AddNavigationHeaders(params->url, &params->extra_headers);
}
int GetSwitchValueAsInt(
const CommandLine& command_line,
const std::string& switch_string,
int min_value) {
std::string string_value = command_line.GetSwitchValueASCII(switch_string);
int int_value;
if (base::StringToInt(string_value, &int_value))
return std::max(min_value, int_value);
else
return min_value;
}
} // namespace
namespace content {
......@@ -515,6 +527,19 @@ WebPreferences WebContentsImpl::GetWebkitPrefs(RenderViewHost* rvh,
}
#endif
if (command_line.HasSwitch(switches::kDefaultTileWidth))
prefs.default_tile_width =
GetSwitchValueAsInt(command_line, switches::kDefaultTileWidth, 1);
if (command_line.HasSwitch(switches::kDefaultTileHeight))
prefs.default_tile_height =
GetSwitchValueAsInt(command_line, switches::kDefaultTileHeight, 1);
if (command_line.HasSwitch(switches::kMaxUntiledLayerWidth))
prefs.max_untiled_layer_width =
GetSwitchValueAsInt(command_line, switches::kMaxUntiledLayerWidth, 1);
if (command_line.HasSwitch(switches::kMaxUntiledLayerHeight))
prefs.max_untiled_layer_height =
GetSwitchValueAsInt(command_line, switches::kMaxUntiledLayerHeight, 1);
content::GetContentClient()->browser()->OverrideWebkitPrefs(rvh, url, &prefs);
return prefs;
......
......@@ -205,6 +205,10 @@ IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebPreferences)
IPC_STRUCT_TRAITS_MEMBER(password_echo_enabled)
IPC_STRUCT_TRAITS_MEMBER(css_regions_enabled)
IPC_STRUCT_TRAITS_MEMBER(css_shaders_enabled)
IPC_STRUCT_TRAITS_MEMBER(default_tile_width)
IPC_STRUCT_TRAITS_MEMBER(default_tile_height)
IPC_STRUCT_TRAITS_MEMBER(max_untiled_layer_width)
IPC_STRUCT_TRAITS_MEMBER(max_untiled_layer_height)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(WebMenuItem)
......
......@@ -632,4 +632,12 @@ extern const char kFlingTapSuppressMaxGap[] = "fling-tap-suppress-max-gap";
extern const char kTestCompositor[] = "test-compositor";
#endif
// Sets the tile size used by composited layers.
const char kDefaultTileWidth[] = "default-tile-width";
const char kDefaultTileHeight[] = "default-tile-height";
// Sets the width and height above which a composited layer will get tiled.
const char kMaxUntiledLayerWidth[] = "max-untiled-layer-width";
const char kMaxUntiledLayerHeight[] = "max-untiled-layer-height";
} // namespace switches
......@@ -182,6 +182,10 @@ CONTENT_EXPORT extern const char kWorkerProcess[];
CONTENT_EXPORT extern const char kZygoteCmdPrefix[];
CONTENT_EXPORT extern const char kZygoteProcess[];
CONTENT_EXPORT extern const char kDisableSoftwareRasterizer[];
extern const char kDefaultTileWidth[];
extern const char kDefaultTileHeight[];
extern const char kMaxUntiledLayerWidth[];
extern const char kMaxUntiledLayerHeight[];
extern const char kEnableVisualWordMovement[];
......
......@@ -11,6 +11,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
......@@ -20,6 +21,7 @@
using WebKit::WebNetworkStateNotifier;
using WebKit::WebRuntimeFeatures;
using WebKit::WebSettings;
using WebKit::WebSize;
using WebKit::WebString;
using WebKit::WebURL;
using WebKit::WebView;
......@@ -102,7 +104,11 @@ WebPreferences::WebPreferences()
visual_word_movement_enabled(false),
per_tile_painting_enabled(false),
css_regions_enabled(false),
css_shaders_enabled(false) {
css_shaders_enabled(false),
default_tile_width(256),
default_tile_height(256),
max_untiled_layer_width(512),
max_untiled_layer_height(512) {
standard_font_family_map[kCommonScript] =
ASCIIToUTF16("Times New Roman");
fixed_font_family_map[kCommonScript] =
......@@ -354,6 +360,11 @@ void WebPreferences::Apply(WebView* web_view) const {
settings->setExperimentalCSSRegionsEnabled(css_regions_enabled);
settings->setExperimentalCSSCustomFilterEnabled(css_shaders_enabled);
settings->setDefaultTileSize(
WebSize(default_tile_width, default_tile_height));
settings->setMaxUntiledLayerSize(
WebSize(max_untiled_layer_width, max_untiled_layer_height));
WebNetworkStateNotifier::setOnLine(is_online);
}
......
......@@ -121,6 +121,11 @@ struct WEBKIT_GLUE_EXPORT WebPreferences {
bool per_tile_painting_enabled;
bool css_regions_enabled;
bool css_shaders_enabled;
int default_tile_width;
int default_tile_height;
int max_untiled_layer_width;
int max_untiled_layer_height;
// We try to keep the default values the same as the default values in
// chrome, except for the cases where it would require lots of extra work for
// the embedder to use the same default value.
......
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