Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "DrawEventRecorder.h"
7 #include "PathRecording.h"
9 namespace mozilla {
10 namespace gfx {
12 using namespace std;
14 const uint32_t kMagicInt = 0xc001feed;
16 DrawEventRecorderPrivate::DrawEventRecorderPrivate(std::ostream *aStream)
17 : mOutputStream(aStream)
18 {
19 }
21 void
22 DrawEventRecorderPrivate::RecordEvent(const RecordedEvent &aEvent)
23 {
24 WriteElement(*mOutputStream, aEvent.mType);
26 aEvent.RecordToStream(*mOutputStream);
28 Flush();
29 }
31 DrawEventRecorderFile::DrawEventRecorderFile(const char *aFilename)
32 : DrawEventRecorderPrivate(nullptr)
33 , mOutputFile(aFilename, ofstream::binary)
34 {
35 mOutputStream = &mOutputFile;
37 WriteElement(*mOutputStream, kMagicInt);
38 WriteElement(*mOutputStream, kMajorRevision);
39 WriteElement(*mOutputStream, kMinorRevision);
40 }
42 DrawEventRecorderFile::~DrawEventRecorderFile()
43 {
44 mOutputFile.close();
45 }
47 void
48 DrawEventRecorderFile::Flush()
49 {
50 mOutputFile.flush();
51 }
53 }
54 }