Commit dc982969 authored by Kenton Varda's avatar Kenton Varda

Finish implementing RealmGateway -- but needs tests still.

parent 680b6979
...@@ -588,13 +588,23 @@ private: ...@@ -588,13 +588,23 @@ private:
sizeHint = sizeHint.map([](MessageSize hint) { sizeHint = sizeHint.map([](MessageSize hint) {
++hint.capCount; ++hint.capCount;
hint.wordCount += sizeInWords<RealmGateway<>::ImportParams>(); hint.wordCount += sizeInWords<RealmGateway<>::ImportParams>();
return hint;
}); });
auto request = g->importRequest(sizeHint); auto request = g->importRequest(sizeHint);
request.setCap(Persistent<>::Client(addRef())); request.setCap(Persistent<>::Client(addRef()));
return Request<AnyPointer, AnyPointer>(request.getParams(), // Awkwardly, request.initParams() would return a SaveParams struct, but to construct
RequestHook::from(kj::mv(request))); // the Request<AnyPointer, AnyPointer> to return we need an AnyPointer::Builder, and you
// can't go backwards from a struct builder to an AnyPointer builder. So instead we
// manually get at the pointer by converting the outer request to AnyStruct and then
// pulling the pointer from the pointer section.
auto pointers = toAny(request).getPointerSection();
KJ_ASSERT(pointers.size() >= 2);
auto paramsPtr = pointers[1];
KJ_ASSERT(paramsPtr.isNull());
return Request<AnyPointer, AnyPointer>(paramsPtr, RequestHook::from(kj::mv(request)));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment