Bug 1188045 - Part 1: Move the definition of sandboxTarget::Instance() out-of-line; r=bobowen,glandium
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 08 Feb 2016 16:30:54 -0500
changeset 321378 625bfa7b1c88aefa55cae25768d3349e0f8ee26e
parent 321377 b00f72a9e515710145fbce0616ae8d1ab0b09245
child 321379 3a72236db31ef46050582ebc733c9052c1dfa496
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbobowen, glandium
bugs1188045
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1188045 - Part 1: Move the definition of sandboxTarget::Instance() out-of-line; r=bobowen,glandium This is required so that delay-loading xul.dll works with clang-cl.
security/sandbox/win/src/sandboxtarget/moz.build
security/sandbox/win/src/sandboxtarget/sandboxTarget.cpp
security/sandbox/win/src/sandboxtarget/sandboxTarget.h
--- a/security/sandbox/win/src/sandboxtarget/moz.build
+++ b/security/sandbox/win/src/sandboxtarget/moz.build
@@ -2,8 +2,19 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 EXPORTS.mozilla += [
     'sandboxTarget.h',
 ]
+
+SOURCES += [
+    'sandboxTarget.cpp',
+]
+
+LOCAL_INCLUDES += [
+    '/security/sandbox/chromium',
+    '/security/sandbox/chromium-shim',
+]
+
+FINAL_LIBRARY = 'xul'
new file mode 100644
--- /dev/null
+++ b/security/sandbox/win/src/sandboxtarget/sandboxTarget.cpp
@@ -0,0 +1,21 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#define TARGET_SANDBOX_EXPORTS
+#include "sandboxTarget.h"
+
+namespace mozilla {
+
+// We need to define this function out of line so that clang-cl doesn't inline
+// it.
+/* static */ SandboxTarget*
+SandboxTarget::Instance()
+{
+  static SandboxTarget sb;
+  return &sb;
+}
+
+}
--- a/security/sandbox/win/src/sandboxtarget/sandboxTarget.h
+++ b/security/sandbox/win/src/sandboxtarget/sandboxTarget.h
@@ -1,19 +1,20 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __SECURITY_SANDBOX_SANDBOXTARGET_H__
 #define __SECURITY_SANDBOX_SANDBOXTARGET_H__
 
 #include <windows.h>
 
+#include "mozilla/Assertions.h"
 #include "base/MissingBasicTypes.h"
 #include "sandbox/win/src/sandbox.h"
 #include "sandbox/win/src/target_services.h"
 
 #ifdef TARGET_SANDBOX_EXPORTS
 #define TARGET_SANDBOX_EXPORT __declspec(dllexport)
 #else
 #define TARGET_SANDBOX_EXPORT __declspec(dllimport)
@@ -22,21 +23,17 @@ namespace mozilla {
 
 
 class TARGET_SANDBOX_EXPORT SandboxTarget
 {
 public:
   /**
    * Obtains a pointer to the singleton instance
    */
-  static SandboxTarget* Instance()
-  {
-    static SandboxTarget sb;
-    return &sb;
-  }
+  static SandboxTarget* Instance();
 
   /**
    * Used by the application to pass in the target services that provide certain
    * functions to the sandboxed code.
    * The target services must already be initialized.
    *
    * @param aTargetServices The target services that will be used
    */