Coverage for /Syzygy/agent/asan/memory_notifiers/shadow_memory_notifier.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%440.C++source

Line-by-line coverage:

   1    :  // Copyright 2014 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 ShadowMemoryNotifier, an implementation of MemoryNotifierInterface
  16    :  // that modifies the shadow memory upon receiving memory notifications.
  17    :  
  18    :  #ifndef SYZYGY_AGENT_ASAN_MEMORY_NOTIFIERS_SHADOW_MEMORY_NOTIFIER_H_
  19    :  #define SYZYGY_AGENT_ASAN_MEMORY_NOTIFIERS_SHADOW_MEMORY_NOTIFIER_H_
  20    :  
  21    :  #include "base/logging.h"
  22    :  #include "syzygy/agent/asan/memory_notifier.h"
  23    :  
  24    :  namespace agent {
  25    :  namespace asan {
  26    :  
  27    :  // Forward declaration.
  28    :  class Shadow;
  29    :  
  30    :  namespace memory_notifiers {
  31    :  
  32    :  // Declares a simple interface that is used by internal runtime components to
  33    :  // notify the runtime of their own memory use.
  34    :  class ShadowMemoryNotifier : public MemoryNotifierInterface {
  35    :   public:
  36    :    // Constructor.
  37    :    // @param shadow The shadow memory to notify.
  38  E :    explicit ShadowMemoryNotifier(Shadow* shadow) : shadow_(shadow) {
  39  E :      DCHECK_NE(static_cast<Shadow*>(nullptr), shadow);
  40  E :    }
  41    :  
  42    :    // Virtual destructor.
  43  E :    virtual ~ShadowMemoryNotifier() { }
  44    :  
  45    :    // @name MemoryNotifierInterface implementation.
  46    :    // @{
  47    :    virtual void NotifyInternalUse(const void* address, size_t size);
  48    :    virtual void NotifyFutureHeapUse(const void* address, size_t size);
  49    :    virtual void NotifyReturnedToOS(const void* address, size_t size);
  50    :    // @}
  51    :  
  52    :   private:
  53    :    // The shadow that is being notified.
  54    :    Shadow* shadow_;
  55    :  
  56    :    DISALLOW_COPY_AND_ASSIGN(ShadowMemoryNotifier);
  57    :  };
  58    :  
  59    :  }  // namespace memory_notifiers
  60    :  }  // namespace asan
  61    :  }  // namespace agent
  62    :  
  63    :  #endif  // SYZYGY_AGENT_ASAN_MEMORY_NOTIFIERS_SHADOW_MEMORY_NOTIFIER_H_

Coverage information generated Thu Jan 14 17:40:38 2016.