1 : // Copyright 2015 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : //
15 : // Declares an event to represent a HeapDestroy function call.
16 : #ifndef SYZYGY_BARD_EVENTS_HEAP_DESTROY_EVENT_H_
17 : #define SYZYGY_BARD_EVENTS_HEAP_DESTROY_EVENT_H_
18 :
19 : #include <windows.h>
20 :
21 : #include "base/memory/scoped_ptr.h"
22 : #include "syzygy/bard/event.h"
23 :
24 : namespace bard {
25 : namespace events {
26 :
27 : // An event that wraps a call to HeapDestroy, to be played against a
28 : // HeapBackdrop.
29 : class HeapDestroyEvent : public EventInterface {
30 : public:
31 : HeapDestroyEvent(HANDLE trace_heap, BOOL trace_succeeded);
32 :
33 : // @name EventInterface implementation.
34 : // @{
35 E : EventType type() const override { return kHeapDestroyEvent; }
36 : bool Play(void* backdrop) override;
37 : // @}
38 :
39 : // @name Serialization methods.
40 : // @{
41 : static bool Save(const EventInterface* const event,
42 : core::OutArchive* out_archive);
43 : static scoped_ptr<HeapDestroyEvent> Load(core::InArchive* in_archive);
44 : bool Equals(const EventInterface* rhs) const override;
45 : // @}
46 :
47 : // @name Accessors.
48 : // @{
49 E : HANDLE trace_heap() const { return trace_heap_; }
50 : BOOL trace_succeeded() const { return trace_succeeded_; }
51 : // @}
52 :
53 : private:
54 : // Argument to HeapDestory.
55 : HANDLE trace_heap_;
56 :
57 : // Recorded return value.
58 : BOOL trace_succeeded_;
59 :
60 : DISALLOW_COPY_AND_ASSIGN(HeapDestroyEvent);
61 : };
62 :
63 : } // namespace events
64 : } // namespace bard
65 :
66 : #endif // SYZYGY_BARD_EVENTS_HEAP_DESTROY_EVENT_H_
|