Bug 1277359 - Add chrome-only navigator.cpu_sse2 api. r?smaug draft
authorRalph Giles <giles@mozilla.com>
Fri, 07 Oct 2016 16:23:39 -0700
changeset 422593 815ad4154d728f5d66c192af3ff12ac20701922c
parent 422256 49fe455cac957808ed4a5d1685c3a1938dac1d31
child 422594 2dc4f0bc5f2f17862d4599b0a574957e41b32021
push id31755
push userbmo:giles@thaumas.net
push dateFri, 07 Oct 2016 23:28:04 +0000
reviewerssmaug
bugs1277359
milestone52.0a1
Bug 1277359 - Add chrome-only navigator.cpu_sse2 api. r?smaug Make the host's support for SSE2 instructions available to javascript so we can report that status in update pings. MozReview-Commit-ID: FhWPjLxKRZy
dom/base/Navigator.cpp
dom/base/Navigator.h
dom/webidl/Navigator.webidl
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -808,16 +808,22 @@ Navigator::HardwareConcurrency()
   workers::RuntimeService* rts = workers::RuntimeService::GetOrCreateService();
   if (!rts) {
     return 1;
   }
 
   return rts->ClampedHardwareConcurrency();
 }
 
+bool
+Navigator::Cpu_sse2()
+{
+  return mozilla::supports_sse2();
+}
+
 void
 Navigator::RefreshMIMEArray()
 {
   if (mMimeTypes) {
     mMimeTypes->Refresh();
   }
 }
 
--- a/dom/base/Navigator.h
+++ b/dom/base/Navigator.h
@@ -202,16 +202,17 @@ public:
   bool CookieEnabled();
   void GetBuildID(nsString& aBuildID, ErrorResult& aRv)
   {
     aRv = GetBuildID(aBuildID);
   }
   PowerManager* GetMozPower(ErrorResult& aRv);
   bool JavaEnabled(ErrorResult& aRv);
   uint64_t HardwareConcurrency();
+  bool Cpu_sse2();
   bool TaintEnabled()
   {
     return false;
   }
   void AddIdleObserver(MozIdleObserver& aObserver, ErrorResult& aRv);
   void RemoveIdleObserver(MozIdleObserver& aObserver, ErrorResult& aRv);
   already_AddRefed<WakeLock> RequestWakeLock(const nsAString &aTopic,
                                              ErrorResult& aRv);
--- a/dom/webidl/Navigator.webidl
+++ b/dom/webidl/Navigator.webidl
@@ -435,8 +435,13 @@ partial interface Navigator {
   readonly attribute boolean mozE10sEnabled;
 };
 #endif
 
 [NoInterfaceObject, Exposed=(Window,Worker)]
 interface NavigatorConcurrentHardware {
   readonly attribute unsigned long long hardwareConcurrency;
 };
+
+partial interface Navigator {
+  [ChromeOnly]
+  readonly attribute boolean cpu_sse2;
+};