Skip to content

Commit

Permalink
Merge pull request #160 from edevil/acruz/add_context_param
Browse files Browse the repository at this point in the history
add bytestream to context
  • Loading branch information
harrishancock authored Nov 8, 2022
2 parents ed05715 + a9ac724 commit d4d1d30
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/workerd/io/io-context.c++
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,12 @@ ThreadContext::HeaderIdBundle::HeaderIdBundle(kj::HttpHeaderTable::Builder& buil

ThreadContext::ThreadContext(
kj::Timer& timer, kj::EntropySource& entropySource,
HeaderIdBundle headerIds, capnp::HttpOverCapnpFactory& httpOverCapnpFactory, bool fiddle)
HeaderIdBundle headerIds, capnp::HttpOverCapnpFactory& httpOverCapnpFactory, capnp::ByteStreamFactory& byteStreamFactory, bool fiddle)
: timer(timer),
entropySource(entropySource),
headerIds(headerIds),
httpOverCapnpFactory(httpOverCapnpFactory),
byteStreamFactory(byteStreamFactory),
fiddle(fiddle) {}

IoContext::IoContext(ThreadContext& thread,
Expand Down
5 changes: 4 additions & 1 deletion src/workerd/io/io-context.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ class ThreadContext {

ThreadContext(
kj::Timer& timer, kj::EntropySource& entropySource,
HeaderIdBundle headerIds, capnp::HttpOverCapnpFactory& httpOverCapnpFactory, bool isFiddle);
HeaderIdBundle headerIds, capnp::HttpOverCapnpFactory& httpOverCapnpFactory,
capnp::ByteStreamFactory& byteStreamFactory, bool isFiddle);

kj::Timer& getUnsafeTimer() { return timer; }
// This should only be used to costruct TimerChannel. Everything else should use TimerChannel.
Expand All @@ -73,6 +74,7 @@ class ThreadContext {
const kj::HttpHeaderTable& getHeaderTable() { return headerIds.table; }
const HeaderIdBundle& getHeaderIds() { return headerIds; }
capnp::HttpOverCapnpFactory& getHttpOverCapnpFactory() { return httpOverCapnpFactory; }
capnp::ByteStreamFactory& getByteStreamFactory() { return byteStreamFactory; }
bool isFiddle() { return fiddle; }

private:
Expand All @@ -81,6 +83,7 @@ class ThreadContext {
kj::EntropySource& entropySource;
HeaderIdBundle headerIds;
capnp::HttpOverCapnpFactory& httpOverCapnpFactory;
capnp::ByteStreamFactory& byteStreamFactory;
bool fiddle;
};

Expand Down
1 change: 1 addition & 0 deletions src/workerd/server/server.c++
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ struct Server::GlobalContext {
httpOverCapnpFactory(byteStreamFactory, headerTableBuilder),
threadContext(server.timer, server.entropySource,
headerTableBuilder, httpOverCapnpFactory,
byteStreamFactory,
false /* isFiddle -- TODO(beta): support */),
headerTable(headerTableBuilder.getFutureTable()) {}
};
Expand Down

0 comments on commit d4d1d30

Please sign in to comment.