Bumping manifests a=b2g-bump
[gecko.git] / gfx / 2d / DrawEventRecorder.h
bloba74cbb4fa44899aa081834766888cd5c513b9099
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 #ifndef MOZILLA_GFX_DRAWEVENTRECORDER_H_
7 #define MOZILLA_GFX_DRAWEVENTRECORDER_H_
9 #include "2D.h"
10 #include "RecordedEvent.h"
11 #include <ostream>
12 #include <fstream>
14 #if defined(_MSC_VER)
15 #include <hash_set>
16 #else
17 #include <set>
18 #endif
20 namespace mozilla {
21 namespace gfx {
23 class PathRecording;
25 class DrawEventRecorderPrivate : public DrawEventRecorder
27 public:
28 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DrawEventRecorderPrivate)
29 explicit DrawEventRecorderPrivate(std::ostream *aStream);
30 virtual ~DrawEventRecorderPrivate() { }
32 void RecordEvent(const RecordedEvent &aEvent);
33 void WritePath(const PathRecording *aPath);
35 void AddStoredPath(const ReferencePtr aPath) {
36 mStoredPaths.insert(aPath);
39 void RemoveStoredPath(const ReferencePtr aPath) {
40 mStoredPaths.erase(aPath);
43 bool HasStoredPath(const ReferencePtr aPath) {
44 if (mStoredPaths.find(aPath) != mStoredPaths.end()) {
45 return true;
47 return false;
50 protected:
51 std::ostream *mOutputStream;
53 virtual void Flush() = 0;
55 #if defined(_MSC_VER)
56 typedef stdext::hash_set<const void*> ObjectSet;
57 #else
58 typedef std::set<const void*> ObjectSet;
59 #endif
61 ObjectSet mStoredPaths;
62 ObjectSet mStoredScaledFonts;
65 class DrawEventRecorderFile : public DrawEventRecorderPrivate
67 public:
68 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DrawEventRecorderFile)
69 explicit DrawEventRecorderFile(const char *aFilename);
70 ~DrawEventRecorderFile();
72 private:
73 virtual void Flush();
75 std::ofstream mOutputFile;
81 #endif /* MOZILLA_GFX_DRAWEVENTRECORDER_H_ */