netwerk/protocol/http/PSpdyPush.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/protocol/http/PSpdyPush.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,78 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +// SPDY Server Push
    1.10 +
    1.11 +/*
    1.12 +  A pushed stream is put into a memory buffer (The SpdyPushTransactionBuffer)
    1.13 +  and spooled there until a GET is made that can be matched up with it. At
    1.14 +  that time we have two spdy streams - the GET (aka the sink) and the PUSH
    1.15 +  (aka the source). Data is copied between those two streams for the lifetime
    1.16 +  of the transaction. This is true even if the transaction buffer is empty,
    1.17 +  partly complete, or totally loaded at the time the GET correspondence is made.
    1.18 +
    1.19 +  correspondence is done through a hash table of the full url, the spdy session,
    1.20 +  and the load group. The load group is implicit because that's where the
    1.21 +  hash is stored, the other items comprise the hash key.
    1.22 +
    1.23 +  Pushed streams are subject to aggressive flow control before they are matched
    1.24 +  with a GET at which point flow control is effectively disabled to match the
    1.25 +  client pull behavior.
    1.26 +*/
    1.27 +
    1.28 +#ifndef mozilla_net_SpdyPush_Public_h
    1.29 +#define mozilla_net_SpdyPush_Public_h
    1.30 +
    1.31 +#include "nsAutoPtr.h"
    1.32 +#include "nsDataHashtable.h"
    1.33 +#include "nsISupports.h"
    1.34 +
    1.35 +class nsCString;
    1.36 +
    1.37 +namespace mozilla {
    1.38 +namespace net {
    1.39 +
    1.40 +class SpdyPushedStream3;
    1.41 +class SpdyPushedStream31;
    1.42 +class Http2PushedStream;
    1.43 +
    1.44 +// One cache per load group
    1.45 +class SpdyPushCache
    1.46 +{
    1.47 +public:
    1.48 +  // The cache holds only weak pointers - no references
    1.49 +  SpdyPushCache();
    1.50 +  virtual ~SpdyPushCache();
    1.51 +
    1.52 +// for spdy/3
    1.53 +public:
    1.54 +  bool               RegisterPushedStreamSpdy3(nsCString key,
    1.55 +                                               SpdyPushedStream3 *stream);
    1.56 +  SpdyPushedStream3 *RemovePushedStreamSpdy3(nsCString key);
    1.57 +
    1.58 +private:
    1.59 +  nsDataHashtable<nsCStringHashKey, SpdyPushedStream3 *> mHashSpdy3;
    1.60 +
    1.61 +// for spdy/3.1
    1.62 +public:
    1.63 +  bool               RegisterPushedStreamSpdy31(nsCString key,
    1.64 +                                                SpdyPushedStream31 *stream);
    1.65 +  SpdyPushedStream31 *RemovePushedStreamSpdy31(nsCString key);
    1.66 +private:
    1.67 +  nsDataHashtable<nsCStringHashKey, SpdyPushedStream31 *> mHashSpdy31;
    1.68 +
    1.69 +// for http/2
    1.70 +public:
    1.71 +  bool               RegisterPushedStreamHttp2(nsCString key,
    1.72 +                                               Http2PushedStream *stream);
    1.73 +  Http2PushedStream *RemovePushedStreamHttp2(nsCString key);
    1.74 +private:
    1.75 +  nsDataHashtable<nsCStringHashKey, Http2PushedStream *> mHashHttp2;
    1.76 +};
    1.77 +
    1.78 +} // namespace mozilla::net
    1.79 +} // namespace mozilla
    1.80 +
    1.81 +#endif // mozilla_net_SpdyPush_Public_h

mercurial