mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
8c296bbcd4
This patch was generated by a script. Here's the source of the script for future reference: function convert() { echo "Converting $1 to $2..." find . ! -wholename "*nsprpub*" \ ! -wholename "*security/nss*" \ ! -wholename "*/.hg*" \ ! -wholename "obj-ff-dbg*" \ ! -name nsXPCOMCID.h \ ! -name prtypes.h \ -type f \ \( -iname "*.cpp" \ -o -iname "*.h" \ -o -iname "*.c" \ -o -iname "*.cc" \ -o -iname "*.idl" \ -o -iname "*.ipdl" \ -o -iname "*.ipdlh" \ -o -iname "*.mm" \) | \ xargs -n 1 sed -i -e "s/\b$1\b/$2/g" } convert PRInt8 int8_t convert PRUint8 uint8_t convert PRInt16 int16_t convert PRUint16 uint16_t convert PRInt32 int32_t convert PRUint32 uint32_t convert PRInt64 int64_t convert PRUint64 uint64_t convert PRIntn int convert PRUintn unsigned convert PRSize size_t convert PROffset32 int32_t convert PROffset64 int64_t convert PRPtrdiff ptrdiff_t convert PRFloat64 double
307 lines
7.3 KiB
C++
307 lines
7.3 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* 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 nsUrlClassifierProxies_h
|
|
#define nsUrlClassifierProxies_h
|
|
|
|
#include "nsIUrlClassifierDBService.h"
|
|
#include "nsThreadUtils.h"
|
|
#include "mozilla/Attributes.h"
|
|
#include "nsIPrincipal.h"
|
|
#include "LookupCache.h"
|
|
|
|
using namespace mozilla::safebrowsing;
|
|
|
|
/**
|
|
* Thread proxy from the main thread to the worker thread.
|
|
*/
|
|
class UrlClassifierDBServiceWorkerProxy MOZ_FINAL :
|
|
public nsIUrlClassifierDBServiceWorker
|
|
{
|
|
public:
|
|
UrlClassifierDBServiceWorkerProxy(nsIUrlClassifierDBServiceWorker* aTarget)
|
|
: mTarget(aTarget)
|
|
{ }
|
|
|
|
NS_DECL_ISUPPORTS
|
|
NS_DECL_NSIURLCLASSIFIERDBSERVICE
|
|
NS_DECL_NSIURLCLASSIFIERDBSERVICEWORKER
|
|
|
|
class LookupRunnable : public nsRunnable
|
|
{
|
|
public:
|
|
LookupRunnable(nsIUrlClassifierDBServiceWorker* aTarget,
|
|
nsIPrincipal* aPrincipal,
|
|
nsIUrlClassifierCallback* aCB)
|
|
: mTarget(aTarget)
|
|
, mPrincipal(aPrincipal)
|
|
, mCB(aCB)
|
|
{ }
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
|
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
|
nsCOMPtr<nsIUrlClassifierCallback> mCB;
|
|
};
|
|
|
|
class GetTablesRunnable : public nsRunnable
|
|
{
|
|
public:
|
|
GetTablesRunnable(nsIUrlClassifierDBServiceWorker* aTarget,
|
|
nsIUrlClassifierCallback* aCB)
|
|
: mTarget(aTarget)
|
|
, mCB(aCB)
|
|
{ }
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
|
|
nsCOMPtr<nsIUrlClassifierCallback> mCB;
|
|
};
|
|
|
|
class BeginUpdateRunnable : public nsRunnable
|
|
{
|
|
public:
|
|
BeginUpdateRunnable(nsIUrlClassifierDBServiceWorker* aTarget,
|
|
nsIUrlClassifierUpdateObserver* aUpdater,
|
|
const nsACString& aTables,
|
|
const nsACString& aClientKey)
|
|
: mTarget(aTarget)
|
|
, mUpdater(aUpdater)
|
|
, mTables(aTables)
|
|
, mClientKey(aClientKey)
|
|
{ }
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
|
|
nsCOMPtr<nsIUrlClassifierUpdateObserver> mUpdater;
|
|
nsCString mTables, mClientKey;
|
|
};
|
|
|
|
class BeginStreamRunnable : public nsRunnable
|
|
{
|
|
public:
|
|
BeginStreamRunnable(nsIUrlClassifierDBServiceWorker* aTarget,
|
|
const nsACString& aTable,
|
|
const nsACString& aServerMAC)
|
|
: mTarget(aTarget)
|
|
, mTable(aTable)
|
|
, mServerMAC(aServerMAC)
|
|
{ }
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
|
|
nsCString mTable, mServerMAC;
|
|
};
|
|
|
|
class UpdateStreamRunnable : public nsRunnable
|
|
{
|
|
public:
|
|
UpdateStreamRunnable(nsIUrlClassifierDBServiceWorker* aTarget,
|
|
const nsACString& aUpdateChunk)
|
|
: mTarget(aTarget)
|
|
, mUpdateChunk(aUpdateChunk)
|
|
{ }
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
|
|
nsCString mUpdateChunk;
|
|
};
|
|
|
|
class CacheCompletionsRunnable : public nsRunnable
|
|
{
|
|
public:
|
|
CacheCompletionsRunnable(nsIUrlClassifierDBServiceWorker* aTarget,
|
|
CacheResultArray *aEntries)
|
|
: mTarget(aTarget)
|
|
, mEntries(aEntries)
|
|
{ }
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
|
|
CacheResultArray *mEntries;
|
|
};
|
|
|
|
class CacheMissesRunnable : public nsRunnable
|
|
{
|
|
public:
|
|
CacheMissesRunnable(nsIUrlClassifierDBServiceWorker* aTarget,
|
|
PrefixArray *aEntries)
|
|
: mTarget(aTarget)
|
|
, mEntries(aEntries)
|
|
{ }
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
|
|
PrefixArray *mEntries;
|
|
};
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
|
|
};
|
|
|
|
// The remaining classes here are all proxies to the main thread
|
|
|
|
class UrlClassifierLookupCallbackProxy MOZ_FINAL :
|
|
public nsIUrlClassifierLookupCallback
|
|
{
|
|
public:
|
|
UrlClassifierLookupCallbackProxy(nsIUrlClassifierLookupCallback* aTarget)
|
|
: mTarget(aTarget)
|
|
{ }
|
|
|
|
NS_DECL_ISUPPORTS
|
|
NS_DECL_NSIURLCLASSIFIERLOOKUPCALLBACK
|
|
|
|
class LookupCompleteRunnable : public nsRunnable
|
|
{
|
|
public:
|
|
LookupCompleteRunnable(nsIUrlClassifierLookupCallback* aTarget,
|
|
LookupResultArray *aResults)
|
|
: mTarget(aTarget)
|
|
, mResults(aResults)
|
|
{ }
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierLookupCallback> mTarget;
|
|
LookupResultArray * mResults;
|
|
};
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierLookupCallback> mTarget;
|
|
};
|
|
|
|
class UrlClassifierCallbackProxy MOZ_FINAL : public nsIUrlClassifierCallback
|
|
{
|
|
public:
|
|
UrlClassifierCallbackProxy(nsIUrlClassifierCallback* aTarget)
|
|
: mTarget(aTarget)
|
|
{ }
|
|
|
|
NS_DECL_ISUPPORTS
|
|
NS_DECL_NSIURLCLASSIFIERCALLBACK
|
|
|
|
class HandleEventRunnable : public nsRunnable
|
|
{
|
|
public:
|
|
HandleEventRunnable(nsIUrlClassifierCallback* aTarget,
|
|
const nsACString& aValue)
|
|
: mTarget(aTarget)
|
|
, mValue(aValue)
|
|
{ }
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierCallback> mTarget;
|
|
nsCString mValue;
|
|
};
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierCallback> mTarget;
|
|
};
|
|
|
|
class UrlClassifierUpdateObserverProxy MOZ_FINAL :
|
|
public nsIUrlClassifierUpdateObserver
|
|
{
|
|
public:
|
|
UrlClassifierUpdateObserverProxy(nsIUrlClassifierUpdateObserver* aTarget)
|
|
: mTarget(aTarget)
|
|
{ }
|
|
|
|
NS_DECL_ISUPPORTS
|
|
NS_DECL_NSIURLCLASSIFIERUPDATEOBSERVER
|
|
|
|
class UpdateUrlRequestedRunnable : public nsRunnable
|
|
{
|
|
public:
|
|
UpdateUrlRequestedRunnable(nsIUrlClassifierUpdateObserver* aTarget,
|
|
const nsACString& aURL,
|
|
const nsACString& aTable,
|
|
const nsACString& aServerMAC)
|
|
: mTarget(aTarget)
|
|
, mURL(aURL)
|
|
, mTable(aTable)
|
|
, mServerMAC(aServerMAC)
|
|
{ }
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierUpdateObserver> mTarget;
|
|
nsCString mURL, mTable, mServerMAC;
|
|
};
|
|
|
|
class StreamFinishedRunnable : public nsRunnable
|
|
{
|
|
public:
|
|
StreamFinishedRunnable(nsIUrlClassifierUpdateObserver* aTarget,
|
|
nsresult aStatus, uint32_t aDelay)
|
|
: mTarget(aTarget)
|
|
, mStatus(aStatus)
|
|
, mDelay(aDelay)
|
|
{ }
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierUpdateObserver> mTarget;
|
|
nsresult mStatus;
|
|
uint32_t mDelay;
|
|
};
|
|
|
|
class UpdateErrorRunnable : public nsRunnable
|
|
{
|
|
public:
|
|
UpdateErrorRunnable(nsIUrlClassifierUpdateObserver* aTarget,
|
|
nsresult aError)
|
|
: mTarget(aTarget)
|
|
, mError(aError)
|
|
{ }
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierUpdateObserver> mTarget;
|
|
nsresult mError;
|
|
};
|
|
|
|
class UpdateSuccessRunnable : public nsRunnable
|
|
{
|
|
public:
|
|
UpdateSuccessRunnable(nsIUrlClassifierUpdateObserver* aTarget,
|
|
uint32_t aRequestedTimeout)
|
|
: mTarget(aTarget)
|
|
, mRequestedTimeout(aRequestedTimeout)
|
|
{ }
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierUpdateObserver> mTarget;
|
|
uint32_t mRequestedTimeout;
|
|
};
|
|
|
|
private:
|
|
nsCOMPtr<nsIUrlClassifierUpdateObserver> mTarget;
|
|
};
|
|
|
|
#endif // nsUrlClassifierProxies_h
|