ipc/chromium/src/base/memory_debug.cc

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/chromium/src/base/memory_debug.cc	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     1.4 +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
     1.5 +// Use of this source code is governed by a BSD-style license that can be
     1.6 +// found in the LICENSE file.
     1.7 +
     1.8 +#include "base/memory_debug.h"
     1.9 +
    1.10 +#ifdef PURIFY
    1.11 +// this #define is used to prevent people from directly using pure.h
    1.12 +// instead of memory_debug.h
    1.13 +#define PURIFY_PRIVATE_INCLUDE
    1.14 +#include "base/third_party/purify/pure.h"
    1.15 +#endif
    1.16 +
    1.17 +namespace base {
    1.18 +
    1.19 +bool MemoryDebug::memory_in_use_ = false;
    1.20 +
    1.21 +void MemoryDebug::SetMemoryInUseEnabled(bool enabled) {
    1.22 +  memory_in_use_ = enabled;
    1.23 +}
    1.24 +
    1.25 +void MemoryDebug::DumpAllMemoryInUse() {
    1.26 +#ifdef PURIFY
    1.27 +  if (memory_in_use_)
    1.28 +    PurifyAllInuse();
    1.29 +#endif
    1.30 +}
    1.31 +
    1.32 +void MemoryDebug::DumpNewMemoryInUse() {
    1.33 +#ifdef PURIFY
    1.34 +  if (memory_in_use_)
    1.35 +    PurifyNewInuse();
    1.36 +#endif
    1.37 +}
    1.38 +
    1.39 +void MemoryDebug::DumpAllLeaks() {
    1.40 +#ifdef PURIFY
    1.41 +  PurifyAllLeaks();
    1.42 +#endif
    1.43 +}
    1.44 +
    1.45 +void MemoryDebug::DumpNewLeaks() {
    1.46 +#ifdef PURIFY
    1.47 +  PurifyNewLeaks();
    1.48 +#endif
    1.49 +}
    1.50 +
    1.51 +void MemoryDebug::MarkAsInitialized(void* addr, size_t size) {
    1.52 +#ifdef PURIFY
    1.53 +  PurifyMarkAsInitialized(addr, size);
    1.54 +#endif
    1.55 +}
    1.56 +
    1.57 +}  // namespace base

mercurial