Bug 1251496 - Hoist existing RefPtrTraits into a ServoBindingHelpers.h. r=heycam
authorBobby Holley <bobbyholley@gmail.com>
Thu, 25 Feb 2016 18:11:43 -0800
changeset 322299 7d1baa75f591451a5df54c7f9ea1bc0fece43669
parent 322298 f37626eba5c683d42aaa510b55ad7e24f490063d
child 322300 49904442faec1c1f4ca91cbbea0e8ebcfb2a5b6a
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)
reviewersheycam
bugs1251496
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 1251496 - Hoist existing RefPtrTraits into a ServoBindingHelpers.h. r=heycam I think we're going to have a fair number of things like this, so I'd rather put them all in one place, rather that defining them in the header for the first consumer that uses the type.
layout/style/ServoBindingHelpers.h
layout/style/ServoStyleSheet.h
layout/style/moz.build
new file mode 100644
--- /dev/null
+++ b/layout/style/ServoBindingHelpers.h
@@ -0,0 +1,28 @@
+/* -*- 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/. */
+
+#ifndef mozilla_ServoBindingHelpers_h
+#define mozilla_ServoBindingHelpers_h
+
+#include "mozilla/RefPtr.h"
+#include "mozilla/ServoBindings.h"
+
+namespace mozilla {
+
+template<>
+struct RefPtrTraits<RawServoStyleSheet>
+{
+  static void AddRef(RawServoStyleSheet* aPtr) {
+    MOZ_CRASH("stylo: not implemented");
+  }
+  static void Release(RawServoStyleSheet* aPtr) {
+    Servo_ReleaseStylesheet(aPtr);
+  }
+};
+
+} // namespace mozilla
+
+#endif // mozilla_ServoBindingHelpers_h
--- a/layout/style/ServoStyleSheet.h
+++ b/layout/style/ServoStyleSheet.h
@@ -4,35 +4,24 @@
  * 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 mozilla_ServoStyleSheet_h
 #define mozilla_ServoStyleSheet_h
 
 #include "mozilla/dom/SRIMetadata.h"
 #include "mozilla/RefPtr.h"
-#include "mozilla/ServoBindings.h"
+#include "mozilla/ServoBindingHelpers.h"
 #include "mozilla/StyleSheet.h"
 #include "mozilla/StyleSheetHandle.h"
 #include "mozilla/StyleSheetInfo.h"
 #include "nsStringFwd.h"
 
 namespace mozilla {
 
-template<>
-struct RefPtrTraits<RawServoStyleSheet>
-{
-  static void AddRef(RawServoStyleSheet* aPtr) {
-    MOZ_CRASH("stylo: not implemented");
-  }
-  static void Release(RawServoStyleSheet* aPtr) {
-    Servo_ReleaseStylesheet(aPtr);
-  }
-};
-
 /**
  * CSS style sheet object that is a wrapper for a Servo Stylesheet.
  */
 class ServoStyleSheet : public StyleSheet
                       , public StyleSheetInfo
 {
 public:
   ServoStyleSheet(CORSMode aCORSMode,
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -85,16 +85,17 @@ EXPORTS.mozilla += [
     'CSSVariableDeclarations.h',
     'CSSVariableResolver.h',
     'CSSVariableValues.h',
     'HandleRefPtr.h',
     'IncrementalClearCOMRuleArray.h',
     'LayerAnimationInfo.h',
     'RuleNodeCacheConditions.h',
     'RuleProcessorCache.h',
+    'ServoBindingHelpers.h',
     'ServoBindings.h',
     'ServoStyleSet.h',
     'ServoStyleSheet.h',
     'SheetType.h',
     'StyleAnimationValue.h',
     'StyleBackendType.h',
     'StyleSetHandle.h',
     'StyleSetHandleInlines.h',