Files
palemoon27/netwerk/cache2/CacheIOThread.h
T
roytam1 06d40aca85 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1236277 - Retry all connections not just the reused one. r=mcmanus (ed4f2e0b53)
- Bug 366023 - Allow h/1.0 chunked encodings r=bagder (46916cf57d)
- Bug 1234757 - test_protocolproxyservice does not need 2nd arg to asyncopen r=ckerschb (b5be356b2f)
- Bug 1234757 - Use channel.asyncOpen2 within netwerk/test/unit/test_protocolproxyservice.js (r=mcmanus) (ff5fed346c)
- Bug 1213953. Remove pref "layout.imagevisibility.enabled_for_browser_elements_only", it is unused and obsolete. r=seth (b3263ece72)
- Bug 1218506 - Uninitialised value use in nsHttpTransaction::OnTransportStatus. r=mcmanus. (860ebc7b21)
- Bug 1211168 - Fix resource timing domainLookupStart by setting the timestamp only once. r=mcmanus (d29ce1c707)
- Bug 1242172. Invalidate intrinsic ISizes that depend on viewport BSize when the viewport is resized. r=dbaron (9f01b86d3d)
- Bug 1154277: Part 1 - allow to swap docShells on remote browsers that are not a child of a BrowserDOMWindow. r=smaug (ec889b29de)
- Bug 1230918 - remove useless null-pointer check on aChild that only caused a Coverity - Dereference before null check. r=dbaron (73e4595582)
- Bug 1149260 - Guard against trying to draw a drag image with zero length. r=enndeakin (212553ba76)
- Bug 1209780. Check DrawResult return value in nsBaseDragService. r=seth (8ed14eae88)
- Bug 1242690 - Make sure that synthetic mouse events have a reasonable guid so that the callback transform can get unapplied properly. r=botond (b612388818)
- Bug 1251140 - Baldr: Implement CtzI. r=jandem (ef6c59485b)
- Bug 1250198: Workaround unaligned memory accesses by masking the low bits; r=sunfish (5e8857f269)
- Bug 1246116: Translate AsmJS loops into wasm opcodes and implement Wasm loops; r=luke (45297bf96e)
- Bug 1251995 part 5 - Unify units of dirty rect used for painting text frame. r=jfkthame (4952922181)
- Bug 1227148 - Add SameObject and NewObject annotations to some ServiceWorkerContainer members; r=bzbarsky (53720dde2f)
- Bug 1238206 - Make ServiceWorkerContainer.getRegistration() return Promise<any>; r=baku (94425218b2)
- Bug 1218139 - Remove ServiceWorkerContainer.onreloadpage; r=bzbarsky (3fe7677476)
- Bug 1251519 Part 1 - Remove nsTextFrameBase as an nsFrame alias. r=mats (956adccf62)
- Bug 1253094, part 6 - Stop using DebugOnly for class/struct members in netwerk/. r=mayhemer (b517f06795)
- reinstantiate accidentally removed w (32fa5b8337)
- Bug 1246775 - fix Canvas2D drawWindow to reacquire its DT after rendering. r=bas (24131c73f7)
- Bug 1256515 - bail out in CanvasRenderingContext2D::DrawWindow if snapshotting draw target fails. r=bas.schouten (75b4d52542)
- Bug 1255172. Fix unsafe reference gc hazards people snuck into DOM code. r=bkelly (6cb8348aa5)
- Bug 1235677 - Wait for helper threads before resetting OOM simulation r=terrence (680b607812)
- Bug 1256672 - Make OOM alloc counters 64 bit. r=terrence (1e4dbbe201)
- Bug 1238207 - make ServiceWorkerGlobalScope.skipWaiting() return Promise<void>; r=baku (6577777f97)
- Bug 1251875 - Part 1: Remove the dom.serviceWorkers.interception.enabled pref; r=bkelly (6bae86b488)
- Bug 1251875 - Part 2: Remove the dom.serviceWorkers.interception.opaque.enabled pref; r=bkelly (9b2946325a)
- Bug 1253094, part 7 - Stop using DebugOnly for class/struct members in storage/. r=mak (9422188881)
2024-02-08 12:08:19 +08:00

108 lines
3.0 KiB
C++

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef CacheIOThread__h__
#define CacheIOThread__h__
#include "nsIThreadInternal.h"
#include "nsISupportsImpl.h"
#include "prthread.h"
#include "nsTArray.h"
#include "nsAutoPtr.h"
#include "mozilla/Monitor.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/Atomics.h"
class nsIRunnable;
namespace mozilla {
namespace net {
class CacheIOThread : public nsIThreadObserver
{
virtual ~CacheIOThread();
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSITHREADOBSERVER
CacheIOThread();
enum ELevel {
OPEN_PRIORITY,
READ_PRIORITY,
OPEN,
READ,
MANAGEMENT,
WRITE,
CLOSE,
INDEX,
EVICT,
LAST_LEVEL,
// This is actually executed as the first level, but we want this enum
// value merely as an indicator while other values are used as indexes
// to the queue array. Hence put at end and not as the first.
XPCOM_LEVEL
};
nsresult Init();
nsresult Dispatch(nsIRunnable* aRunnable, uint32_t aLevel);
// Makes sure that any previously posted event to OPEN or OPEN_PRIORITY
// levels (such as file opennings and dooms) are executed before aRunnable
// that is intended to evict stuff from the cache.
nsresult DispatchAfterPendingOpens(nsIRunnable* aRunnable);
bool IsCurrentThread();
/**
* Callable only on this thread, checks if there is an event waiting in
* the event queue with a higher execution priority. If so, the result
* is true and the current event handler should break it's work and return
* from Run() method immediately. The event handler will be rerun again
* when all more priority events are processed. Events pending after this
* handler (i.e. the one that called YieldAndRerun()) will not execute sooner
* then this handler is executed w/o a call to YieldAndRerun().
*/
static bool YieldAndRerun()
{
return sSelf ? sSelf->YieldInternal() : false;
}
nsresult Shutdown();
already_AddRefed<nsIEventTarget> Target();
// Memory reporting
size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
private:
static void ThreadFunc(void* aClosure);
void ThreadFunc();
void LoopOneLevel(uint32_t aLevel);
bool EventsPending(uint32_t aLastLevel = LAST_LEVEL);
nsresult DispatchInternal(nsIRunnable* aRunnable, uint32_t aLevel);
bool YieldInternal();
static CacheIOThread* sSelf;
mozilla::Monitor mMonitor;
PRThread* mThread;
Atomic<nsIThread *> mXPCOMThread;
Atomic<uint32_t, Relaxed> mLowestLevelWaiting;
uint32_t mCurrentlyExecutingLevel;
nsTArray<nsCOMPtr<nsIRunnable> > mEventQueue[LAST_LEVEL];
Atomic<bool, Relaxed> mHasXPCOMEvents;
bool mRerunCurrentEvent;
bool mShutdown;
#ifdef DEBUG
bool mInsideLoop;
#endif
};
} // namespace net
} // namespace mozilla
#endif