Promoted NullMemoryNotifier outside unit tests.
BUG=
R=sebmarchand@chromium.org
Review URL: https://codereview.appspot.com/130590043
git-svn-id: http://sawbuck.googlecode.com/svn/trunk@2271 15e8cca8-e42c-11de-a347-f34a4f72eb7d
diff --git a/syzygy/agent/asan/asan.gyp b/syzygy/agent/asan/asan.gyp
index 0ce9b9d..3dcbdf0 100644
--- a/syzygy/agent/asan/asan.gyp
+++ b/syzygy/agent/asan/asan.gyp
@@ -83,6 +83,7 @@
'heaps/win_heap.h',
'heaps/zebra_block_heap.cc',
'heaps/zebra_block_heap.h',
+ 'memory_notifiers/null_memory_notifier.h',
'memory_notifiers/shadow_memory_notifier.cc',
'memory_notifiers/shadow_memory_notifier.h',
'quarantines/sharded_quarantine.h',
diff --git a/syzygy/agent/asan/memory_notifiers/null_memory_notifier.h b/syzygy/agent/asan/memory_notifiers/null_memory_notifier.h
new file mode 100644
index 0000000..1211ccf
--- /dev/null
+++ b/syzygy/agent/asan/memory_notifiers/null_memory_notifier.h
@@ -0,0 +1,48 @@
+// Copyright 2014 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef SYZYGY_AGENT_ASAN_MEMORY_NOTIFIERS_NULL_MEMORY_NOTIFIER_H_
+#define SYZYGY_AGENT_ASAN_MEMORY_NOTIFIERS_NULL_MEMORY_NOTIFIER_H_
+
+#include "base/logging.h"
+#include "syzygy/agent/asan/memory_notifier.h"
+
+namespace agent {
+namespace asan {
+namespace memory_notifiers {
+
+// Dummy notifier, useful to test objects relying on a memory notifier.
+class NullMemoryNotifier : public MemoryNotifierInterface {
+ public:
+ // Constructor.
+ NullMemoryNotifier() { }
+
+ // Virtual destructor.
+ virtual ~NullMemoryNotifier() { }
+
+ // @name MemoryNotifierInterface implementation.
+ // @{
+ virtual void NotifyInternalUse(const void* address, size_t size) { }
+ virtual void NotifyFutureHeapUse(const void* address, size_t size) { }
+ virtual void NotifyReturnedToOS(const void* address, size_t size) { }
+ // @}
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NullMemoryNotifier);
+};
+
+} // namespace memory_notifiers
+} // namespace asan
+} // namespace agent
+
+#endif // SYZYGY_AGENT_ASAN_MEMORY_NOTIFIERS_NULL_MEMORY_NOTIFIER_H_
diff --git a/syzygy/agent/asan/unittest_util.h b/syzygy/agent/asan/unittest_util.h
index 6ccf280..3fd3e96 100644
--- a/syzygy/agent/asan/unittest_util.h
+++ b/syzygy/agent/asan/unittest_util.h
@@ -28,6 +28,7 @@
#include "syzygy/agent/asan/heap.h"
#include "syzygy/agent/asan/memory_notifier.h"
#include "syzygy/agent/asan/stack_capture_cache.h"
+#include "syzygy/agent/asan/memory_notifiers/null_memory_notifier.h"
#include "syzygy/core/unittest_util.h"
#include "syzygy/trace/agent_logger/agent_logger.h"
#include "syzygy/trace/agent_logger/agent_logger_rpc_impl.h"
@@ -35,6 +36,7 @@
namespace testing {
using agent::asan::AsanErrorInfo;
+using agent::asan::memory_notifiers::NullMemoryNotifier;
using agent::asan::StackCaptureCache;
// The default name of the runtime library DLL.
@@ -381,27 +383,6 @@
StackCaptureCache* stack_cache;
};
-// A null memory notifier. Useful when testing objects that have a memory
-// notifier dependency.
-class NullMemoryNotifier : public agent::asan::MemoryNotifierInterface {
- public:
- // Constructor.
- NullMemoryNotifier() { }
-
- // Virtual destructor.
- virtual ~NullMemoryNotifier() { }
-
- // @name MemoryNotifierInterface implementation.
- // @{
- virtual void NotifyInternalUse(const void* address, size_t size) { }
- virtual void NotifyFutureHeapUse(const void* address, size_t size) { }
- virtual void NotifyReturnedToOS(const void* address, size_t size) { }
- // @}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(NullMemoryNotifier);
-};
-
// A mock memory notifier. Useful when testing objects that have a memory
// notifier dependency.
class MockMemoryNotifier : public agent::asan::MemoryNotifierInterface {