Browse Source

Enable official build (#11847)

* Updated libchromiumcontent submodule

* Use same LTO settings as libcc

* Use whole program optimization, favour speed, remove redundancies

* Don't use variable template as it confuses LTCG

* Use lld and ThinLTO only on limited set of architectures
Aleš Pergl 7 years ago
parent
commit
efb44050db

+ 20 - 4
brightray/brightray.gypi

@@ -231,10 +231,8 @@
         'msvs_settings': {
           'VCCLCompilerTool': {
             'RuntimeLibrary': '2',  # /MD (nondebug DLL)
-            # 1, optimizeMinSpace, Minimize Size (/O1)
-            'Optimization': '1',
-            # 2, favorSize - Favor small code (/Os)
-            'FavorSizeOrSpeed': '2',
+            'Optimization': '2',  # /O2
+            'WholeProgramOptimization': 'true',  # /GL
             # See http://msdn.microsoft.com/en-us/library/47238hez(VS.71).aspx
             'InlineFunctionExpansion': '2',  # 2 = max
             # See http://msdn.microsoft.com/en-us/library/2kxx5t2c(v=vs.80).aspx
@@ -246,6 +244,9 @@
             # "/Oy /Oy-" and warnings about overriding.
             'AdditionalOptions': ['/Oy-', '/d2guard4'],
           },
+          'VCLibrarianTool': {
+            'LinkTimeCodeGeneration': 'true',  # /LTCG
+          },
           'VCLinkerTool': {
             # Control Flow Guard is a security feature in Windows
             # 8.1 and higher designed to prevent exploitation of
@@ -256,6 +257,9 @@
             'AdditionalOptions': ['/guard:cf'],
             # Turn off incremental linking to save binary size.
             'LinkIncremental': '1',  # /INCREMENTAL:NO
+            'LinkTimeCodeGeneration': '1',  # /LTCG
+            'OptimizeReferences': 2,  # /OPT:REF
+            'EnableCOMDATFolding': 2,  # /OPT:ICF
           },
         },
         'conditions': [
@@ -280,6 +284,18 @@
               '-Wl,--gc-sections',
             ],
           }],  # OS=="linux"
+          ['OS=="linux" and target_arch in ["ia32", "x64", "arm64"]', {
+            'cflags': [
+              '-flto=thin',
+            ],
+            'ldflags': [
+              '-flto=thin',
+              '-fuse-ld=lld',  # Chromium Clang uses lld for doing LTO
+              '-Wl,--lto-O0',  # this could be removed in future; see https://codereview.chromium.org/2939923004
+              '-Wl,-mllvm,-function-sections',
+              '-Wl,-mllvm,-data-sections',
+            ],
+          }],
         ],
       },  # Release_Base
       'conditions': [

+ 3 - 3
brightray/browser/win/win32_desktop_notifications/desktop_notification_controller.cc

@@ -174,7 +174,7 @@ void DesktopNotificationController::AnimateAll() {
         if (SystemParametersInfo(SPI_GETWORKAREA, 0, &work_area, 0)) {
             ScreenMetrics metrics;
             POINT origin = { work_area.right,
-                             work_area.bottom - metrics.Y(toast_margin_<int>) };
+                             work_area.bottom - metrics.Y(toast_margin_) };
 
             auto hdwp =
                 BeginDeferWindowPos(static_cast<int>(instances_.size()));
@@ -231,7 +231,7 @@ void DesktopNotificationController::AnimateAll() {
     // Set new toast positions
     if (!instances_.empty()) {
         ScreenMetrics metrics;
-        auto margin = metrics.Y(toast_margin_<int>);
+        auto margin = metrics.Y(toast_margin_);
 
         int target_pos = 0;
         for (auto&& inst : instances_) {
@@ -305,7 +305,7 @@ void DesktopNotificationController::CreateToast(NotificationLink&& data) {
             auto toast = Toast::Get(item.hwnd);
             toast_pos = toast->GetVerticalPosition() +
                         toast->GetHeight() +
-                        scr.Y(toast_margin_<int>);
+                        scr.Y(toast_margin_);
         }
 
         instances_.push_back({ hwnd, move(data) });

+ 1 - 2
brightray/browser/win/win32_desktop_notifications/desktop_notification_controller.h

@@ -36,8 +36,7 @@ class DesktopNotificationController {
         TimerID_Animate = 1
     };
 
-    template<typename T>
-    static constexpr T toast_margin_ = 20;
+    static constexpr int toast_margin_ = 20;
 
     // Wrapper around `NotificationData` which makes sure that
     // the `controller` member is cleared when the controller object

+ 1 - 1
vendor/libchromiumcontent

@@ -1 +1 @@
-Subproject commit 2bdad005879d7557731f85c626b46bd3ebe6e3a9
+Subproject commit 69984b41aaae78be9186ba880b84cf1e75d379a2