home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / utility / fredmem.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  1.8 KB  |  58 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #pragma once
  20. #include "FlushAllocator.h"
  21. #include "prtypes.h"
  22. #include <LGrowZone.h>
  23. #include <LListener.h>
  24. #include <LPeriodical.h>
  25.  
  26. /*-----------------------------------------------------------------------------
  27.     Cache Flushing - Layout
  28.     Free the layout element recycle list for no-priority allocations.
  29. -----------------------------------------------------------------------------*/
  30. typedef struct MWContext_ MWContext;
  31.  
  32. extern void            FM_SetFlushable( MWContext* context, Boolean canFlush );
  33.  
  34. void                Memory_InitializeMemory();
  35. size_t                Memory_MaxApplMem();
  36. void                Memory_DoneWithMemory();
  37. Boolean                Memory_MemoryIsLow();
  38.  
  39. inline void* operator new( size_t size, char* /*file*/, int /*line*/, char* /*kind*/ )
  40. {
  41.     void* mem = Flush_Allocate( size, FALSE );
  42.     ThrowIfNil_( mem );
  43.     return mem;
  44. }
  45.  
  46. inline void operator delete( void* block, char* /* file */, int /* line */ )
  47. {
  48.     Flush_Free( block );
  49. }
  50.  
  51. class LMemoryFlusherListener : public LListener { 
  52.  
  53.     public:
  54.         LMemoryFlusherListener();
  55.         virtual void    ListenToMessage(MessageT inMessage, void *ioParam);
  56.  
  57. };
  58.