mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1374900. Make our low level serialization functions generic over the type of stream. r=lsalzman
This commit is contained in:
parent
23c4a6e056
commit
4f96690374
@ -13,6 +13,7 @@
|
||||
#include "Filters.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "RecordingTypes.h"
|
||||
#include "RecordedEventImpl.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "Filters.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "RecordingTypes.h"
|
||||
#include "RecordedEventImpl.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "PathRecording.h"
|
||||
#include "DrawEventRecorder.h"
|
||||
#include "RecordedEventImpl.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
3073
gfx/2d/RecordedEventImpl.h
Normal file
3073
gfx/2d/RecordedEventImpl.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -11,28 +11,28 @@
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
template<class T>
|
||||
template<class S, class T>
|
||||
struct ElementStreamFormat
|
||||
{
|
||||
static void Write(std::ostream &aStream, const T &aElement)
|
||||
static void Write(S &aStream, const T &aElement)
|
||||
{
|
||||
aStream.write(reinterpret_cast<const char*>(&aElement), sizeof(T));
|
||||
}
|
||||
static void Read(std::istream &aStream, T &aElement)
|
||||
static void Read(S &aStream, T &aElement)
|
||||
{
|
||||
aStream.read(reinterpret_cast<char *>(&aElement), sizeof(T));
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
void WriteElement(std::ostream &aStream, const T &aElement)
|
||||
template<class S, class T>
|
||||
void WriteElement(S &aStream, const T &aElement)
|
||||
{
|
||||
ElementStreamFormat<T>::Write(aStream, aElement);
|
||||
ElementStreamFormat<S, T>::Write(aStream, aElement);
|
||||
}
|
||||
template<class T>
|
||||
void ReadElement(std::istream &aStream, T &aElement)
|
||||
template<class S, class T>
|
||||
void ReadElement(S &aStream, T &aElement)
|
||||
{
|
||||
ElementStreamFormat<T>::Read(aStream, aElement);
|
||||
ElementStreamFormat<S, T>::Read(aStream, aElement);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
Loading…
Reference in New Issue
Block a user