12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file.
42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// This is an interface for all objects that want to be notified that
62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// the underlying UDP socket is available for writing (not write blocked
72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// anymore).
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef NET_QUIC_QUIC_BLOCKED_WRITER_INTERFACE_H_
102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define NET_QUIC_QUIC_BLOCKED_WRITER_INTERFACE_H_
112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
12c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "net/base/net_export.h"
13c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace net {
152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class NET_EXPORT_PRIVATE QuicBlockedWriterInterface {
172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public:
182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual ~QuicBlockedWriterInterface() {}
192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Called by the PacketWriter when the underlying socket becomes writable
21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // so that the BlockedWriter can go ahead and try writing.
22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void OnCanWrite() = 0;
232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}  // namespace net
262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)#if defined(COMPILER_GCC)
2803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)namespace BASE_HASH_NAMESPACE {
2903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// Hash pointers as if they were int's, but bring more entropy to the lower
3003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// bits.
3103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)template <>
3203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)struct hash<net::QuicBlockedWriterInterface*> {
3303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)  std::size_t operator()(const net::QuicBlockedWriterInterface* ptr) const {
3403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)    size_t k = reinterpret_cast<size_t>(ptr);
3503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)    return k + (k >> 6);
3603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)  }
3703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)};
3803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)}
3903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)#endif
4003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)
412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif  // NET_QUIC_QUIC_BLOCKED_WRITER_INTERFACE_H_
42