This commit is contained in:
cyeh%netscape.com 1998-09-24 20:47:57 +00:00
Родитель 26a561928e
Коммит 0c4dcd1592
9 изменённых файлов: 5 добавлений и 2702 удалений

Просмотреть файл

@ -988,11 +988,7 @@ void do_spellcheck( MWContext *mwcontext, CEditView *editView, CSimpleTextView *
try {
#ifdef USE_DYNAMIC_SC_LIB
sc_create_func sc_createProc;
#ifndef NSPR20
sc_createProc = (sc_create_func)PR_FindSymbol( "SC_Create", spellCheckerLib );
#else
sc_createProc = (sc_create_func)PR_FindSymbol( spellCheckerLib, "SC_Create" );
#endif
if ( sc_createProc == NULL )
{
ErrorManager::PlainAlert( NO_SPELL_SHLB_FOUND );

Просмотреть файл

@ -440,11 +440,7 @@ OSErr CPluginHandler::InitCodeResource(NPNetscapeFuncs* funcs, _np_handle* handl
ThrowIf_(res != NS_OK);
handle->userPlugin = plugin;
} else {
#ifndef NSPR20
fMainEntryFunc = (NPP_MainEntryUPP) PR_FindSymbol("mainRD", fLibrary);
#else
fMainEntryFunc = (NPP_MainEntryUPP) PR_FindSymbol(fLibrary, "mainRD");
#endif
ThrowIfNil_(fMainEntryFunc);
}
}

Просмотреть файл

@ -21,9 +21,6 @@
#include "CBrowserContext.h"
#include "CNSContextCallbacks.h"
#include "CHTMLView.h"
#ifndef NSPR20
#include "CNetwork.h"
#endif
#include "UStdDialogs.h"
#include "UFormElementFactory.h"
#include "CAutoPtrXP.h"

Просмотреть файл

@ -22,9 +22,6 @@
#include "CNSContext.h"
#include "CNSContextCallbacks.h"
#include "CHTMLView.h"
#ifndef NSPR20
#include "CNetwork.h"
#endif
#include "UStdDialogs.h"
#include "CURLEditField.h"
#include "CMochaHacks.h"
@ -788,11 +785,6 @@ void CNSContext::Alert(
void CNSContext::SetCallNetlibAllTheTime(void)
{
#ifndef NSPR20
extern CNetworkDriver* gNetDriver;
Assert_(gNetDriver != NULL);
gNetDriver->SetCallAllTheTime();
#endif
}
@ -802,21 +794,11 @@ void CNSContext::SetCallNetlibAllTheTime(void)
void CNSContext::ClearCallNetlibAllTheTime(void)
{
#ifndef NSPR20
extern CNetworkDriver* gNetDriver;
Assert_(gNetDriver != NULL);
gNetDriver->ClearCallAllTheTime();
#endif
}
// A temporary abortion, we need this routine outside of MWContext function table
void XP_ClearCallNetlibAllTheTime(MWContext *)
{
#ifndef NSPR20
extern CNetworkDriver* gNetDriver;
Assert_(gNetDriver != NULL);
gNetDriver->SetCallAllTheTime();
#endif
}
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ

Просмотреть файл

@ -28,9 +28,6 @@
#include "uapp.h"
#include "CNSContext.h"
// Network
#ifndef NSPR20
#include "CNetwork.h"
#endif
// Netscape
#include "secrng.h"
// utilities
@ -44,12 +41,10 @@ extern "C" {
#include "resgui.h"
#ifdef NSPR20
#include "prthread.h"
PR_BEGIN_EXTERN_C
PR_EXTERN(PRThread*) PR_GetPrimaryThread(void);
PR_END_EXTERN_C
#endif
/*-----------------------------------------------------------------------------
Earl Manager
@ -99,26 +94,11 @@ void EarlManager::SpendTime( const EventRecord& /*inMacEvent*/)
// appropriate time, and make sure that our priority is
// low so that other java threads an run.
#ifndef NSPR20
// If we don't have a gNetDriver then we better not call it
if (!gNetDriver)
return;
PR_SetThreadPriority(PR_CurrentThread(), 0);
gNetDriver->SpendTime();
#else
PR_SetThreadPriority(PR_CurrentThread(), PR_PRIORITY_LOW);
#endif
unsigned char dst;
RNG_GenerateGlobalRandomBytes(&dst, 1);
#ifdef NSPR20_DISABLED
CSelectObject socketToCallWith;
if (gNetDriver->CanCallNetlib(socketToCallWith))
NET_ProcessNet(MacToStdSocketID(socketToCallWith.fID), SocketSelectToFD_Type(socketToCallWith.fType));
#else
NET_PollSockets();
#endif
if ( fInterruptContext )
{
NET_InterruptWindow( fInterruptContext );
@ -303,78 +283,35 @@ int EarlManagerNetTicklerCallback(void)
}
}
#ifdef NSPR20_DISABLED
int SocketSelectToFD_Type(SocketSelect s)
{
switch (s) {
case eReadSocket:
case eExceptionSocket:
return NET_SOCKET_FD;
case eLocalFileSocket:
return NET_LOCAL_FILE_FD;
case eEverytimeSocket:
return NET_EVERYTIME_TYPE;
}
return 0; // Never reached
}
#endif
// FE Select routines
void FE_SetReadSelect (MWContext * /* context */, int sd)
{
#ifndef NSPR20
gNetDriver->SetReadSelect(sd);
#endif
}
void FE_ClearReadSelect (MWContext */* context */, int sd)
{
#ifndef NSPR20
gNetDriver->ClearReadSelect(sd);
#endif
}
void FE_SetConnectSelect (MWContext */* context */, int sd)
{
#ifndef NSPR20
gNetDriver->SetConnectSelect(sd);
#endif
}
void FE_ClearConnectSelect(MWContext */* context */, int sd)
{
#ifndef NSPR20
gNetDriver->ClearConnectSelect(sd);
#endif
}
void FE_SetFileReadSelect (MWContext */* context */, int fd)
{
#ifndef NSPR20
gNetDriver->SetFileReadSelect(fd);
#endif
}
void FE_ClearFileReadSelect (MWContext */* context */, int fd)
{
#ifndef NSPR20
gNetDriver->ClearFileReadSelect(fd);
#endif
}
int FE_StartAsyncDNSLookup (MWContext */* context */, char * host_port, void ** hoststruct_ptr_ptr, int sock)
{
#ifndef NSPR20
*hoststruct_ptr_ptr = NULL;
int err = gNetDriver->StartAsyncDNSLookup(host_port, (struct hostent **)hoststruct_ptr_ptr, sock);
if (err == EAGAIN) // Because macsock knows nothing of netlib defines
return MK_WAITING_FOR_LOOKUP;
else
return err;
#endif
return MK_WAITING_FOR_LOOKUP;
}

Просмотреть файл

@ -1,32 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include <Types.h>
#ifndef NSPR20
#include "prmacros.h"
#else
#include "prtypes.h"
#endif
NSPR_BEGIN_EXTERN_C
extern OSErr FindGutsFolder(FSSpec* outSpec);
extern OSErr FindNetscapeFolder(FSSpec* outSpec);
extern OSErr FindJavaDownloadsFolder(FSSpec *outSpec);
NSPR_END_EXTERN_C

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -91,9 +91,6 @@
#include "LMenuSharing.h"
#define MENU_SHARING_FIRST 40
#ifndef NSPR20
#include "CNetwork.h"
#endif
#include "CEnvironment.h"
#include "CWindowMenu.h"
@ -158,10 +155,7 @@
#include "InternetConfig.h"
#include "il_strm.h" /* Image Library stream converters. */
#ifdef MOCHA
//#include "libmocha.h"
#include "CMochaHacks.h"
#endif
PRThread* mozilla_thread;
@ -908,11 +902,6 @@ CFrontApp::CFrontApp()
InitUTearOffPalette(this);
CTearOffManager::GetDefaultManager()->AddListener(this);
// ¥Ênetwork
#ifndef NSPR20
CNetworkDriver::CreateNetworkDriver();
#endif
TheEarlManager.StartRepeating();
// WTSMManager::Initialize();
@ -1060,23 +1049,12 @@ CFrontApp::~CFrontApp()
PR_ProcessPendingEvents(mozilla_event_queue);
//-----
#ifndef NSPR20
if (gNetDriver && !fStartupAborted)
{
extern const char* CacheFilePrefix;
NET_CleanupCacheDirectory( "", CacheFilePrefix );
NET_ShutdownNetLib();
delete gNetDriver;
gNetDriver = NULL;
}
#else
if (!fStartupAborted)
{
extern const char* CacheFilePrefix;
NET_CleanupCacheDirectory( "", CacheFilePrefix );
NET_ShutdownNetLib();
}
#endif
if (!fStartupAborted)
CPrefs::DoWrite();
@ -1663,11 +1641,8 @@ void CFrontApp::ProperStartup( FSSpec* file, short fileType )
possible. */
if ((PR_GetGCInfo() != NULL) && (PR_GetGCInfo()->finalizer != NULL))
#ifndef NSPR20
PR_SetThreadPriority(PR_GetGCInfo()->finalizer, 31);
#else
PR_SetThreadPriority(PR_GetGCInfo()->finalizer, PR_PRIORITY_URGENT);
#endif
PR_SetThreadPriority(PR_GetGCInfo()->finalizer, PR_PRIORITY_URGENT);
DestroySplashScreen();
if ( abortStartup == CPrefs::eRunAccountSetup )
@ -3710,13 +3685,9 @@ void main( void )
#endif
// NSPR/MOCHA Initialization
#ifndef NSPR20
PR_Init("Navigator", 0,0,0);
#endif
mozilla_thread = PR_CurrentThread();
#ifdef NSPR20
PR_SetThreadGCAble();
#endif
// ¥ initialize the memory manager
// it's important that this is done VERY early
@ -4107,12 +4078,9 @@ CFrontApp::ProcessNextEvent()
}
#ifdef DAVIDM_SPEED2
#ifndef NSPR20
CSelectObject socketToCallWith;
Boolean doWNE = haveUserEvent || ::LMGetTicks() > sNextWNETicks || ( gNetDriver && !gNetDriver->CanCallNetlib(socketToCallWith) );
#else
Boolean doWNE = haveUserEvent || ::LMGetTicks() > sNextWNETicks || NET_PollSockets();
#endif // NSPR_20
SetUpdateCommandStatus(false);
if ( doWNE )

Просмотреть файл

@ -1,276 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef NSPR20
#include "prmacos.h"
#endif
#include "fredmem.h"
#include "shist.h"
#include "shistele.h"
#include "lo_ele.h"
#include "proto.h"
#include "net.h"
#include "libimg.h"
#include "fe_proto.h"
#include "uerrmgr.h"
#include "PascalString.h"
#include "resgui.h"
#include "MacMemAllocator.h"
//#include "MToolkit.h"
enum {
kEmergencyMemoryFundSize = 64 * 1024
};
class LMallocFlusherPeriodical : public LPeriodical {
public:
LMallocFlusherPeriodical();
virtual void SpendTime(const EventRecord &inMacEvent);
void FlushMemory ( void ) { mFlushMemory = true; }
private:
Boolean mFlushMemory;
};
class LLowMallocWarningPeriodical : public LPeriodical {
public:
LLowMallocWarningPeriodical();
virtual void SpendTime(const EventRecord &inMacEvent);
void WarnUserMallocLow ( void ) { mWarnUser = true; }
private:
Boolean mWarnUser;
};
unsigned char MacFEMemoryFlusher ( size_t bytesNeeded );
void ImageCacheMemoryFlusher(void);
void LayoutCacheMemoryFlusher(void);
void NetlibCacheMemoryFlusher(void);
void LibNeoCacheMemoryFlusher(void);
void MallocIsLowWarning(void);
static LMallocFlusherPeriodical gMallocFlusher;
static LLowMallocWarningPeriodical gMallocWarner;
void Memory_InitializeMemory()
{
new LGrowZone(kEmergencyMemoryFundSize);
new LMemoryFlusherListener();
InstallMemoryCacheFlusher(&MacFEMemoryFlusher);
// install our low memory (malloc heap) warning proc
InstallMallocHeapLowProc ( &MallocIsLowWarning );
}
void Memory_DoneWithMemory()
{
// No cleanup necessary
}
size_t Memory_MaxApplMem()
{
return 0;
}
Boolean Memory_MemoryIsLow()
{
return (LGrowZone::GetGrowZone())->MemoryIsLow();
}
//##############################################################################
//##############################################################################
#pragma mark MAC FE MEMORY FLUSH PROC
unsigned char MacFEMemoryFlusher ( size_t bytesNeeded )
{
/* signal the flusher to do it's thing. I would rather start the idler here */
/* but that involves allocating memory (and so could be reentrant)... */
gMallocFlusher.FlushMemory();
return 0;
}
//##############################################################################
//##############################################################################
#pragma mark LAYOUT CACHE FLUSHING
LArray sFlushableLayoutContextList;
void FM_SetFlushable(MWContext* context, Boolean canFlush)
{
if (canFlush) {
if (sFlushableLayoutContextList.FetchIndexOf(&context) == 0)
sFlushableLayoutContextList.InsertItemsAt(1, LArray::index_Last, &context);
}
else {
sFlushableLayoutContextList.Remove(&context);
}
}
void LayoutCacheMemoryFlusher(void)
{
MWContext *currentContext = NULL;
SInt32 bytesFreed = 0;
LArrayIterator iter(sFlushableLayoutContextList);
// go ahead and empty all the recycling bins
while ( iter.Previous(&currentContext) )
{
bytesFreed += LO_EmptyRecyclingBin(currentContext);
sFlushableLayoutContextList.RemoveItemsAt( 1, 1 );
}
}
//##############################################################################
//##############################################################################
#pragma mark LIBNEO CACHE FLUSHING
void LibNeoCacheMemoryFlusher(void)
{
// don't do this yet until we really understand how safe it is
#if 0
// we don't really know how much was freed here
NeoOutOfMemHandler();
#endif
}
//##############################################################################
//##############################################################################
#pragma mark NETLIB CACHE FLUSHING
void NetlibCacheMemoryFlusher(void)
{
size_t newCacheSize;
size_t lastCacheSize;
newCacheSize = NET_GetMemoryCacheSize();
// shrink as much as we can
do {
lastCacheSize = newCacheSize;
newCacheSize = NET_RemoveLastMemoryCacheObject();
}
while ( newCacheSize != lastCacheSize );
}
//##############################################################################
//##############################################################################
#pragma mark IMAGE CACHE FLUSHING
void ImageCacheMemoryFlusher(void)
{
size_t newCacheSize;
size_t lastCacheSize;
newCacheSize = IL_GetCacheSize();
// shrink as much as we can
do {
lastCacheSize = newCacheSize;
newCacheSize = IL_ShrinkCache();
}
while ( newCacheSize != lastCacheSize );
}
//##############################################################################
//##############################################################################
#pragma mark MALLOC HEAP LOW USER WARNING
void MallocIsLowWarning(void)
{
gMallocWarner.WarnUserMallocLow();
}
//##############################################################################
//##############################################################################
#pragma mark GROW ZONE LISTENER
LMemoryFlusherListener::
LMemoryFlusherListener():LListener()
{
(LGrowZone::GetGrowZone())->AddListener(this);
}
void
LMemoryFlusherListener::ListenToMessage(MessageT inMessage, void *ioParam)
{
Int32 *bytesToFree = (Int32 *)ioParam;
if (inMessage == msg_GrowZone) {
UInt8 successfulFlush = false;
/* we don't do anything here yet */
if (!successfulFlush)
*bytesToFree = 0;
}
}
//##############################################################################
//##############################################################################
#pragma mark MEMORY PERIODICAL
LLowMallocWarningPeriodical::LLowMallocWarningPeriodical() : LPeriodical()
{
mWarnUser = false;
StartIdling();
}
void
LLowMallocWarningPeriodical::SpendTime(const EventRecord &inMacEvent)
{
if ( mWarnUser )
{
StopIdling();
FE_Alert( NULL, GetPString ( MALLOC_HEAP_LOW_RESID ) );
}
}
LMallocFlusherPeriodical::LMallocFlusherPeriodical() : LPeriodical()
{
mFlushMemory = false;
StartIdling();
}
void
LMallocFlusherPeriodical::SpendTime(const EventRecord &inMacEvent)
{
if ( mFlushMemory )
{
ImageCacheMemoryFlusher();
LayoutCacheMemoryFlusher();
NetlibCacheMemoryFlusher();
LibNeoCacheMemoryFlusher();
mFlushMemory = false;
}
}