Bug 1110485 P2 Remove 'P' prefix from non-protocol IPC types in Cache API. r=baku

This commit is contained in:
Ben Kelly 2015-04-14 17:11:19 -07:00
parent 392a37e2f1
commit 4a1b47327d
32 changed files with 283 additions and 291 deletions

View File

@ -22,8 +22,8 @@ namespace {
using mozilla::unused;
using mozilla::dom::cache::CachePushStreamChild;
using mozilla::dom::cache::PCacheReadStream;
using mozilla::dom::cache::PCacheReadStreamOrVoid;
using mozilla::dom::cache::CacheReadStream;
using mozilla::dom::cache::CacheReadStreamOrVoid;
using mozilla::ipc::FileDescriptor;
using mozilla::ipc::FileDescriptorSetChild;
using mozilla::ipc::FileDescriptorSetParent;
@ -36,7 +36,7 @@ enum CleanupAction
};
void
CleanupChildFds(PCacheReadStream& aReadStream, CleanupAction aAction)
CleanupChildFds(CacheReadStream& aReadStream, CleanupAction aAction)
{
if (aReadStream.fds().type() !=
OptionalFileDescriptorSet::TPFileDescriptorSetChild) {
@ -60,7 +60,7 @@ CleanupChildFds(PCacheReadStream& aReadStream, CleanupAction aAction)
}
void
CleanupChildPushStream(PCacheReadStream& aReadStream, CleanupAction aAction)
CleanupChildPushStream(CacheReadStream& aReadStream, CleanupAction aAction)
{
if (!aReadStream.pushStreamChild()) {
return;
@ -79,24 +79,24 @@ CleanupChildPushStream(PCacheReadStream& aReadStream, CleanupAction aAction)
}
void
CleanupChild(PCacheReadStream& aReadStream, CleanupAction aAction)
CleanupChild(CacheReadStream& aReadStream, CleanupAction aAction)
{
CleanupChildFds(aReadStream, aAction);
CleanupChildPushStream(aReadStream, aAction);
}
void
CleanupChild(PCacheReadStreamOrVoid& aReadStreamOrVoid, CleanupAction aAction)
CleanupChild(CacheReadStreamOrVoid& aReadStreamOrVoid, CleanupAction aAction)
{
if (aReadStreamOrVoid.type() == PCacheReadStreamOrVoid::Tvoid_t) {
if (aReadStreamOrVoid.type() == CacheReadStreamOrVoid::Tvoid_t) {
return;
}
CleanupChild(aReadStreamOrVoid.get_PCacheReadStream(), aAction);
CleanupChild(aReadStreamOrVoid.get_CacheReadStream(), aAction);
}
void
CleanupParentFds(PCacheReadStream& aReadStream, CleanupAction aAction)
CleanupParentFds(CacheReadStream& aReadStream, CleanupAction aAction)
{
if (aReadStream.fds().type() !=
OptionalFileDescriptorSet::TPFileDescriptorSetParent) {
@ -120,13 +120,13 @@ CleanupParentFds(PCacheReadStream& aReadStream, CleanupAction aAction)
}
void
CleanupParentFds(PCacheReadStreamOrVoid& aReadStreamOrVoid, CleanupAction aAction)
CleanupParentFds(CacheReadStreamOrVoid& aReadStreamOrVoid, CleanupAction aAction)
{
if (aReadStreamOrVoid.type() == PCacheReadStreamOrVoid::Tvoid_t) {
if (aReadStreamOrVoid.type() == CacheReadStreamOrVoid::Tvoid_t) {
return;
}
CleanupParentFds(aReadStreamOrVoid.get_PCacheReadStream(), aAction);
CleanupParentFds(aReadStreamOrVoid.get_CacheReadStream(), aAction);
}
} // anonymous namespace
@ -162,10 +162,10 @@ AutoChildOpArgs::~AutoChildOpArgs()
case CacheOpArgs::TCacheMatchAllArgs:
{
CacheMatchAllArgs& args = mOpArgs.get_CacheMatchAllArgs();
if (args.requestOrVoid().type() == PCacheRequestOrVoid::Tvoid_t) {
if (args.requestOrVoid().type() == CacheRequestOrVoid::Tvoid_t) {
break;
}
CleanupChild(args.requestOrVoid().get_PCacheRequest().body(), action);
CleanupChild(args.requestOrVoid().get_CacheRequest().body(), action);
break;
}
case CacheOpArgs::TCacheAddAllArgs:
@ -196,10 +196,10 @@ AutoChildOpArgs::~AutoChildOpArgs()
case CacheOpArgs::TCacheKeysArgs:
{
CacheKeysArgs& args = mOpArgs.get_CacheKeysArgs();
if (args.requestOrVoid().type() == PCacheRequestOrVoid::Tvoid_t) {
if (args.requestOrVoid().type() == CacheRequestOrVoid::Tvoid_t) {
break;
}
CleanupChild(args.requestOrVoid().get_PCacheRequest().body(), action);
CleanupChild(args.requestOrVoid().get_CacheRequest().body(), action);
break;
}
case CacheOpArgs::TStorageMatchArgs:
@ -225,16 +225,16 @@ AutoChildOpArgs::Add(InternalRequest* aRequest, BodyAction aBodyAction,
case CacheOpArgs::TCacheMatchArgs:
{
CacheMatchArgs& args = mOpArgs.get_CacheMatchArgs();
mTypeUtils->ToPCacheRequest(args.request(), aRequest, aBodyAction,
mTypeUtils->ToCacheRequest(args.request(), aRequest, aBodyAction,
aReferrerAction, aSchemeAction, aRv);
break;
}
case CacheOpArgs::TCacheMatchAllArgs:
{
CacheMatchAllArgs& args = mOpArgs.get_CacheMatchAllArgs();
MOZ_ASSERT(args.requestOrVoid().type() == PCacheRequestOrVoid::Tvoid_t);
args.requestOrVoid() = PCacheRequest();
mTypeUtils->ToPCacheRequest(args.requestOrVoid().get_PCacheRequest(),
MOZ_ASSERT(args.requestOrVoid().type() == CacheRequestOrVoid::Tvoid_t);
args.requestOrVoid() = CacheRequest();
mTypeUtils->ToCacheRequest(args.requestOrVoid().get_CacheRequest(),
aRequest, aBodyAction, aReferrerAction,
aSchemeAction, aRv);
break;
@ -250,9 +250,9 @@ AutoChildOpArgs::Add(InternalRequest* aRequest, BodyAction aBodyAction,
//
// Avoid a lot of this hassle by making sure we only create one here. On
// error we remove it.
PCacheRequest& request = *args.requestList().AppendElement();
CacheRequest& request = *args.requestList().AppendElement();
mTypeUtils->ToPCacheRequest(request, aRequest, aBodyAction,
mTypeUtils->ToCacheRequest(request, aRequest, aBodyAction,
aReferrerAction, aSchemeAction, aRv);
if (aRv.Failed()) {
args.requestList().RemoveElementAt(args.requestList().Length() - 1);
@ -262,16 +262,16 @@ AutoChildOpArgs::Add(InternalRequest* aRequest, BodyAction aBodyAction,
case CacheOpArgs::TCacheDeleteArgs:
{
CacheDeleteArgs& args = mOpArgs.get_CacheDeleteArgs();
mTypeUtils->ToPCacheRequest(args.request(), aRequest, aBodyAction,
mTypeUtils->ToCacheRequest(args.request(), aRequest, aBodyAction,
aReferrerAction, aSchemeAction, aRv);
break;
}
case CacheOpArgs::TCacheKeysArgs:
{
CacheKeysArgs& args = mOpArgs.get_CacheKeysArgs();
MOZ_ASSERT(args.requestOrVoid().type() == PCacheRequestOrVoid::Tvoid_t);
args.requestOrVoid() = PCacheRequest();
mTypeUtils->ToPCacheRequest(args.requestOrVoid().get_PCacheRequest(),
MOZ_ASSERT(args.requestOrVoid().type() == CacheRequestOrVoid::Tvoid_t);
args.requestOrVoid() = CacheRequest();
mTypeUtils->ToCacheRequest(args.requestOrVoid().get_CacheRequest(),
aRequest, aBodyAction, aReferrerAction,
aSchemeAction, aRv);
break;
@ -279,7 +279,7 @@ AutoChildOpArgs::Add(InternalRequest* aRequest, BodyAction aBodyAction,
case CacheOpArgs::TStorageMatchArgs:
{
StorageMatchArgs& args = mOpArgs.get_StorageMatchArgs();
mTypeUtils->ToPCacheRequest(args.request(), aRequest, aBodyAction,
mTypeUtils->ToCacheRequest(args.request(), aRequest, aBodyAction,
aReferrerAction, aSchemeAction, aRv);
break;
}
@ -311,10 +311,10 @@ AutoChildOpArgs::Add(InternalRequest* aRequest, BodyAction aBodyAction,
pair.request().body() = void_t();
pair.response().body() = void_t();
mTypeUtils->ToPCacheRequest(pair.request(), aRequest, aBodyAction,
mTypeUtils->ToCacheRequest(pair.request(), aRequest, aBodyAction,
aReferrerAction, aSchemeAction, aRv);
if (!aRv.Failed()) {
mTypeUtils->ToPCacheResponse(pair.response(), aResponse, aRv);
mTypeUtils->ToCacheResponse(pair.response(), aResponse, aRv);
}
if (aRv.Failed()) {
@ -358,10 +358,10 @@ AutoParentOpResult::~AutoParentOpResult()
case CacheOpResult::TCacheMatchResult:
{
CacheMatchResult& result = mOpResult.get_CacheMatchResult();
if (result.responseOrVoid().type() == PCacheResponseOrVoid::Tvoid_t) {
if (result.responseOrVoid().type() == CacheResponseOrVoid::Tvoid_t) {
break;
}
CleanupParentFds(result.responseOrVoid().get_PCacheResponse().body(),
CleanupParentFds(result.responseOrVoid().get_CacheResponse().body(),
action);
break;
}
@ -384,10 +384,10 @@ AutoParentOpResult::~AutoParentOpResult()
case CacheOpResult::TStorageMatchResult:
{
StorageMatchResult& result = mOpResult.get_StorageMatchResult();
if (result.responseOrVoid().type() == PCacheResponseOrVoid::Tvoid_t) {
if (result.responseOrVoid().type() == CacheResponseOrVoid::Tvoid_t) {
break;
}
CleanupParentFds(result.responseOrVoid().get_PCacheResponse().body(),
CleanupParentFds(result.responseOrVoid().get_CacheResponse().body(),
action);
break;
}
@ -428,10 +428,10 @@ AutoParentOpResult::Add(const SavedResponse& aSavedResponse,
case CacheOpResult::TCacheMatchResult:
{
CacheMatchResult& result = mOpResult.get_CacheMatchResult();
MOZ_ASSERT(result.responseOrVoid().type() == PCacheResponseOrVoid::Tvoid_t);
MOZ_ASSERT(result.responseOrVoid().type() == CacheResponseOrVoid::Tvoid_t);
result.responseOrVoid() = aSavedResponse.mValue;
SerializeResponseBody(aSavedResponse, aStreamList,
&result.responseOrVoid().get_PCacheResponse());
&result.responseOrVoid().get_CacheResponse());
break;
}
case CacheOpResult::TCacheMatchAllResult:
@ -445,10 +445,10 @@ AutoParentOpResult::Add(const SavedResponse& aSavedResponse,
case CacheOpResult::TStorageMatchResult:
{
StorageMatchResult& result = mOpResult.get_StorageMatchResult();
MOZ_ASSERT(result.responseOrVoid().type() == PCacheResponseOrVoid::Tvoid_t);
MOZ_ASSERT(result.responseOrVoid().type() == CacheResponseOrVoid::Tvoid_t);
result.responseOrVoid() = aSavedResponse.mValue;
SerializeResponseBody(aSavedResponse, aStreamList,
&result.responseOrVoid().get_PCacheResponse());
&result.responseOrVoid().get_CacheResponse());
break;
}
default:
@ -467,16 +467,16 @@ AutoParentOpResult::Add(const SavedRequest& aSavedRequest,
{
CacheKeysResult& result = mOpResult.get_CacheKeysResult();
result.requestList().AppendElement(aSavedRequest.mValue);
PCacheRequest& request = result.requestList().LastElement();
CacheRequest& request = result.requestList().LastElement();
if (!aSavedRequest.mHasBodyId) {
request.body() = void_t();
break;
}
request.body() = PCacheReadStream();
request.body() = CacheReadStream();
SerializeReadStream(aSavedRequest.mBodyId, aStreamList,
&request.body().get_PCacheReadStream());
&request.body().get_CacheReadStream());
break;
}
default:
@ -495,7 +495,7 @@ AutoParentOpResult::SendAsOpResult()
void
AutoParentOpResult::SerializeResponseBody(const SavedResponse& aSavedResponse,
StreamList* aStreamList,
PCacheResponse* aResponseOut)
CacheResponse* aResponseOut)
{
MOZ_ASSERT(aResponseOut);
@ -504,14 +504,14 @@ AutoParentOpResult::SerializeResponseBody(const SavedResponse& aSavedResponse,
return;
}
aResponseOut->body() = PCacheReadStream();
aResponseOut->body() = CacheReadStream();
SerializeReadStream(aSavedResponse.mBodyId, aStreamList,
&aResponseOut->body().get_PCacheReadStream());
&aResponseOut->body().get_CacheReadStream());
}
void
AutoParentOpResult::SerializeReadStream(const nsID& aId, StreamList* aStreamList,
PCacheReadStream* aReadStreamOut)
CacheReadStream* aReadStreamOut)
{
MOZ_ASSERT(aStreamList);
MOZ_ASSERT(aReadStreamOut);

View File

@ -8,7 +8,7 @@
#define mozilla_dom_cache_AutoUtils_h
#include "mozilla/Attributes.h"
#include "mozilla/dom/cache/PCacheTypes.h"
#include "mozilla/dom/cache/CacheTypes.h"
#include "mozilla/dom/cache/Types.h"
#include "mozilla/dom/cache/TypeUtils.h"
#include "nsTArray.h"
@ -84,10 +84,10 @@ public:
private:
void SerializeResponseBody(const SavedResponse& aSavedResponse,
StreamList* aStreamList,
PCacheResponse* aResponseOut);
CacheResponse* aResponseOut);
void SerializeReadStream(const nsID& aId, StreamList* aStreamList,
PCacheReadStream* aReadStreamOut);
CacheReadStream* aReadStreamOut);
mozilla::ipc::PBackgroundParent* mManager;
CacheOpResult mOpResult;

20
dom/cache/Cache.cpp vendored
View File

@ -106,10 +106,10 @@ Cache::Match(const RequestOrUSVString& aRequest,
return nullptr;
}
PCacheQueryParams params;
ToPCacheQueryParams(params, aOptions);
CacheQueryParams params;
ToCacheQueryParams(params, aOptions);
AutoChildOpArgs args(this, CacheMatchArgs(PCacheRequest(), params));
AutoChildOpArgs args(this, CacheMatchArgs(CacheRequest(), params));
args.Add(ir, IgnoreBody, PassThroughReferrer, IgnoreInvalidScheme, aRv);
if (NS_WARN_IF(aRv.Failed())) {
@ -125,8 +125,8 @@ Cache::MatchAll(const Optional<RequestOrUSVString>& aRequest,
{
MOZ_ASSERT(mActor);
PCacheQueryParams params;
ToPCacheQueryParams(params, aOptions);
CacheQueryParams params;
ToCacheQueryParams(params, aOptions);
AutoChildOpArgs args(this, CacheMatchAllArgs(void_t(), params));
@ -246,10 +246,10 @@ Cache::Delete(const RequestOrUSVString& aRequest,
return nullptr;
}
PCacheQueryParams params;
ToPCacheQueryParams(params, aOptions);
CacheQueryParams params;
ToCacheQueryParams(params, aOptions);
AutoChildOpArgs args(this, CacheDeleteArgs(PCacheRequest(), params));
AutoChildOpArgs args(this, CacheDeleteArgs(CacheRequest(), params));
args.Add(ir, IgnoreBody, PassThroughReferrer, IgnoreInvalidScheme, aRv);
if (aRv.Failed()) {
@ -265,8 +265,8 @@ Cache::Keys(const Optional<RequestOrUSVString>& aRequest,
{
MOZ_ASSERT(mActor);
PCacheQueryParams params;
ToPCacheQueryParams(params, aOptions);
CacheQueryParams params;
ToCacheQueryParams(params, aOptions);
AutoChildOpArgs args(this, CacheKeysArgs(void_t(), params));

View File

@ -155,10 +155,10 @@ CacheOpChild::CreatePushStream(nsIAsyncInputStream* aStream)
}
void
CacheOpChild::HandleResponse(const PCacheResponseOrVoid& aResponseOrVoid)
CacheOpChild::HandleResponse(const CacheResponseOrVoid& aResponseOrVoid)
{
nsRefPtr<Response> response;
if (aResponseOrVoid.type() == PCacheResponseOrVoid::TPCacheResponse) {
if (aResponseOrVoid.type() == CacheResponseOrVoid::TCacheResponse) {
response = ToResponse(aResponseOrVoid);
}
@ -171,7 +171,7 @@ CacheOpChild::HandleResponse(const PCacheResponseOrVoid& aResponseOrVoid)
}
void
CacheOpChild::HandleResponseList(const nsTArray<PCacheResponse>& aResponseList)
CacheOpChild::HandleResponseList(const nsTArray<CacheResponse>& aResponseList)
{
nsAutoTArray<nsRefPtr<Response>, 256> responses;
responses.SetCapacity(aResponseList.Length());
@ -184,7 +184,7 @@ CacheOpChild::HandleResponseList(const nsTArray<PCacheResponse>& aResponseList)
}
void
CacheOpChild::HandleRequestList(const nsTArray<PCacheRequest>& aRequestList)
CacheOpChild::HandleRequestList(const nsTArray<CacheRequest>& aRequestList)
{
nsAutoTArray<nsRefPtr<Request>, 256> requests;
requests.SetCapacity(aRequestList.Length());

View File

@ -56,13 +56,13 @@ private:
// Utility methods
void
HandleResponse(const PCacheResponseOrVoid& aResponseOrVoid);
HandleResponse(const CacheResponseOrVoid& aResponseOrVoid);
void
HandleResponseList(const nsTArray<PCacheResponse>& aResponseList);
HandleResponseList(const nsTArray<CacheResponse>& aResponseList);
void
HandleRequestList(const nsTArray<PCacheRequest>& aRequestList);
HandleRequestList(const nsTArray<CacheRequest>& aRequestList);
nsCOMPtr<nsIGlobalObject> mGlobal;
nsCOMPtr<nsISupports> mParent;

View File

@ -77,7 +77,7 @@ CacheOpParent::Execute(Manager* aManager)
MOZ_ASSERT(mCacheId != INVALID_CACHE_ID);
const CacheAddAllArgs& args = mOpArgs.get_CacheAddAllArgs();
const nsTArray<PCacheRequest>& list = args.requestList();
const nsTArray<CacheRequest>& list = args.requestList();
nsAutoTArray<nsCOMPtr<nsIInputStream>, 256> requestStreamList;
for (uint32_t i = 0; i < list.Length(); ++i) {
@ -232,14 +232,14 @@ CacheOpParent::OnFetchPut(FetchPut* aFetchPut, nsresult aRv)
}
already_AddRefed<nsIInputStream>
CacheOpParent::DeserializeCacheStream(const PCacheReadStreamOrVoid& aStreamOrVoid)
CacheOpParent::DeserializeCacheStream(const CacheReadStreamOrVoid& aStreamOrVoid)
{
if (aStreamOrVoid.type() == PCacheReadStreamOrVoid::Tvoid_t) {
if (aStreamOrVoid.type() == CacheReadStreamOrVoid::Tvoid_t) {
return nullptr;
}
nsCOMPtr<nsIInputStream> stream;
const PCacheReadStream& readStream = aStreamOrVoid.get_PCacheReadStream();
const CacheReadStream& readStream = aStreamOrVoid.get_CacheReadStream();
// Option 1: A push stream actor was sent for nsPipe data
if (readStream.pushStreamParent()) {

View File

@ -67,7 +67,7 @@ private:
// utility methods
already_AddRefed<nsIInputStream>
DeserializeCacheStream(const PCacheReadStreamOrVoid& aStreamOrVoid);
DeserializeCacheStream(const CacheReadStreamOrVoid& aStreamOrVoid);
mozilla::ipc::PBackgroundParent* mIpcManager;
const CacheId mCacheId;

View File

@ -194,12 +194,12 @@ CacheStorage::Match(const RequestOrUSVString& aRequest,
return nullptr;
}
PCacheQueryParams params;
ToPCacheQueryParams(params, aOptions);
CacheQueryParams params;
ToCacheQueryParams(params, aOptions);
nsAutoPtr<Entry> entry(new Entry());
entry->mPromise = promise;
entry->mArgs = StorageMatchArgs(PCacheRequest(), params);
entry->mArgs = StorageMatchArgs(CacheRequest(), params);
entry->mRequest = request;
mPendingRequests.AppendElement(entry.forget());

View File

@ -37,10 +37,8 @@ namespace workers {
namespace cache {
class CacheChild;
class CacheStorageChild;
class Feature;
class PCacheResponseOrVoid;
class CacheStorage final : public nsIIPCBackgroundChildCreateCallback
, public nsWrapperCache

View File

@ -9,7 +9,7 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/unused.h"
#include "mozilla/dom/cache/ActorUtils.h"
#include "mozilla/dom/cache/PCacheTypes.h"
#include "mozilla/dom/cache/CacheTypes.h"
#include "mozilla/dom/cache/ReadStream.h"
#include "mozilla/ipc/FileDescriptorSetChild.h"
#include "mozilla/ipc/PBackgroundChild.h"
@ -69,7 +69,7 @@ CacheStreamControlChild::StartDestroy()
}
void
CacheStreamControlChild::SerializeControl(PCacheReadStream* aReadStreamOut)
CacheStreamControlChild::SerializeControl(CacheReadStream* aReadStreamOut)
{
NS_ASSERT_OWNINGTHREAD(CacheStreamControlChild);
aReadStreamOut->controlParent() = nullptr;
@ -77,7 +77,7 @@ CacheStreamControlChild::SerializeControl(PCacheReadStream* aReadStreamOut)
}
void
CacheStreamControlChild::SerializeFds(PCacheReadStream* aReadStreamOut,
CacheStreamControlChild::SerializeFds(CacheReadStream* aReadStreamOut,
const nsTArray<FileDescriptor>& aFds)
{
NS_ASSERT_OWNINGTHREAD(CacheStreamControlChild);
@ -97,7 +97,7 @@ CacheStreamControlChild::SerializeFds(PCacheReadStream* aReadStreamOut,
}
void
CacheStreamControlChild::DeserializeFds(const PCacheReadStream& aReadStream,
CacheStreamControlChild::DeserializeFds(const CacheReadStream& aReadStream,
nsTArray<FileDescriptor>& aFdsOut)
{
if (aReadStream.fds().type() !=

View File

@ -31,14 +31,14 @@ public:
// StreamControl methods
virtual void
SerializeControl(PCacheReadStream* aReadStreamOut) override;
SerializeControl(CacheReadStream* aReadStreamOut) override;
virtual void
SerializeFds(PCacheReadStream* aReadStreamOut,
SerializeFds(CacheReadStream* aReadStreamOut,
const nsTArray<mozilla::ipc::FileDescriptor>& aFds) override;
virtual void
DeserializeFds(const PCacheReadStream& aReadStream,
DeserializeFds(const CacheReadStream& aReadStream,
nsTArray<mozilla::ipc::FileDescriptor>& aFdsOut) override;
private:

View File

@ -8,7 +8,7 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/unused.h"
#include "mozilla/dom/cache/PCacheTypes.h"
#include "mozilla/dom/cache/CacheTypes.h"
#include "mozilla/dom/cache/ReadStream.h"
#include "mozilla/dom/cache/StreamList.h"
#include "mozilla/ipc/FileDescriptorSetParent.h"
@ -45,7 +45,7 @@ CacheStreamControlParent::~CacheStreamControlParent()
}
void
CacheStreamControlParent::SerializeControl(PCacheReadStream* aReadStreamOut)
CacheStreamControlParent::SerializeControl(CacheReadStream* aReadStreamOut)
{
NS_ASSERT_OWNINGTHREAD(CacheStreamControlParent);
aReadStreamOut->controlChild() = nullptr;
@ -53,7 +53,7 @@ CacheStreamControlParent::SerializeControl(PCacheReadStream* aReadStreamOut)
}
void
CacheStreamControlParent::SerializeFds(PCacheReadStream* aReadStreamOut,
CacheStreamControlParent::SerializeFds(CacheReadStream* aReadStreamOut,
const nsTArray<FileDescriptor>& aFds)
{
NS_ASSERT_OWNINGTHREAD(CacheStreamControlParent);
@ -73,7 +73,7 @@ CacheStreamControlParent::SerializeFds(PCacheReadStream* aReadStreamOut,
}
void
CacheStreamControlParent::DeserializeFds(const PCacheReadStream& aReadStream,
CacheStreamControlParent::DeserializeFds(const CacheReadStream& aReadStream,
nsTArray<FileDescriptor>& aFdsOut)
{
if (aReadStream.fds().type() !=

View File

@ -32,14 +32,14 @@ public:
// StreamControl methods
virtual void
SerializeControl(PCacheReadStream* aReadStreamOut) override;
SerializeControl(CacheReadStream* aReadStreamOut) override;
virtual void
SerializeFds(PCacheReadStream* aReadStreamOut,
SerializeFds(CacheReadStream* aReadStreamOut,
const nsTArray<mozilla::ipc::FileDescriptor>& aFds) override;
virtual void
DeserializeFds(const PCacheReadStream& aReadStream,
DeserializeFds(const CacheReadStream& aReadStream,
nsTArray<mozilla::ipc::FileDescriptor>& aFdsOut) override;
private:

View File

@ -21,7 +21,7 @@ namespace mozilla {
namespace dom {
namespace cache {
struct PCacheQueryParams
struct CacheQueryParams
{
bool ignoreSearch;
bool ignoreMethod;
@ -30,7 +30,7 @@ struct PCacheQueryParams
nsString cacheName;
};
struct PCacheReadStream
struct CacheReadStream
{
nsID id;
OptionalInputStreamParams params;
@ -39,13 +39,13 @@ struct PCacheReadStream
nullable PCachePushStream pushStream;
};
union PCacheReadStreamOrVoid
union CacheReadStreamOrVoid
{
void_t;
PCacheReadStream;
CacheReadStream;
};
struct PCacheRequest
struct CacheRequest
{
nsCString method;
nsString url;
@ -55,19 +55,19 @@ struct PCacheRequest
nsString referrer;
RequestMode mode;
RequestCredentials credentials;
PCacheReadStreamOrVoid body;
CacheReadStreamOrVoid body;
uint32_t contentPolicyType;
RequestContext context;
RequestCache requestCache;
};
union PCacheRequestOrVoid
union CacheRequestOrVoid
{
void_t;
PCacheRequest;
CacheRequest;
};
struct PCacheResponse
struct CacheResponse
{
ResponseType type;
nsString url;
@ -75,37 +75,37 @@ struct PCacheResponse
nsCString statusText;
PHeadersEntry[] headers;
HeadersGuardEnum headersGuard;
PCacheReadStreamOrVoid body;
CacheReadStreamOrVoid body;
nsCString securityInfo;
};
union PCacheResponseOrVoid
union CacheResponseOrVoid
{
void_t;
PCacheResponse;
CacheResponse;
};
struct CacheRequestResponse
{
PCacheRequest request;
PCacheResponse response;
CacheRequest request;
CacheResponse response;
};
struct CacheMatchArgs
{
PCacheRequest request;
PCacheQueryParams params;
CacheRequest request;
CacheQueryParams params;
};
struct CacheMatchAllArgs
{
PCacheRequestOrVoid requestOrVoid;
PCacheQueryParams params;
CacheRequestOrVoid requestOrVoid;
CacheQueryParams params;
};
struct CacheAddAllArgs
{
PCacheRequest[] requestList;
CacheRequest[] requestList;
};
struct CachePutAllArgs
@ -115,20 +115,20 @@ struct CachePutAllArgs
struct CacheDeleteArgs
{
PCacheRequest request;
PCacheQueryParams params;
CacheRequest request;
CacheQueryParams params;
};
struct CacheKeysArgs
{
PCacheRequestOrVoid requestOrVoid;
PCacheQueryParams params;
CacheRequestOrVoid requestOrVoid;
CacheQueryParams params;
};
struct StorageMatchArgs
{
PCacheRequest request;
PCacheQueryParams params;
CacheRequest request;
CacheQueryParams params;
};
struct StorageHasArgs
@ -167,12 +167,12 @@ union CacheOpArgs
struct CacheMatchResult
{
PCacheResponseOrVoid responseOrVoid;
CacheResponseOrVoid responseOrVoid;
};
struct CacheMatchAllResult
{
PCacheResponse[] responseList;
CacheResponse[] responseList;
};
struct CacheAddAllResult
@ -190,12 +190,12 @@ struct CacheDeleteResult
struct CacheKeysResult
{
PCacheRequest[] requestList;
CacheRequest[] requestList;
};
struct StorageMatchResult
{
PCacheResponseOrVoid responseOrVoid;
CacheResponseOrVoid responseOrVoid;
};
struct StorageHasResult

View File

@ -8,7 +8,7 @@
#include "ipc/IPCMessageUtils.h"
#include "mozilla/dom/InternalHeaders.h"
#include "mozilla/dom/cache/PCacheTypes.h"
#include "mozilla/dom/cache/CacheTypes.h"
#include "mozilla/dom/cache/SavedTypes.h"
#include "mozIStorageConnection.h"
#include "mozIStorageStatement.h"
@ -417,8 +417,8 @@ DBSchema::IsCacheOrphaned(mozIStorageConnection* aConn,
// static
nsresult
DBSchema::CacheMatch(mozIStorageConnection* aConn, CacheId aCacheId,
const PCacheRequest& aRequest,
const PCacheQueryParams& aParams,
const CacheRequest& aRequest,
const CacheQueryParams& aParams,
bool* aFoundResponseOut,
SavedResponse* aSavedResponseOut)
{
@ -449,8 +449,8 @@ DBSchema::CacheMatch(mozIStorageConnection* aConn, CacheId aCacheId,
// static
nsresult
DBSchema::CacheMatchAll(mozIStorageConnection* aConn, CacheId aCacheId,
const PCacheRequestOrVoid& aRequestOrVoid,
const PCacheQueryParams& aParams,
const CacheRequestOrVoid& aRequestOrVoid,
const CacheQueryParams& aParams,
nsTArray<SavedResponse>& aSavedResponsesOut)
{
MOZ_ASSERT(!NS_IsMainThread());
@ -458,7 +458,7 @@ DBSchema::CacheMatchAll(mozIStorageConnection* aConn, CacheId aCacheId,
nsresult rv;
nsAutoTArray<EntryId, 256> matches;
if (aRequestOrVoid.type() == PCacheRequestOrVoid::Tvoid_t) {
if (aRequestOrVoid.type() == CacheRequestOrVoid::Tvoid_t) {
rv = QueryAll(aConn, aCacheId, matches);
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
} else {
@ -481,16 +481,16 @@ DBSchema::CacheMatchAll(mozIStorageConnection* aConn, CacheId aCacheId,
// static
nsresult
DBSchema::CachePut(mozIStorageConnection* aConn, CacheId aCacheId,
const PCacheRequest& aRequest,
const CacheRequest& aRequest,
const nsID* aRequestBodyId,
const PCacheResponse& aResponse,
const CacheResponse& aResponse,
const nsID* aResponseBodyId,
nsTArray<nsID>& aDeletedBodyIdListOut)
{
MOZ_ASSERT(!NS_IsMainThread());
MOZ_ASSERT(aConn);
PCacheQueryParams params(false, false, false, false,
CacheQueryParams params(false, false, false, false,
NS_LITERAL_STRING(""));
nsAutoTArray<EntryId, 256> matches;
nsresult rv = QueryCache(aConn, aCacheId, aRequest, params, matches);
@ -509,8 +509,8 @@ DBSchema::CachePut(mozIStorageConnection* aConn, CacheId aCacheId,
// static
nsresult
DBSchema::CacheDelete(mozIStorageConnection* aConn, CacheId aCacheId,
const PCacheRequest& aRequest,
const PCacheQueryParams& aParams,
const CacheRequest& aRequest,
const CacheQueryParams& aParams,
nsTArray<nsID>& aDeletedBodyIdListOut, bool* aSuccessOut)
{
MOZ_ASSERT(!NS_IsMainThread());
@ -538,8 +538,8 @@ DBSchema::CacheDelete(mozIStorageConnection* aConn, CacheId aCacheId,
// static
nsresult
DBSchema::CacheKeys(mozIStorageConnection* aConn, CacheId aCacheId,
const PCacheRequestOrVoid& aRequestOrVoid,
const PCacheQueryParams& aParams,
const CacheRequestOrVoid& aRequestOrVoid,
const CacheQueryParams& aParams,
nsTArray<SavedRequest>& aSavedRequestsOut)
{
MOZ_ASSERT(!NS_IsMainThread());
@ -547,7 +547,7 @@ DBSchema::CacheKeys(mozIStorageConnection* aConn, CacheId aCacheId,
nsresult rv;
nsAutoTArray<EntryId, 256> matches;
if (aRequestOrVoid.type() == PCacheRequestOrVoid::Tvoid_t) {
if (aRequestOrVoid.type() == CacheRequestOrVoid::Tvoid_t) {
rv = QueryAll(aConn, aCacheId, matches);
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
} else {
@ -571,8 +571,8 @@ DBSchema::CacheKeys(mozIStorageConnection* aConn, CacheId aCacheId,
nsresult
DBSchema::StorageMatch(mozIStorageConnection* aConn,
Namespace aNamespace,
const PCacheRequest& aRequest,
const PCacheQueryParams& aParams,
const CacheRequest& aRequest,
const CacheQueryParams& aParams,
bool* aFoundResponseOut,
SavedResponse* aSavedResponseOut)
{
@ -793,8 +793,8 @@ DBSchema::QueryAll(mozIStorageConnection* aConn, CacheId aCacheId,
// static
nsresult
DBSchema::QueryCache(mozIStorageConnection* aConn, CacheId aCacheId,
const PCacheRequest& aRequest,
const PCacheQueryParams& aParams,
const CacheRequest& aRequest,
const CacheQueryParams& aParams,
nsTArray<EntryId>& aEntryIdListOut,
uint32_t aMaxResults)
{
@ -871,7 +871,7 @@ DBSchema::QueryCache(mozIStorageConnection* aConn, CacheId aCacheId,
// static
nsresult
DBSchema::MatchByVaryHeader(mozIStorageConnection* aConn,
const PCacheRequest& aRequest,
const CacheRequest& aRequest,
EntryId entryId, bool* aSuccessOut)
{
MOZ_ASSERT(!NS_IsMainThread());
@ -1071,9 +1071,9 @@ DBSchema::DeleteEntries(mozIStorageConnection* aConn,
// static
nsresult
DBSchema::InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
const PCacheRequest& aRequest,
const CacheRequest& aRequest,
const nsID* aRequestBodyId,
const PCacheResponse& aResponse,
const CacheResponse& aResponse,
const nsID* aResponseBodyId)
{
MOZ_ASSERT(!NS_IsMainThread());

42
dom/cache/DBSchema.h vendored
View File

@ -21,10 +21,10 @@ namespace mozilla {
namespace dom {
namespace cache {
class PCacheQueryParams;
class PCacheRequest;
class PCacheRequestOrVoid;
class PCacheResponse;
class CacheQueryParams;
class CacheRequest;
class CacheRequestOrVoid;
class CacheResponse;
struct SavedRequest;
struct SavedResponse;
@ -46,34 +46,34 @@ public:
CacheId aCacheId, bool* aOrphanedOut);
static nsresult CacheMatch(mozIStorageConnection* aConn, CacheId aCacheId,
const PCacheRequest& aRequest,
const PCacheQueryParams& aParams,
const CacheRequest& aRequest,
const CacheQueryParams& aParams,
bool* aFoundResponseOut,
SavedResponse* aSavedResponseOut);
static nsresult CacheMatchAll(mozIStorageConnection* aConn, CacheId aCacheId,
const PCacheRequestOrVoid& aRequestOrVoid,
const PCacheQueryParams& aParams,
const CacheRequestOrVoid& aRequestOrVoid,
const CacheQueryParams& aParams,
nsTArray<SavedResponse>& aSavedResponsesOut);
static nsresult CachePut(mozIStorageConnection* aConn, CacheId aCacheId,
const PCacheRequest& aRequest,
const CacheRequest& aRequest,
const nsID* aRequestBodyId,
const PCacheResponse& aResponse,
const CacheResponse& aResponse,
const nsID* aResponseBodyId,
nsTArray<nsID>& aDeletedBodyIdListOut);
static nsresult CacheDelete(mozIStorageConnection* aConn, CacheId aCacheId,
const PCacheRequest& aRequest,
const PCacheQueryParams& aParams,
const CacheRequest& aRequest,
const CacheQueryParams& aParams,
nsTArray<nsID>& aDeletedBodyIdListOut,
bool* aSuccessOut);
static nsresult CacheKeys(mozIStorageConnection* aConn, CacheId aCacheId,
const PCacheRequestOrVoid& aRequestOrVoid,
const PCacheQueryParams& aParams,
const CacheRequestOrVoid& aRequestOrVoid,
const CacheQueryParams& aParams,
nsTArray<SavedRequest>& aSavedRequestsOut);
static nsresult StorageMatch(mozIStorageConnection* aConn,
Namespace aNamespace,
const PCacheRequest& aRequest,
const PCacheQueryParams& aParams,
const CacheRequest& aRequest,
const CacheQueryParams& aParams,
bool* aFoundResponseOut,
SavedResponse* aSavedResponseOut);
static nsresult StorageGetCacheId(mozIStorageConnection* aConn,
@ -98,21 +98,21 @@ private:
static nsresult QueryAll(mozIStorageConnection* aConn, CacheId aCacheId,
nsTArray<EntryId>& aEntryIdListOut);
static nsresult QueryCache(mozIStorageConnection* aConn, CacheId aCacheId,
const PCacheRequest& aRequest,
const PCacheQueryParams& aParams,
const CacheRequest& aRequest,
const CacheQueryParams& aParams,
nsTArray<EntryId>& aEntryIdListOut,
uint32_t aMaxResults = UINT32_MAX);
static nsresult MatchByVaryHeader(mozIStorageConnection* aConn,
const PCacheRequest& aRequest,
const CacheRequest& aRequest,
EntryId entryId, bool* aSuccessOut);
static nsresult DeleteEntries(mozIStorageConnection* aConn,
const nsTArray<EntryId>& aEntryIdList,
nsTArray<nsID>& aDeletedBodyIdListOut,
uint32_t aPos=0, int32_t aLen=-1);
static nsresult InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
const PCacheRequest& aRequest,
const CacheRequest& aRequest,
const nsID* aRequestBodyId,
const PCacheResponse& aResponse,
const CacheResponse& aResponse,
const nsID* aResponseBodyId);
static nsresult ReadResponse(mozIStorageConnection* aConn, EntryId aEntryId,
SavedResponse* aSavedResponseOut);

View File

@ -16,7 +16,6 @@
#include "mozilla/dom/ResponseBinding.h"
#include "mozilla/dom/UnionTypes.h"
#include "mozilla/dom/cache/ManagerId.h"
#include "mozilla/dom/cache/PCacheTypes.h"
#include "nsContentUtils.h"
#include "nsNetUtil.h"
#include "nsThreadUtils.h"
@ -91,7 +90,7 @@ private:
// static
nsresult
FetchPut::Create(Listener* aListener, Manager* aManager, CacheId aCacheId,
const nsTArray<PCacheRequest>& aRequests,
const nsTArray<CacheRequest>& aRequests,
const nsTArray<nsCOMPtr<nsIInputStream>>& aRequestStreams,
FetchPut** aFetchPutOut)
{
@ -125,7 +124,7 @@ FetchPut::ClearListener()
}
FetchPut::FetchPut(Listener* aListener, Manager* aManager, CacheId aCacheId,
const nsTArray<PCacheRequest>& aRequests,
const nsTArray<CacheRequest>& aRequests,
const nsTArray<nsCOMPtr<nsIInputStream>>& aRequestStreams)
: mListener(aListener)
, mManager(aManager)
@ -141,7 +140,7 @@ FetchPut::FetchPut(Listener* aListener, Manager* aManager, CacheId aCacheId,
for (uint32_t i = 0; i < aRequests.Length(); ++i) {
State* s = mStateList.AppendElement();
s->mPCacheRequest = aRequests[i];
s->mCacheRequest = aRequests[i];
s->mRequestStream = aRequestStreams[i];
}
@ -207,7 +206,7 @@ FetchPut::DoFetchOnMainThread()
for (uint32_t i = 0; i < mStateList.Length(); ++i) {
nsRefPtr<InternalRequest> internalRequest =
ToInternalRequest(mStateList[i].mPCacheRequest);
ToInternalRequest(mStateList[i].mCacheRequest);
// If there is a stream we must clone it so that its still available
// to store in the cache later;
@ -253,7 +252,7 @@ FetchPut::FetchComplete(FetchObserver* aObserver,
for (uint32_t i = 0; i < mStateList.Length(); ++i) {
if (mStateList[i].mFetchObserver == aObserver) {
ErrorResult rv;
ToPCacheResponseWithoutBody(mStateList[i].mPCacheResponse,
ToCacheResponseWithoutBody(mStateList[i].mCacheResponse,
*aInternalResponse, rv);
if (rv.Failed()) {
MaybeSetError(rv.ErrorCode());
@ -305,15 +304,15 @@ FetchPut::DoPutOnWorkerThread()
for (uint32_t i = 0; i < mStateList.Length(); ++i) {
// The spec requires us to catch if content tries to insert a set of
// requests that would overwrite each other.
if (MatchInPutList(mStateList[i].mPCacheRequest, putList)) {
if (MatchInPutList(mStateList[i].mCacheRequest, putList)) {
MaybeSetError(NS_ERROR_DOM_INVALID_STATE_ERR);
MaybeNotifyListener();
return;
}
CacheRequestResponse* entry = putList.AppendElement();
entry->request() = mStateList[i].mPCacheRequest;
entry->response() = mStateList[i].mPCacheResponse;
entry->request() = mStateList[i].mCacheRequest;
entry->response() = mStateList[i].mCacheResponse;
requestStreamList.AppendElement(mStateList[i].mRequestStream.forget());
responseStreamList.AppendElement(mStateList[i].mResponseStream.forget());
}
@ -325,7 +324,7 @@ FetchPut::DoPutOnWorkerThread()
// static
bool
FetchPut::MatchInPutList(const PCacheRequest& aRequest,
FetchPut::MatchInPutList(const CacheRequest& aRequest,
const nsTArray<CacheRequestResponse>& aPutList)
{
// This method implements the SW spec QueryCache algorithm against an
@ -343,8 +342,8 @@ FetchPut::MatchInPutList(const PCacheRequest& aRequest,
new InternalHeaders(aRequest.headers());
for (uint32_t i = 0; i < aPutList.Length(); ++i) {
const PCacheRequest& cachedRequest = aPutList[i].request();
const PCacheResponse& cachedResponse = aPutList[i].response();
const CacheRequest& cachedRequest = aPutList[i].request();
const CacheResponse& cachedResponse = aPutList[i].response();
// If the URLs don't match, then just skip to the next entry.
if (aRequest.url() != cachedRequest.url()) {

12
dom/cache/FetchPut.h vendored
View File

@ -10,7 +10,7 @@
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/cache/Manager.h"
#include "mozilla/dom/cache/PCacheTypes.h"
#include "mozilla/dom/cache/CacheTypes.h"
#include "mozilla/dom/cache/Types.h"
#include "mozilla/dom/cache/TypeUtils.h"
#include "nsRefPtr.h"
@ -44,7 +44,7 @@ public:
static nsresult
Create(Listener* aListener, Manager* aManager, CacheId aCacheId,
const nsTArray<PCacheRequest>& aRequests,
const nsTArray<CacheRequest>& aRequests,
const nsTArray<nsCOMPtr<nsIInputStream>>& aRequestStreams,
FetchPut** aFetchPutOut);
@ -55,10 +55,10 @@ private:
class FetchObserver;
struct State
{
PCacheRequest mPCacheRequest;
CacheRequest mCacheRequest;
nsCOMPtr<nsIInputStream> mRequestStream;
nsRefPtr<FetchObserver> mFetchObserver;
PCacheResponse mPCacheResponse;
CacheResponse mCacheResponse;
nsCOMPtr<nsIInputStream> mResponseStream;
nsRefPtr<Request> mRequest;
@ -66,7 +66,7 @@ private:
};
FetchPut(Listener* aListener, Manager* aManager, CacheId aCacheId,
const nsTArray<PCacheRequest>& aRequests,
const nsTArray<CacheRequest>& aRequests,
const nsTArray<nsCOMPtr<nsIInputStream>>& aRequestStreams);
~FetchPut();
@ -79,7 +79,7 @@ private:
void MaybeCompleteOnMainThread();
void DoPutOnWorkerThread();
static bool MatchInPutList(const PCacheRequest& aRequest,
static bool MatchInPutList(const CacheRequest& aRequest,
const nsTArray<CacheRequestResponse>& aPutList);
virtual void

View File

@ -16,7 +16,7 @@
#include "mozilla/dom/cache/DBSchema.h"
#include "mozilla/dom/cache/FileUtils.h"
#include "mozilla/dom/cache/ManagerId.h"
#include "mozilla/dom/cache/PCacheTypes.h"
#include "mozilla/dom/cache/CacheTypes.h"
#include "mozilla/dom/cache/SavedTypes.h"
#include "mozilla/dom/cache/StreamList.h"
#include "mozilla/dom/cache/Types.h"
@ -826,12 +826,12 @@ private:
struct Entry
{
PCacheRequest mRequest;
CacheRequest mRequest;
nsCOMPtr<nsIInputStream> mRequestStream;
nsID mRequestBodyId;
nsCOMPtr<nsISupports> mRequestCopyContext;
PCacheResponse mResponse;
CacheResponse mResponse;
nsCOMPtr<nsIInputStream> mResponseStream;
nsID mResponseBodyId;
nsCOMPtr<nsISupports> mResponseCopyContext;

5
dom/cache/Manager.h vendored
View File

@ -7,10 +7,10 @@
#ifndef mozilla_dom_cache_Manager_h
#define mozilla_dom_cache_Manager_h
#include "mozilla/dom/cache/PCacheStreamControlParent.h"
#include "mozilla/dom/cache/Types.h"
#include "nsCOMPtr.h"
#include "nsISupportsImpl.h"
#include "nsRefPtr.h"
#include "nsString.h"
#include "nsTArray.h"
@ -26,9 +26,6 @@ class CacheOpResult;
class CacheRequestResponse;
class Context;
class ManagerId;
class PCacheQueryParams;
class PCacheRequest;
class PCacheRequestOrVoid;
struct SavedRequest;
struct SavedResponse;
class StreamList;

View File

@ -3,13 +3,13 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
include protocol PBackground;
include protocol PBlob; // FIXME: bug 792908
include protocol PCacheOp;
include protocol PCachePushStream;
include PCacheTypes;
include protocol PCacheStreamControl;
include protocol PFileDescriptorSet;
include protocol PBlob; // FIXME: bug 792908
include protocol PCacheStreamControl;
include CacheTypes;
namespace mozilla {
namespace dom {

View File

@ -3,14 +3,12 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
include protocol PCache;
include protocol PCacheStorage;
// these are needed indirectly through CacheOpResult
include protocol PCachePushStream;
include protocol PCacheStorage;
include protocol PCacheStreamControl;
include protocol PFileDescriptorSet;
include PCacheTypes;
include CacheTypes;
namespace mozilla {
namespace dom {

View File

@ -3,13 +3,13 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
include protocol PBackground;
include protocol PBlob; // FIXME: bug 792908
include protocol PCache;
include protocol PCacheOp;
include PCacheTypes;
include protocol PCacheStreamControl;
include protocol PFileDescriptorSet;
include protocol PBlob; // FIXME: bug 792908
include protocol PCacheStreamControl;
include CacheTypes;
namespace mozilla {
namespace dom {

View File

@ -9,7 +9,7 @@
#include "mozilla/unused.h"
#include "mozilla/dom/cache/CacheStreamControlChild.h"
#include "mozilla/dom/cache/CacheStreamControlParent.h"
#include "mozilla/dom/cache/PCacheTypes.h"
#include "mozilla/dom/cache/CacheTypes.h"
#include "mozilla/ipc/FileDescriptor.h"
#include "mozilla/ipc/InputStreamUtils.h"
#include "mozilla/SnappyUncompressInputStream.h"
@ -35,10 +35,10 @@ public:
nsIInputStream* aStream);
void
Serialize(PCacheReadStreamOrVoid* aReadStreamOut);
Serialize(CacheReadStreamOrVoid* aReadStreamOut);
void
Serialize(PCacheReadStream* aReadStreamOut);
Serialize(CacheReadStream* aReadStreamOut);
// ReadStream::Controllable methods
virtual void
@ -193,17 +193,17 @@ ReadStream::Inner::Inner(StreamControl* aControl, const nsID& aId,
}
void
ReadStream::Inner::Serialize(PCacheReadStreamOrVoid* aReadStreamOut)
ReadStream::Inner::Serialize(CacheReadStreamOrVoid* aReadStreamOut)
{
MOZ_ASSERT(NS_GetCurrentThread() == mOwningThread);
MOZ_ASSERT(aReadStreamOut);
PCacheReadStream stream;
CacheReadStream stream;
Serialize(&stream);
*aReadStreamOut = stream;
}
void
ReadStream::Inner::Serialize(PCacheReadStream* aReadStreamOut)
ReadStream::Inner::Serialize(CacheReadStream* aReadStreamOut)
{
MOZ_ASSERT(NS_GetCurrentThread() == mOwningThread);
MOZ_ASSERT(aReadStreamOut);
@ -391,18 +391,18 @@ NS_IMPL_ISUPPORTS(cache::ReadStream, nsIInputStream, ReadStream);
// static
already_AddRefed<ReadStream>
ReadStream::Create(const PCacheReadStreamOrVoid& aReadStreamOrVoid)
ReadStream::Create(const CacheReadStreamOrVoid& aReadStreamOrVoid)
{
if (aReadStreamOrVoid.type() == PCacheReadStreamOrVoid::Tvoid_t) {
if (aReadStreamOrVoid.type() == CacheReadStreamOrVoid::Tvoid_t) {
return nullptr;
}
return Create(aReadStreamOrVoid.get_PCacheReadStream());
return Create(aReadStreamOrVoid.get_CacheReadStream());
}
// static
already_AddRefed<ReadStream>
ReadStream::Create(const PCacheReadStream& aReadStream)
ReadStream::Create(const CacheReadStream& aReadStream)
{
// The parameter may or may not be for a Cache created stream. The way we
// tell is by looking at the stream control actor. If the actor exists,
@ -457,13 +457,13 @@ ReadStream::Create(PCacheStreamControlParent* aControl, const nsID& aId,
}
void
ReadStream::Serialize(PCacheReadStreamOrVoid* aReadStreamOut)
ReadStream::Serialize(CacheReadStreamOrVoid* aReadStreamOut)
{
mInner->Serialize(aReadStreamOut);
}
void
ReadStream::Serialize(PCacheReadStream* aReadStreamOut)
ReadStream::Serialize(CacheReadStream* aReadStreamOut)
{
mInner->Serialize(aReadStreamOut);
}

View File

@ -21,8 +21,8 @@ namespace mozilla {
namespace dom {
namespace cache {
class PCacheReadStream;
class PCacheReadStreamOrVoid;
class CacheReadStream;
class CacheReadStreamOrVoid;
class PCacheStreamControlParent;
// IID for the dom::cache::ReadStream interface
@ -71,17 +71,17 @@ public:
};
static already_AddRefed<ReadStream>
Create(const PCacheReadStreamOrVoid& aReadStreamOrVoid);
Create(const CacheReadStreamOrVoid& aReadStreamOrVoid);
static already_AddRefed<ReadStream>
Create(const PCacheReadStream& aReadStream);
Create(const CacheReadStream& aReadStream);
static already_AddRefed<ReadStream>
Create(PCacheStreamControlParent* aControl, const nsID& aId,
nsIInputStream* aStream);
void Serialize(PCacheReadStreamOrVoid* aReadStreamOut);
void Serialize(PCacheReadStream* aReadStreamOut);
void Serialize(CacheReadStreamOrVoid* aReadStreamOut);
void Serialize(CacheReadStream* aReadStreamOut);
private:
class Inner;

View File

@ -10,7 +10,7 @@
// NOTE: This cannot be rolled into Types.h because the IPC dependency.
// breaks webidl unified builds.
#include "mozilla/dom/cache/PCacheTypes.h"
#include "mozilla/dom/cache/CacheTypes.h"
#include "mozilla/dom/cache/Types.h"
#include "nsCOMPtr.h"
#include "nsID.h"
@ -23,7 +23,7 @@ namespace cache {
struct SavedRequest
{
SavedRequest() : mHasBodyId(false) { mValue.body() = void_t(); }
PCacheRequest mValue;
CacheRequest mValue;
bool mHasBodyId;
nsID mBodyId;
CacheId mCacheId;
@ -32,7 +32,7 @@ struct SavedRequest
struct SavedResponse
{
SavedResponse() : mHasBodyId(false) { mValue.body() = void_t(); }
PCacheResponse mValue;
CacheResponse mValue;
bool mHasBodyId;
nsID mBodyId;
CacheId mCacheId;

View File

@ -20,7 +20,7 @@ namespace ipc {
namespace dom {
namespace cache {
class PCacheReadStream;
class CacheReadStream;
// Abstract class to help implement the stream control Child and Parent actors.
// This provides an interface to partly help with serialization of IPC types,
@ -30,14 +30,14 @@ class StreamControl
public:
// abstract interface that must be implemented by child class
virtual void
SerializeControl(PCacheReadStream* aReadStreamOut) = 0;
SerializeControl(CacheReadStream* aReadStreamOut) = 0;
virtual void
SerializeFds(PCacheReadStream* aReadStreamOut,
SerializeFds(CacheReadStream* aReadStreamOut,
const nsTArray<mozilla::ipc::FileDescriptor>& aFds) = 0;
virtual void
DeserializeFds(const PCacheReadStream& aReadStream,
DeserializeFds(const CacheReadStream& aReadStream,
nsTArray<mozilla::ipc::FileDescriptor>& aFdsOut) = 0;
// inherited implementation of the ReadStream::Controllable list

View File

@ -8,7 +8,7 @@
#include "mozilla/unused.h"
#include "mozilla/dom/cache/CacheStreamControlChild.h"
#include "mozilla/dom/cache/PCacheTypes.h"
#include "mozilla/dom/cache/CacheTypes.h"
#include "mozilla/ipc/FileDescriptor.h"
#include "mozilla/ipc/FileDescriptorSetChild.h"
@ -22,13 +22,13 @@ using mozilla::unused;
using mozilla::void_t;
using mozilla::dom::cache::CacheStreamControlChild;
using mozilla::dom::cache::Feature;
using mozilla::dom::cache::PCacheReadStream;
using mozilla::dom::cache::CacheReadStream;
using mozilla::ipc::FileDescriptor;
using mozilla::ipc::FileDescriptorSetChild;
using mozilla::ipc::OptionalFileDescriptorSet;
void
StartDestroyStreamChild(const PCacheReadStream& aReadStream)
StartDestroyStreamChild(const CacheReadStream& aReadStream)
{
CacheStreamControlChild* cacheControl =
static_cast<CacheStreamControlChild*>(aReadStream.controlChild());
@ -52,7 +52,7 @@ StartDestroyStreamChild(const PCacheReadStream& aReadStream)
}
void
AddFeatureToStreamChild(const PCacheReadStream& aReadStream, Feature* aFeature)
AddFeatureToStreamChild(const CacheReadStream& aReadStream, Feature* aFeature)
{
CacheStreamControlChild* cacheControl =
static_cast<CacheStreamControlChild*>(aReadStream.controlChild());
@ -64,27 +64,27 @@ AddFeatureToStreamChild(const PCacheReadStream& aReadStream, Feature* aFeature)
} // anonymous namespace
void
StartDestroyStreamChild(const PCacheResponseOrVoid& aResponseOrVoid)
StartDestroyStreamChild(const CacheResponseOrVoid& aResponseOrVoid)
{
if (aResponseOrVoid.type() == PCacheResponseOrVoid::Tvoid_t) {
if (aResponseOrVoid.type() == CacheResponseOrVoid::Tvoid_t) {
return;
}
StartDestroyStreamChild(aResponseOrVoid.get_PCacheResponse());
StartDestroyStreamChild(aResponseOrVoid.get_CacheResponse());
}
void
StartDestroyStreamChild(const PCacheResponse& aResponse)
StartDestroyStreamChild(const CacheResponse& aResponse)
{
if (aResponse.body().type() == PCacheReadStreamOrVoid::Tvoid_t) {
if (aResponse.body().type() == CacheReadStreamOrVoid::Tvoid_t) {
return;
}
StartDestroyStreamChild(aResponse.body().get_PCacheReadStream());
StartDestroyStreamChild(aResponse.body().get_CacheReadStream());
}
void
StartDestroyStreamChild(const nsTArray<PCacheResponse>& aResponses)
StartDestroyStreamChild(const nsTArray<CacheResponse>& aResponses)
{
for (uint32_t i = 0; i < aResponses.Length(); ++i) {
StartDestroyStreamChild(aResponses[i]);
@ -92,40 +92,40 @@ StartDestroyStreamChild(const nsTArray<PCacheResponse>& aResponses)
}
void
StartDestroyStreamChild(const nsTArray<PCacheRequest>& aRequests)
StartDestroyStreamChild(const nsTArray<CacheRequest>& aRequests)
{
for (uint32_t i = 0; i < aRequests.Length(); ++i) {
if (aRequests[i].body().type() == PCacheReadStreamOrVoid::Tvoid_t) {
if (aRequests[i].body().type() == CacheReadStreamOrVoid::Tvoid_t) {
continue;
}
StartDestroyStreamChild(aRequests[i].body().get_PCacheReadStream());
StartDestroyStreamChild(aRequests[i].body().get_CacheReadStream());
}
}
void
AddFeatureToStreamChild(const PCacheResponseOrVoid& aResponseOrVoid,
AddFeatureToStreamChild(const CacheResponseOrVoid& aResponseOrVoid,
Feature* aFeature)
{
if (aResponseOrVoid.type() == PCacheResponseOrVoid::Tvoid_t) {
if (aResponseOrVoid.type() == CacheResponseOrVoid::Tvoid_t) {
return;
}
AddFeatureToStreamChild(aResponseOrVoid.get_PCacheResponse(), aFeature);
AddFeatureToStreamChild(aResponseOrVoid.get_CacheResponse(), aFeature);
}
void
AddFeatureToStreamChild(const PCacheResponse& aResponse,
AddFeatureToStreamChild(const CacheResponse& aResponse,
Feature* aFeature)
{
if (aResponse.body().type() == PCacheReadStreamOrVoid::Tvoid_t) {
if (aResponse.body().type() == CacheReadStreamOrVoid::Tvoid_t) {
return;
}
AddFeatureToStreamChild(aResponse.body().get_PCacheReadStream(), aFeature);
AddFeatureToStreamChild(aResponse.body().get_CacheReadStream(), aFeature);
}
void
AddFeatureToStreamChild(const nsTArray<PCacheResponse>& aResponses,
AddFeatureToStreamChild(const nsTArray<CacheResponse>& aResponses,
Feature* aFeature)
{
for (uint32_t i = 0; i < aResponses.Length(); ++i) {
@ -134,14 +134,14 @@ AddFeatureToStreamChild(const nsTArray<PCacheResponse>& aResponses,
}
void
AddFeatureToStreamChild(const nsTArray<PCacheRequest>& aRequests,
AddFeatureToStreamChild(const nsTArray<CacheRequest>& aRequests,
Feature* aFeature)
{
for (uint32_t i = 0; i < aRequests.Length(); ++i) {
if (aRequests[i].body().type() == PCacheReadStreamOrVoid::Tvoid_t) {
if (aRequests[i].body().type() == CacheReadStreamOrVoid::Tvoid_t) {
continue;
}
AddFeatureToStreamChild(aRequests[i].body().get_PCacheReadStream(),
AddFeatureToStreamChild(aRequests[i].body().get_CacheReadStream(),
aFeature);
}
}

View File

@ -14,22 +14,22 @@ namespace dom {
namespace cache {
class Feature;
class PCacheRequest;
class PCacheResponse;
class PCacheResponseOrVoid;
class CacheRequest;
class CacheResponse;
class CacheResponseOrVoid;
void StartDestroyStreamChild(const PCacheResponseOrVoid& aResponseOrVoid);
void StartDestroyStreamChild(const PCacheResponse& aResponse);
void StartDestroyStreamChild(const nsTArray<PCacheResponse>& aResponses);
void StartDestroyStreamChild(const nsTArray<PCacheRequest>& aRequests);
void StartDestroyStreamChild(const CacheResponseOrVoid& aResponseOrVoid);
void StartDestroyStreamChild(const CacheResponse& aResponse);
void StartDestroyStreamChild(const nsTArray<CacheResponse>& aResponses);
void StartDestroyStreamChild(const nsTArray<CacheRequest>& aRequests);
void AddFeatureToStreamChild(const PCacheResponseOrVoid& aResponseOrVoid,
void AddFeatureToStreamChild(const CacheResponseOrVoid& aResponseOrVoid,
Feature* aFeature);
void AddFeatureToStreamChild(const PCacheResponse& aResponse,
void AddFeatureToStreamChild(const CacheResponse& aResponse,
Feature* aFeature);
void AddFeatureToStreamChild(const nsTArray<PCacheResponse>& aResponses,
void AddFeatureToStreamChild(const nsTArray<CacheResponse>& aResponses,
Feature* aFeature);
void AddFeatureToStreamChild(const nsTArray<PCacheRequest>& aRequests,
void AddFeatureToStreamChild(const nsTArray<CacheRequest>& aRequests,
Feature* aFeature);
} // namespace cache

View File

@ -12,7 +12,7 @@
#include "mozilla/dom/Request.h"
#include "mozilla/dom/Response.h"
#include "mozilla/dom/cache/CachePushStreamChild.h"
#include "mozilla/dom/cache/PCacheTypes.h"
#include "mozilla/dom/cache/CacheTypes.h"
#include "mozilla/dom/cache/ReadStream.h"
#include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/ipc/FileDescriptorSetChild.h"
@ -32,7 +32,7 @@ namespace {
using mozilla::ErrorResult;
using mozilla::unused;
using mozilla::void_t;
using mozilla::dom::cache::PCacheReadStream;
using mozilla::dom::cache::CacheReadStream;
using mozilla::ipc::BackgroundChild;
using mozilla::ipc::FileDescriptor;
using mozilla::ipc::PBackgroundChild;
@ -105,7 +105,7 @@ ProcessURL(nsAString& aUrl, bool* aSchemeValidOut,
}
void
SerializeNormalStream(nsIInputStream* aStream, PCacheReadStream& aReadStreamOut)
SerializeNormalStream(nsIInputStream* aStream, CacheReadStream& aReadStreamOut)
{
nsAutoTArray<FileDescriptor, 4> fds;
SerializeInputStream(aStream, aReadStreamOut.params(), fds);
@ -181,7 +181,7 @@ TypeUtils::ToInternalRequest(const OwningRequestOrUSVString& aIn,
}
void
TypeUtils::ToPCacheRequest(PCacheRequest& aOut, InternalRequest* aIn,
TypeUtils::ToCacheRequest(CacheRequest& aOut, InternalRequest* aIn,
BodyAction aBodyAction,
ReferrerAction aReferrerAction,
SchemeAction aSchemeAction, ErrorResult& aRv)
@ -244,7 +244,7 @@ TypeUtils::ToPCacheRequest(PCacheRequest& aOut, InternalRequest* aIn,
}
void
TypeUtils::ToPCacheResponseWithoutBody(PCacheResponse& aOut,
TypeUtils::ToCacheResponseWithoutBody(CacheResponse& aOut,
InternalResponse& aIn, ErrorResult& aRv)
{
aOut.type() = aIn.Type();
@ -272,7 +272,7 @@ TypeUtils::ToPCacheResponseWithoutBody(PCacheResponse& aOut,
}
void
TypeUtils::ToPCacheResponse(PCacheResponse& aOut, Response& aIn, ErrorResult& aRv)
TypeUtils::ToCacheResponse(CacheResponse& aOut, Response& aIn, ErrorResult& aRv)
{
if (aIn.BodyUsed()) {
aRv.ThrowTypeError(MSG_FETCH_BODY_CONSUMED_ERROR);
@ -280,7 +280,7 @@ TypeUtils::ToPCacheResponse(PCacheResponse& aOut, Response& aIn, ErrorResult& aR
}
nsRefPtr<InternalResponse> ir = aIn.GetInternalResponse();
ToPCacheResponseWithoutBody(aOut, *ir, aRv);
ToCacheResponseWithoutBody(aOut, *ir, aRv);
nsCOMPtr<nsIInputStream> stream;
aIn.GetBody(getter_AddRefs(stream));
@ -296,7 +296,7 @@ TypeUtils::ToPCacheResponse(PCacheResponse& aOut, Response& aIn, ErrorResult& aR
// static
void
TypeUtils::ToPCacheQueryParams(PCacheQueryParams& aOut,
TypeUtils::ToCacheQueryParams(CacheQueryParams& aOut,
const CacheQueryOptions& aIn)
{
aOut.ignoreSearch() = aIn.mIgnoreSearch;
@ -311,7 +311,7 @@ TypeUtils::ToPCacheQueryParams(PCacheQueryParams& aOut,
}
already_AddRefed<Response>
TypeUtils::ToResponse(const PCacheResponse& aIn)
TypeUtils::ToResponse(const CacheResponse& aIn)
{
if (aIn.type() == ResponseType::Error) {
nsRefPtr<InternalResponse> error = InternalResponse::NetworkError();
@ -359,7 +359,7 @@ TypeUtils::ToResponse(const PCacheResponse& aIn)
}
already_AddRefed<InternalRequest>
TypeUtils::ToInternalRequest(const PCacheRequest& aIn)
TypeUtils::ToInternalRequest(const CacheRequest& aIn)
{
nsRefPtr<InternalRequest> internalRequest = new InternalRequest();
@ -391,7 +391,7 @@ TypeUtils::ToInternalRequest(const PCacheRequest& aIn)
}
already_AddRefed<Request>
TypeUtils::ToRequest(const PCacheRequest& aIn)
TypeUtils::ToRequest(const CacheRequest& aIn)
{
nsRefPtr<InternalRequest> internalRequest = ToInternalRequest(aIn);
nsRefPtr<Request> request = new Request(GetGlobalObject(), internalRequest);
@ -445,7 +445,7 @@ TypeUtils::ToInternalRequest(const nsAString& aIn, ErrorResult& aRv)
void
TypeUtils::SerializeCacheStream(nsIInputStream* aStream,
PCacheReadStreamOrVoid* aStreamOut,
CacheReadStreamOrVoid* aStreamOut,
ErrorResult& aRv)
{
*aStreamOut = void_t();
@ -460,7 +460,7 @@ TypeUtils::SerializeCacheStream(nsIInputStream* aStream,
return;
}
PCacheReadStream readStream;
CacheReadStream readStream;
readStream.controlChild() = nullptr;
readStream.controlParent() = nullptr;
readStream.pushStreamChild() = nullptr;
@ -484,7 +484,7 @@ TypeUtils::SerializeCacheStream(nsIInputStream* aStream,
void
TypeUtils::SerializePushStream(nsIInputStream* aStream,
PCacheReadStream& aReadStreamOut,
CacheReadStream& aReadStreamOut,
ErrorResult& aRv)
{
nsCOMPtr<nsIAsyncInputStream> asyncStream = do_QueryInterface(aStream);

28
dom/cache/TypeUtils.h vendored
View File

@ -29,11 +29,11 @@ class Response;
namespace cache {
class CachePushStreamChild;
class PCacheQueryParams;
class PCacheReadStream;
class PCacheReadStreamOrVoid;
class PCacheRequest;
class PCacheResponse;
class CacheQueryParams;
class CacheReadStream;
class CacheReadStreamOrVoid;
class CacheRequest;
class CacheResponse;
class TypeUtils
{
@ -77,28 +77,28 @@ public:
ErrorResult& aRv);
void
ToPCacheRequest(PCacheRequest& aOut, InternalRequest* aIn,
ToCacheRequest(CacheRequest& aOut, InternalRequest* aIn,
BodyAction aBodyAction, ReferrerAction aReferrerAction,
SchemeAction aSchemeAction, ErrorResult& aRv);
void
ToPCacheResponseWithoutBody(PCacheResponse& aOut, InternalResponse& aIn,
ToCacheResponseWithoutBody(CacheResponse& aOut, InternalResponse& aIn,
ErrorResult& aRv);
void
ToPCacheResponse(PCacheResponse& aOut, Response& aIn, ErrorResult& aRv);
ToCacheResponse(CacheResponse& aOut, Response& aIn, ErrorResult& aRv);
void
ToPCacheQueryParams(PCacheQueryParams& aOut, const CacheQueryOptions& aIn);
ToCacheQueryParams(CacheQueryParams& aOut, const CacheQueryOptions& aIn);
already_AddRefed<Response>
ToResponse(const PCacheResponse& aIn);
ToResponse(const CacheResponse& aIn);
already_AddRefed<InternalRequest>
ToInternalRequest(const PCacheRequest& aIn);
ToInternalRequest(const CacheRequest& aIn);
already_AddRefed<Request>
ToRequest(const PCacheRequest& aIn);
ToRequest(const CacheRequest& aIn);
private:
void
@ -109,11 +109,11 @@ private:
ToInternalRequest(const nsAString& aIn, ErrorResult& aRv);
void
SerializeCacheStream(nsIInputStream* aStream, PCacheReadStreamOrVoid* aStreamOut,
SerializeCacheStream(nsIInputStream* aStream, CacheReadStreamOrVoid* aStreamOut,
ErrorResult& aRv);
void
SerializePushStream(nsIInputStream* aStream, PCacheReadStream& aReadStreamOut,
SerializePushStream(nsIInputStream* aStream, CacheReadStream& aReadStreamOut,
ErrorResult& aRv);
};

2
dom/cache/moz.build vendored
View File

@ -77,12 +77,12 @@ UNIFIED_SOURCES += [
]
IPDL_SOURCES += [
'CacheTypes.ipdlh',
'PCache.ipdl',
'PCacheOp.ipdl',
'PCachePushStream.ipdl',
'PCacheStorage.ipdl',
'PCacheStreamControl.ipdl',
'PCacheTypes.ipdlh',
]
include('/ipc/chromium/chromium-config.mozbuild')