Coverage for /Syzygy/agent/memprof/memprof.cc

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
0.0%0040.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    :  #include "base/at_exit.h"
  16    :  #include "base/command_line.h"
  17    :  #include "base/logging.h"
  18    :  #include "syzygy/agent/memprof/memory_profiler.h"
  19    :  
  20  m :  namespace {
  21    :  
  22    :  // Our AtExit manager required by base.
  23  m :  base::AtExitManager* at_exit = nullptr;
  24    :  
  25  m :  void SetUpAtExitManager() {
  26  m :    DCHECK(at_exit == nullptr);
  27  m :    at_exit = new base::AtExitManager();
  28  m :    CHECK(at_exit != nullptr);
  29  m :  }
  30    :  
  31  m :  }  // namespace
  32    :  
  33  m :  namespace agent {
  34  m :  namespace memprof {
  35    :  
  36  m :  scoped_ptr<MemoryProfiler> memory_profiler;
  37    :  
  38  m :  }  // namespace memprof
  39  m :  }  // namespace agent
  40    :  
  41  m :  extern "C" {
  42    :  
  43  m :  BOOL WINAPI DllMain(HMODULE instance, DWORD reason, LPVOID reserved) {
  44  m :    agent::common::InitializeCrt();
  45    :  
  46  m :    switch (reason) {
  47  m :      case DLL_PROCESS_ATTACH:
  48    :        // Create the At-Exit manager.
  49  m :        SetUpAtExitManager();
  50    :  
  51    :        // Disable logging. In the case of Chrome this is running in a sandboxed
  52    :        // process where logging to file doesn't help us any. In other cases the
  53    :        // log output will still go to console.
  54  m :        base::CommandLine::Init(0, NULL);
  55  m :        common::InitLoggingForDll(L"memprof");
  56    :  
  57  m :        agent::memprof::memory_profiler.reset(
  58  m :            new agent::memprof::MemoryProfiler());
  59  m :        agent::memprof::memory_profiler->Init();
  60  m :        break;
  61    :  
  62  m :      case DLL_THREAD_ATTACH:
  63    :        // Nothing to do here.
  64  m :        break;
  65    :  
  66  m :      case DLL_THREAD_DETACH:
  67    :        // Nothing to do here.
  68  m :        break;
  69    :  
  70  m :      case DLL_PROCESS_DETACH:
  71  m :        base::CommandLine::Reset();
  72  m :        agent::memprof::memory_profiler.reset(nullptr);
  73  m :        break;
  74    :  
  75  m :      default:
  76  m :        NOTREACHED();
  77  m :        break;
  78  m :    }
  79    :  
  80  m :    return TRUE;
  81  m :  }
  82    :  
  83  m :  }  // extern "C"

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