2001-02-23 13:18:01 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code is nsCacheRequest.h, released February 22, 2001.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape Communications
|
|
|
|
* Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 2001 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Gordon Sheridan, 22-February-2001
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _nsCacheRequest_h_
|
|
|
|
#define _nsCacheRequest_h_
|
|
|
|
|
|
|
|
#include "nspr.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2001-02-26 14:53:28 +00:00
|
|
|
#include "nsICache.h"
|
2001-02-23 13:18:01 +00:00
|
|
|
#include "nsICacheListener.h"
|
|
|
|
|
|
|
|
|
|
|
|
class nsCacheRequest
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
friend class nsCacheService;
|
|
|
|
friend class nsCacheEntry;
|
|
|
|
|
2001-02-26 14:53:28 +00:00
|
|
|
nsCacheRequest( nsCString * key,
|
|
|
|
nsICacheListener * listener,
|
|
|
|
nsCacheAccessMode accessRequested,
|
|
|
|
PRBool streamBased,
|
|
|
|
nsCacheStoragePolicy storagePolicy)
|
2001-02-23 13:18:01 +00:00
|
|
|
|
|
|
|
: mKey(key),
|
|
|
|
mListener(listener),
|
|
|
|
mAccessRequested(accessRequested),
|
2001-02-26 14:53:28 +00:00
|
|
|
mStreamBased(streamBased),
|
|
|
|
mStoragePolicy(storagePolicy)
|
2001-02-23 13:18:01 +00:00
|
|
|
{
|
|
|
|
mRequestThread = PR_GetCurrentThread();
|
|
|
|
|
|
|
|
PR_INIT_CLIST(&mListLink);
|
|
|
|
}
|
|
|
|
|
2001-03-04 00:11:30 +00:00
|
|
|
~nsCacheRequest()
|
2001-02-26 15:53:31 +00:00
|
|
|
{
|
2001-03-04 00:11:30 +00:00
|
|
|
delete mKey;
|
|
|
|
NS_ASSERTION(PR_CLIST_IS_EMPTY(&mListLink), "request still on a list");
|
2001-02-26 15:53:31 +00:00
|
|
|
}
|
2001-02-23 13:18:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
PRCList* GetListNode(void) { return &mListLink; }
|
|
|
|
static nsCacheRequest* GetInstance(PRCList* qp) {
|
|
|
|
return (nsCacheRequest*)
|
|
|
|
((char*)qp - offsetof(nsCacheRequest, mListLink));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsCString * mKey;
|
|
|
|
nsCOMPtr<nsICacheListener> mListener;
|
2001-02-26 14:53:28 +00:00
|
|
|
nsCacheAccessMode mAccessRequested;
|
2001-02-23 13:18:01 +00:00
|
|
|
PRBool mStreamBased;
|
2001-02-26 14:53:28 +00:00
|
|
|
nsCacheStoragePolicy mStoragePolicy;
|
2001-02-23 13:18:01 +00:00
|
|
|
PRThread * mRequestThread;
|
|
|
|
PRCList mListLink;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _nsCacheRequest_h_
|