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.
This commit is contained in:
Bobby Holley 2016-02-25 18:11:43 -08:00
Родитель 27c94bb979
Коммит 90a86c1a2e
3 изменённых файлов: 30 добавлений и 12 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -9,7 +9,7 @@
#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"
@ -17,17 +17,6 @@
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.
*/

Просмотреть файл

@ -90,6 +90,7 @@ EXPORTS.mozilla += [
'LayerAnimationInfo.h',
'RuleNodeCacheConditions.h',
'RuleProcessorCache.h',
'ServoBindingHelpers.h',
'ServoBindings.h',
'ServoStyleSet.h',
'ServoStyleSheet.h',