OLD | NEW |
1 // Copyright 2014 Google Inc. All Rights Reserved. | 1 // Copyright 2014 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with 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 | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 // | |
15 // Declares ShadowMemoryNotifier, an implementation of MemoryNotifierInterface | |
16 // that modifies the shadow memory upon receiving memory notifications. | |
17 | 14 |
18 #ifndef SYZYGY_AGENT_ASAN_MEMORY_NOTIFIERS_SHADOW_MEMORY_NOTIFIER_H_ | 15 #ifndef SYZYGY_AGENT_ASAN_MEMORY_NOTIFIERS_NULL_MEMORY_NOTIFIER_H_ |
19 #define SYZYGY_AGENT_ASAN_MEMORY_NOTIFIERS_SHADOW_MEMORY_NOTIFIER_H_ | 16 #define SYZYGY_AGENT_ASAN_MEMORY_NOTIFIERS_NULL_MEMORY_NOTIFIER_H_ |
20 | 17 |
21 #include "base/logging.h" | 18 #include "base/logging.h" |
22 #include "syzygy/agent/asan/memory_notifier.h" | 19 #include "syzygy/agent/asan/memory_notifier.h" |
23 | 20 |
24 namespace agent { | 21 namespace agent { |
25 namespace asan { | 22 namespace asan { |
26 namespace memory_notifiers { | 23 namespace memory_notifiers { |
27 | 24 |
28 // Declares a simple interface that is used by internal runtime components to | 25 // Dummy notifier, useful to test objects relying on a memory notifier. |
29 // notify the runtime of their own memory use. | 26 class NullMemoryNotifier : public MemoryNotifierInterface { |
30 class ShadowMemoryNotifier : public MemoryNotifierInterface { | |
31 public: | 27 public: |
32 // Constructor. | 28 // Constructor. |
33 ShadowMemoryNotifier() { } | 29 NullMemoryNotifier() { } |
34 | 30 |
35 // Virtual destructor. | 31 // Virtual destructor. |
36 virtual ~ShadowMemoryNotifier() { } | 32 virtual ~NullMemoryNotifier() { } |
37 | 33 |
38 // @name MemoryNotifierInterface implementation. | 34 // @name MemoryNotifierInterface implementation. |
39 // @{ | 35 // @{ |
40 virtual void NotifyInternalUse(const void* address, size_t size); | 36 virtual void NotifyInternalUse(const void* address, size_t size) { } |
41 virtual void NotifyFutureHeapUse(const void* address, size_t size); | 37 virtual void NotifyFutureHeapUse(const void* address, size_t size) { } |
42 virtual void NotifyReturnedToOS(const void* address, size_t size); | 38 virtual void NotifyReturnedToOS(const void* address, size_t size) { } |
43 // @} | 39 // @} |
44 | |
45 private: | 40 private: |
46 DISALLOW_COPY_AND_ASSIGN(ShadowMemoryNotifier); | 41 DISALLOW_COPY_AND_ASSIGN(NullMemoryNotifier); |
47 }; | 42 }; |
48 | 43 |
49 } // namespace memory_notifiers | 44 } // namespace memory_notifiers |
50 } // namespace asan | 45 } // namespace asan |
51 } // namespace agent | 46 } // namespace agent |
52 | 47 |
53 #endif // SYZYGY_AGENT_ASAN_MEMORY_NOTIFIERS_SHADOW_MEMORY_NOTIFIER_H_ | 48 #endif // SYZYGY_AGENT_ASAN_MEMORY_NOTIFIERS_NULL_MEMORY_NOTIFIER_H_ |
OLD | NEW |