proxygen
|
#include <FilterChain.h>
Public Types | |
using | FilterChainType = GenericFilter< T1, T2, set_callback, TakeOwnership > |
Public Member Functions | |
FilterChain (std::unique_ptr< T1 > destination) | |
FilterChain (T1 *destination) | |
void | setCallback (T2 *cb) override |
T1 * | call () |
const T1 * | call () const |
T1 * | getChainEndPtr () |
const T1 & | getChainEnd () const |
std::unique_ptr< T1 > | setDestination (std::unique_ptr< T1 > destination) |
template<typename C , typename C2 , typename... Types> | |
std::enable_if< std::is_constructible< C >::value >::type | addFilters () |
template<typename C > | |
std::enable_if< std::is_constructible< C >::value >::type | addFilters () |
template<typename C , typename... Types> | |
void | addFilters (std::unique_ptr< C > cur, Types &&...remaining) |
template<typename C , typename... Types> | |
void | addFilters (C *cur, Types &&...remaining) |
template<typename C , typename... Args> | |
FilterChain< T1, T2, FilterType, set_callback, TakeOwnership > & | add (Args &&...args) |
const T1 * | operator-> () const |
T1 * | operator-> () |
void | foreach (folly::FunctionRef< void(FilterChainType *)> fn) |
Private Member Functions | |
void | addFilters () |
Private Attributes | |
T1 * | chainEnd_ |
This class can be treated the same as a T1*, however internally it contains a chain of filters for T1 and T2. These filters are inserted between the original callback and destination.
If a filter does not care about one side of the calls, it will pass through the calls, saving a virtual function call. In the example below Filter1 only wants to intercept callbacks, and Filter2 only wants to intercept calls.
FilterChain Filter1 Filter2 destination _____________ _____________ _____________ _____________ | | | | | | | | | call_------------------------>| call_------->|"call" | T1 | | | | | | | |
T2 | callback_ |<--—callback_ |<-----------------—|"callback" | |___________| |___________| |___________| |___________|
This class is templatized on the two interfaces, T1, T2, as well as on the pass through filter implementation, FilterType, the special set callback function, and a boolean indicating whether the chain owns the filters (if false, the filters must delete themselves at the correct time). FilterType must have GenericFilter as an ancestor.
Definition at line 207 of file FilterChain.h.
using proxygen::FilterChain< T1, T2, FilterType, set_callback, TakeOwnership >::FilterChainType = GenericFilter<T1, T2, set_callback, TakeOwnership> |
Definition at line 259 of file FilterChain.h.
|
inlineexplicit |
Definition at line 209 of file FilterChain.h.
|
inlineexplicit |
Definition at line 220 of file FilterChain.h.
|
inline |
Another way to add filters. This way is similar to 'emplace_front' and returns a reference to itself so you can chain add() calls if you like.
Definition at line 341 of file FilterChain.h.
Referenced by proxygen::HTTPSession::WriteSegment::writeErr().
|
inline |
Adds filters with the given types to the front of the chain.
Definition at line 301 of file FilterChain.h.
Referenced by proxygen::HTTPSession::setupCodec().
|
inline |
Base case of above function where we add a single filter.
Definition at line 311 of file FilterChain.h.
|
inline |
Adds already constructed filters (inside unique_ptr) to the front of the chain.
Definition at line 320 of file FilterChain.h.
|
inline |
Definition at line 328 of file FilterChain.h.
|
inlineprivate |
Base case for addFilters() called with no arguments. It doesn't need to be public since trying to add zero filters doesn't make sense from a public API pov.
Definition at line 364 of file FilterChain.h.
|
inline |
Returns the head of the call chain. Do* not* call T1::set_callback() on this member. To change the callback of this entire filter chain, use the separate setCallback() method.
Definition at line 242 of file FilterChain.h.
Referenced by proxygen::HTTPSession::setupCodec().
|
inline |
Definition at line 245 of file FilterChain.h.
|
inline |
Definition at line 349 of file FilterChain.h.
Referenced by proxygen::HTTPUpstreamSession::attachThreadLocals().
|
inline |
|
inline |
Returns the concrete implementation at the end of the filter chain.
Definition at line 252 of file FilterChain.h.
Referenced by proxygen::HTTPSessionBase::initCodecHeaderIndexingStrategy().
|
inline |
Definition at line 346 of file FilterChain.h.
|
inline |
Definition at line 347 of file FilterChain.h.
|
inlineoverride |
Set the callback for this entire filter chain. Setting this to null will uninstall the callback from the concrete object at the end of the chain.
Definition at line 235 of file FilterChain.h.
Referenced by proxygen::HTTPSession::setupCodec().
|
inline |
Definition at line 260 of file FilterChain.h.
Referenced by proxygen::HTTPSession::onNativeProtocolUpgradeImpl().
|
private |
Definition at line 366 of file FilterChain.h.