bug 938025 - part 1 - get rid of some static constructors r=bz r=bjacob
--- a/content/html/content/src/HTMLTrackElement.cpp
+++ b/content/html/content/src/HTMLTrackElement.cpp
@@ -57,17 +57,17 @@ NS_NewHTMLTrackElement(already_AddRefed<
return new mozilla::dom::HTMLTrackElement(aNodeInfo);
}
namespace mozilla {
namespace dom {
// The default value for kKindTable is "subtitles"
-static const char* kKindTableDefaultString = kKindTable->tag;
+static MOZ_CONSTEXPR const char* kKindTableDefaultString = kKindTable->tag;
/** HTMLTrackElement */
HTMLTrackElement::HTMLTrackElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
#ifdef PR_LOGGING
if (!gTrackElementLog) {
gTrackElementLog = PR_NewLogModule("nsTrackElement");
--- a/content/html/content/src/HTMLTrackElement.h
+++ b/content/html/content/src/HTMLTrackElement.h
@@ -17,17 +17,17 @@
#include "nsIDOMHTMLElement.h"
#include "nsIDOMEventTarget.h"
#include "nsIHttpChannel.h"
namespace mozilla {
namespace dom {
// Map html attribute string values to TextTrackKind enums.
-static const nsAttrValue::EnumTable kKindTable[] = {
+static MOZ_CONSTEXPR nsAttrValue::EnumTable kKindTable[] = {
{ "subtitles", static_cast<int16_t>(TextTrackKind::Subtitles) },
{ "captions", static_cast<int16_t>(TextTrackKind::Captions) },
{ "descriptions", static_cast<int16_t>(TextTrackKind::Descriptions) },
{ "chapters", static_cast<int16_t>(TextTrackKind::Chapters) },
{ "metadata", static_cast<int16_t>(TextTrackKind::Metadata) },
{ 0 }
};
--- a/gfx/2d/BasePoint.h
+++ b/gfx/2d/BasePoint.h
@@ -1,31 +1,33 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* 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_GFX_BASEPOINT_H_
#define MOZILLA_GFX_BASEPOINT_H_
+#include "mozilla/Attributes.h"
+
namespace mozilla {
namespace gfx {
/**
* Do not use this class directly. Subclass it, pass that subclass as the
* Sub parameter, and only use that subclass. This allows methods to safely
* cast 'this' to 'Sub*'.
*/
template <class T, class Sub>
struct BasePoint {
T x, y;
// Constructors
- BasePoint() : x(0), y(0) {}
- BasePoint(T aX, T aY) : x(aX), y(aY) {}
+ MOZ_CONSTEXPR BasePoint() : x(0), y(0) {}
+ MOZ_CONSTEXPR BasePoint(T aX, T aY) : x(aX), y(aY) {}
void MoveTo(T aX, T aY) { x = aX; y = aY; }
void MoveBy(T aDx, T aDy) { x += aDx; y += aDy; }
// Note that '=' isn't defined so we'll get the
// compiler generated default assignment operator
bool operator==(const Sub& aPoint) const {
--- a/gfx/2d/Point.h
+++ b/gfx/2d/Point.h
@@ -1,16 +1,17 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* 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_GFX_POINT_H_
#define MOZILLA_GFX_POINT_H_
+#include "mozilla/Attributes.h"
#include "Types.h"
#include "BasePoint.h"
#include "BaseSize.h"
#include <cmath>
namespace mozilla {
namespace gfx {
@@ -20,17 +21,17 @@ struct UnknownUnits {};
template<class units>
struct IntPointTyped :
public BasePoint< int32_t, IntPointTyped<units> >,
public units {
typedef BasePoint< int32_t, IntPointTyped<units> > Super;
IntPointTyped() : Super() {}
- IntPointTyped(int32_t aX, int32_t aY) : Super(aX, aY) {}
+ MOZ_CONSTEXPR IntPointTyped(int32_t aX, int32_t aY) : Super(aX, aY) {}
// XXX When all of the code is ported, the following functions to convert to and from
// unknown types should be removed.
static IntPointTyped<units> FromUnknownPoint(const IntPointTyped<UnknownUnits>& aPoint) {
return IntPointTyped<units>(aPoint.x, aPoint.y);
}
--- a/gfx/layers/FrameMetrics.h
+++ b/gfx/layers/FrameMetrics.h
@@ -31,17 +31,17 @@ typedef gfx::ScaleFactor<ParentLayerPixe
* useful for shadow layers, because the metrics values are updated
* atomically with new pixels.
*/
struct FrameMetrics {
public:
// We use IDs to identify frames across processes.
typedef uint64_t ViewID;
static const ViewID NULL_SCROLL_ID; // This container layer does not scroll.
- static const ViewID START_SCROLL_ID; // This is the ID that scrolling subframes
+ static const ViewID START_SCROLL_ID = 2; // This is the ID that scrolling subframes
// will begin at.
FrameMetrics()
: mCompositionBounds(0, 0, 0, 0)
, mDisplayPort(0, 0, 0, 0)
, mCriticalDisplayPort(0, 0, 0, 0)
, mViewport(0, 0, 0, 0)
, mScrollOffset(0, 0)
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -32,17 +32,16 @@
#include "nsPrintfCString.h" // for nsPrintfCString
#include "nsStyleStruct.h" // for nsTimingFunction, etc
using namespace mozilla::layers;
using namespace mozilla::gfx;
typedef FrameMetrics::ViewID ViewID;
const ViewID FrameMetrics::NULL_SCROLL_ID = 0;
-const ViewID FrameMetrics::START_SCROLL_ID = 1;
uint8_t gLayerManagerLayerBuilder;
FILE*
FILEOrDefault(FILE* aFile)
{
return aFile ? aFile : stderr;
}
--- a/gfx/thebes/gfxColor.h
+++ b/gfx/thebes/gfxColor.h
@@ -120,17 +120,17 @@ struct gfxRGBA {
PACKED_XRGB
};
gfxRGBA() { }
/**
* Intialize this color using explicit red, green, blue and alpha
* values.
*/
- gfxRGBA(gfxFloat _r, gfxFloat _g, gfxFloat _b, gfxFloat _a=1.0) : r(_r), g(_g), b(_b), a(_a) {}
+ MOZ_CONSTEXPR gfxRGBA(gfxFloat _r, gfxFloat _g, gfxFloat _b, gfxFloat _a=1.0) : r(_r), g(_g), b(_b), a(_a) {}
/**
* Initialize this color from a packed 32-bit color.
* The color value is interpreted based on colorType;
* all values use the native platform endianness.
*
* Resulting gfxRGBA stores non-premultiplied data.
*
--- a/storage/src/mozStorageAsyncStatement.cpp
+++ b/storage/src/mozStorageAsyncStatement.cpp
@@ -44,17 +44,19 @@ NS_IMPL_CI_INTERFACE_GETTER4(
, mozIStorageBaseStatement
, mozIStorageBindingParams
, mozilla::storage::StorageBaseStatementInternal
)
class AsyncStatementClassInfo : public nsIClassInfo
{
public:
- NS_DECL_ISUPPORTS
+ MOZ_CONSTEXPR AsyncStatementClassInfo() {}
+
+ NS_DECL_ISUPPORTS_INHERITED
NS_IMETHODIMP
GetInterfaces(uint32_t *_count, nsIID ***_array)
{
return NS_CI_INTERFACE_GETTER_NAME(AsyncStatement)(_count, _array);
}
NS_IMETHODIMP
--- a/storage/src/mozStorageStatement.cpp
+++ b/storage/src/mozStorageStatement.cpp
@@ -46,17 +46,19 @@ NS_IMPL_CI_INTERFACE_GETTER5(
mozIStorageBindingParams,
mozIStorageValueArray,
mozilla::storage::StorageBaseStatementInternal
)
class StatementClassInfo : public nsIClassInfo
{
public:
- NS_DECL_ISUPPORTS
+ MOZ_CONSTEXPR StatementClassInfo() {}
+
+ NS_DECL_ISUPPORTS_INHERITED
NS_IMETHODIMP
GetInterfaces(uint32_t *_count, nsIID ***_array)
{
return NS_CI_INTERFACE_GETTER_NAME(Statement)(_count, _array);
}
NS_IMETHODIMP
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -582,17 +582,17 @@ class nsXULAppInfo : public nsIXULAppInf
#endif
#ifdef MOZ_CRASHREPORTER
public nsICrashReporter,
#endif
public nsIXULRuntime
{
public:
- nsXULAppInfo() {}
+ MOZ_CONSTEXPR nsXULAppInfo() {}
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIXULAPPINFO
NS_DECL_NSIXULRUNTIME
#ifdef MOZ_CRASHREPORTER
NS_DECL_NSICRASHREPORTER
#endif
#ifdef XP_WIN
NS_DECL_NSIWINAPPHELPER