summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/browser/web_contents/web_contents_impl.cc3
-rw-r--r--content/common/view_messages.h1
-rw-r--r--ppapi/api/private/ppb_flash.idl7
-rw-r--r--ppapi/c/private/ppb_flash.h8
-rw-r--r--ppapi/proxy/ppapi_messages.h1
-rw-r--r--ppapi/proxy/ppb_flash_proxy.cc2
-rw-r--r--ppapi/shared_impl/ppapi_preferences.cc2
-rw-r--r--ppapi/shared_impl/ppapi_preferences.h2
-rw-r--r--ppapi/tests/test_flash.cc4
-rw-r--r--webkit/glue/webpreferences.cc3
-rw-r--r--webkit/glue/webpreferences.h1
11 files changed, 29 insertions, 5 deletions
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index f00fd5d..6b345d2 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -12,6 +12,7 @@
#include "base/string16.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/sys_info.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "content/browser/browser_plugin/old/browser_plugin_host.h"
@@ -582,6 +583,8 @@ WebPreferences WebContentsImpl::GetWebkitPrefs(RenderViewHost* rvh,
prefs.fixed_position_creates_stacking_context =
command_line.HasSwitch(switches::kFixedPositionCreatesStackingContext);
+ prefs.number_of_cpu_cores = base::SysInfo::NumberOfProcessors();
+
content::GetContentClient()->browser()->OverrideWebkitPrefs(rvh, url, &prefs);
return prefs;
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index 49fef05..5d4d202 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -219,6 +219,7 @@ IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebPreferences)
IPC_STRUCT_TRAITS_MEMBER(max_untiled_layer_height)
IPC_STRUCT_TRAITS_MEMBER(fixed_position_creates_stacking_context)
IPC_STRUCT_TRAITS_MEMBER(sync_xhr_in_documents_enabled)
+ IPC_STRUCT_TRAITS_MEMBER(number_of_cpu_cores)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(WebMenuItem)
diff --git a/ppapi/api/private/ppb_flash.idl b/ppapi/api/private/ppb_flash.idl
index 4251a4f5..f6c5c7a 100644
--- a/ppapi/api/private/ppb_flash.idl
+++ b/ppapi/api/private/ppb_flash.idl
@@ -56,7 +56,12 @@ enum PP_FlashSetting {
*
* Returns an undefined PP_Var on invalid instance.
*/
- PP_FLASHSETTING_LANGUAGE = 4
+ PP_FLASHSETTING_LANGUAGE = 4,
+
+ /**
+ * Specifies the number of CPU cores that are present on the system.
+ */
+ PP_FLASHSETTING_NUMCORES = 5
};
/**
diff --git a/ppapi/c/private/ppb_flash.h b/ppapi/c/private/ppb_flash.h
index 94b4f85..fa11b80 100644
--- a/ppapi/c/private/ppb_flash.h
+++ b/ppapi/c/private/ppb_flash.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_flash.idl modified Fri Jun 8 15:55:46 2012. */
+/* From private/ppb_flash.idl modified Thu Jun 14 16:38:53 2012. */
#ifndef PPAPI_C_PRIVATE_PPB_FLASH_H_
#define PPAPI_C_PRIVATE_PPB_FLASH_H_
@@ -75,7 +75,11 @@ typedef enum {
*
* Returns an undefined PP_Var on invalid instance.
*/
- PP_FLASHSETTING_LANGUAGE = 4
+ PP_FLASHSETTING_LANGUAGE = 4,
+ /**
+ * Specifies the number of CPU cores that are present on the system.
+ */
+ PP_FLASHSETTING_NUMCORES = 5
} PP_FlashSetting;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashSetting, 4);
/**
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index cd54ae9..07c939c 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -152,6 +152,7 @@ IPC_STRUCT_TRAITS_BEGIN(ppapi::Preferences)
IPC_STRUCT_TRAITS_MEMBER(sans_serif_font_family_map)
IPC_STRUCT_TRAITS_MEMBER(default_font_size)
IPC_STRUCT_TRAITS_MEMBER(default_fixed_font_size)
+ IPC_STRUCT_TRAITS_MEMBER(number_of_cpu_cores)
IPC_STRUCT_TRAITS_MEMBER(is_3d_supported)
IPC_STRUCT_TRAITS_MEMBER(is_stage3d_supported)
IPC_STRUCT_TRAITS_END()
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc
index 28444e9..0033a10 100644
--- a/ppapi/proxy/ppb_flash_proxy.cc
+++ b/ppapi/proxy/ppb_flash_proxy.cc
@@ -301,6 +301,8 @@ PP_Var PPB_Flash_Proxy::GetSetting(PP_Instance instance,
case PP_FLASHSETTING_LANGUAGE:
return StringVar::StringToPPVar(
PluginGlobals::Get()->plugin_proxy_delegate()->GetUILanguage());
+ case PP_FLASHSETTING_NUMCORES:
+ return PP_MakeInt32(plugin_dispatcher->preferences().number_of_cpu_cores);
}
return PP_MakeUndefined();
}
diff --git a/ppapi/shared_impl/ppapi_preferences.cc b/ppapi/shared_impl/ppapi_preferences.cc
index 98ba1eb..3fd7731 100644
--- a/ppapi/shared_impl/ppapi_preferences.cc
+++ b/ppapi/shared_impl/ppapi_preferences.cc
@@ -9,6 +9,7 @@ namespace ppapi {
Preferences::Preferences()
: default_font_size(0),
default_fixed_font_size(0),
+ number_of_cpu_cores(0),
is_3d_supported(true),
is_stage3d_supported(false) {
}
@@ -20,6 +21,7 @@ Preferences::Preferences(const webkit_glue::WebPreferences& prefs)
sans_serif_font_family_map(prefs.sans_serif_font_family_map),
default_font_size(prefs.default_font_size),
default_fixed_font_size(prefs.default_fixed_font_size),
+ number_of_cpu_cores(prefs.number_of_cpu_cores),
is_3d_supported(prefs.flash_3d_enabled),
is_stage3d_supported(prefs.flash_stage3d_enabled) {
}
diff --git a/ppapi/shared_impl/ppapi_preferences.h b/ppapi/shared_impl/ppapi_preferences.h
index cd0e0bb..4b8356f 100644
--- a/ppapi/shared_impl/ppapi_preferences.h
+++ b/ppapi/shared_impl/ppapi_preferences.h
@@ -26,7 +26,7 @@ struct PPAPI_SHARED_EXPORT Preferences {
webkit_glue::WebPreferences::ScriptFontFamilyMap sans_serif_font_family_map;
int default_font_size;
int default_fixed_font_size;
-
+ int number_of_cpu_cores;
bool is_3d_supported;
bool is_stage3d_supported;
};
diff --git a/ppapi/tests/test_flash.cc b/ppapi/tests/test_flash.cc
index 3deba37..e9964e2 100644
--- a/ppapi/tests/test_flash.cc
+++ b/ppapi/tests/test_flash.cc
@@ -156,6 +156,10 @@ std::string TestFlash::TestGetSetting() {
// This may "fail" if 3d isn't enabled.
ASSERT_TRUE(is_stage3denabled.is_bool() ||
(is_stage3denabled.is_undefined() && !is_3denabled.AsBool()));
+
+ Var num_cores(pp::PASS_REF, flash_interface_->GetSetting(
+ instance_->pp_instance(), PP_FLASHSETTING_NUMCORES));
+ ASSERT_TRUE(num_cores.is_int() && num_cores.AsInt() > 0);
}
// Invalid instance cases.
diff --git a/webkit/glue/webpreferences.cc b/webkit/glue/webpreferences.cc
index 4492c06..a4405b0 100644
--- a/webkit/glue/webpreferences.cc
+++ b/webkit/glue/webpreferences.cc
@@ -115,7 +115,8 @@ WebPreferences::WebPreferences()
max_untiled_layer_width(512),
max_untiled_layer_height(512),
fixed_position_creates_stacking_context(false),
- sync_xhr_in_documents_enabled(true) {
+ sync_xhr_in_documents_enabled(true),
+ number_of_cpu_cores(1) {
standard_font_family_map[kCommonScript] =
ASCIIToUTF16("Times New Roman");
fixed_font_family_map[kCommonScript] =
diff --git a/webkit/glue/webpreferences.h b/webkit/glue/webpreferences.h
index a992b25..766180a 100644
--- a/webkit/glue/webpreferences.h
+++ b/webkit/glue/webpreferences.h
@@ -134,6 +134,7 @@ struct WEBKIT_GLUE_EXPORT WebPreferences {
int max_untiled_layer_height;
bool fixed_position_creates_stacking_context;
bool sync_xhr_in_documents_enabled;
+ int number_of_cpu_cores;
// 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