netwerk/protocol/http/PSpdyPush.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 // SPDY Server Push
     8 /*
     9   A pushed stream is put into a memory buffer (The SpdyPushTransactionBuffer)
    10   and spooled there until a GET is made that can be matched up with it. At
    11   that time we have two spdy streams - the GET (aka the sink) and the PUSH
    12   (aka the source). Data is copied between those two streams for the lifetime
    13   of the transaction. This is true even if the transaction buffer is empty,
    14   partly complete, or totally loaded at the time the GET correspondence is made.
    16   correspondence is done through a hash table of the full url, the spdy session,
    17   and the load group. The load group is implicit because that's where the
    18   hash is stored, the other items comprise the hash key.
    20   Pushed streams are subject to aggressive flow control before they are matched
    21   with a GET at which point flow control is effectively disabled to match the
    22   client pull behavior.
    23 */
    25 #ifndef mozilla_net_SpdyPush_Public_h
    26 #define mozilla_net_SpdyPush_Public_h
    28 #include "nsAutoPtr.h"
    29 #include "nsDataHashtable.h"
    30 #include "nsISupports.h"
    32 class nsCString;
    34 namespace mozilla {
    35 namespace net {
    37 class SpdyPushedStream3;
    38 class SpdyPushedStream31;
    39 class Http2PushedStream;
    41 // One cache per load group
    42 class SpdyPushCache
    43 {
    44 public:
    45   // The cache holds only weak pointers - no references
    46   SpdyPushCache();
    47   virtual ~SpdyPushCache();
    49 // for spdy/3
    50 public:
    51   bool               RegisterPushedStreamSpdy3(nsCString key,
    52                                                SpdyPushedStream3 *stream);
    53   SpdyPushedStream3 *RemovePushedStreamSpdy3(nsCString key);
    55 private:
    56   nsDataHashtable<nsCStringHashKey, SpdyPushedStream3 *> mHashSpdy3;
    58 // for spdy/3.1
    59 public:
    60   bool               RegisterPushedStreamSpdy31(nsCString key,
    61                                                 SpdyPushedStream31 *stream);
    62   SpdyPushedStream31 *RemovePushedStreamSpdy31(nsCString key);
    63 private:
    64   nsDataHashtable<nsCStringHashKey, SpdyPushedStream31 *> mHashSpdy31;
    66 // for http/2
    67 public:
    68   bool               RegisterPushedStreamHttp2(nsCString key,
    69                                                Http2PushedStream *stream);
    70   Http2PushedStream *RemovePushedStreamHttp2(nsCString key);
    71 private:
    72   nsDataHashtable<nsCStringHashKey, Http2PushedStream *> mHashHttp2;
    73 };
    75 } // namespace mozilla::net
    76 } // namespace mozilla
    78 #endif // mozilla_net_SpdyPush_Public_h

mercurial