/src/mozilla-central/layout/printing/DrawEventRecorder.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "DrawEventRecorder.h" |
8 | | |
9 | | namespace mozilla { |
10 | | namespace layout { |
11 | | |
12 | | void |
13 | | DrawEventRecorderPRFileDesc::RecordEvent(const gfx::RecordedEvent& aEvent) |
14 | 0 | { |
15 | 0 | WriteElement(mOutputStream, aEvent.GetType()); |
16 | 0 |
|
17 | 0 | aEvent.RecordToStream(mOutputStream); |
18 | 0 |
|
19 | 0 | Flush(); |
20 | 0 | } |
21 | | |
22 | | DrawEventRecorderPRFileDesc::~DrawEventRecorderPRFileDesc() |
23 | 0 | { |
24 | 0 | if (IsOpen()) { |
25 | 0 | Close(); |
26 | 0 | } |
27 | 0 | } |
28 | | |
29 | | void |
30 | | DrawEventRecorderPRFileDesc::Flush() |
31 | 0 | { |
32 | 0 | mOutputStream.Flush(); |
33 | 0 | } |
34 | | |
35 | | bool |
36 | | DrawEventRecorderPRFileDesc::IsOpen() |
37 | 0 | { |
38 | 0 | return mOutputStream.IsOpen(); |
39 | 0 | } |
40 | | |
41 | | void |
42 | | DrawEventRecorderPRFileDesc::OpenFD(PRFileDesc* aFd) |
43 | 0 | { |
44 | 0 | MOZ_DIAGNOSTIC_ASSERT(!IsOpen()); |
45 | 0 |
|
46 | 0 | mOutputStream.OpenFD(aFd); |
47 | 0 | WriteHeader(mOutputStream); |
48 | 0 | } |
49 | | |
50 | | void |
51 | | DrawEventRecorderPRFileDesc::Close() |
52 | 0 | { |
53 | 0 | MOZ_DIAGNOSTIC_ASSERT(IsOpen()); |
54 | 0 |
|
55 | 0 | mOutputStream.Close(); |
56 | 0 | } |
57 | | |
58 | | } |
59 | | } |