chromium/google_apis/gcm/engine/connection_factory_impl.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "google_apis/gcm/engine/connection_factory_impl.h"

#include <memory>
#include <string>

#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/sequenced_task_runner.h"
#include "google_apis/gcm/base/gcm_features.h"
#include "google_apis/gcm/engine/connection_handler_impl.h"
#include "google_apis/gcm/monitoring/gcm_stats_recorder.h"
#include "google_apis/gcm/protocol/mcs.pb.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "net/base/net_errors.h"
#include "net/base/network_isolation_key.h"
#include "net/http/http_request_headers.h"
#include "net/http/proxy_fallback.h"
#include "net/log/net_log_source_type.h"
#include "net/proxy_resolution/proxy_info.h"
#include "net/socket/client_socket_handle.h"
#include "net/socket/client_socket_pool_manager.h"
#include "net/ssl/ssl_config_service.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/mojom/tcp_socket.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace gcm {

namespace {

// The amount of time a Socket read should wait before timing out.
const int kReadTimeoutMs =;  // 30 seconds.

// If a connection is reset after succeeding within this window of time,
// the previous backoff entry is restored (and the connection success is treated
// as if it was transient).
const int kConnectionResetWindowSecs =;  // 10 seconds.

// Decides whether the last login was within kConnectionResetWindowSecs of now
// or not.
bool ShouldRestorePreviousBackoff(const base::TimeTicks& login_time,
                                  const base::TimeTicks& now_ticks) {}

}  // namespace

ConnectionFactoryImpl::ConnectionFactoryImpl(
    const std::vector<GURL>& mcs_endpoints,
    const net::BackoffEntry::Policy& backoff_policy,
    GetProxyResolvingFactoryCallback get_socket_factory_callback,
    scoped_refptr<base::SequencedTaskRunner> io_task_runner,
    GCMStatsRecorder* recorder,
    network::NetworkConnectionTracker* network_connection_tracker)
    :{}

ConnectionFactoryImpl::~ConnectionFactoryImpl() {}

void ConnectionFactoryImpl::Initialize(
    const BuildLoginRequestCallback& request_builder,
    const ConnectionHandler::ProtoReceivedCallback& read_callback,
    const ConnectionHandler::ProtoSentCallback& write_callback) {}

ConnectionHandler* ConnectionFactoryImpl::GetConnectionHandler() const {}

void ConnectionFactoryImpl::Connect() {}

ConnectionEventTracker* ConnectionFactoryImpl::GetEventTrackerForTesting() {}

void ConnectionFactoryImpl::ConnectWithBackoff() {}

bool ConnectionFactoryImpl::IsEndpointReachable() const {}

std::string ConnectionFactoryImpl::GetConnectionStateString() const {}

void ConnectionFactoryImpl::SignalConnectionReset(
    ConnectionResetReason reason) {}

void ConnectionFactoryImpl::SetConnectionListener(
    ConnectionListener* listener) {}

base::TimeTicks ConnectionFactoryImpl::NextRetryAttempt() const {}

void ConnectionFactoryImpl::OnConnectionChanged(
    network::mojom::ConnectionType type) {}

GURL ConnectionFactoryImpl::GetCurrentEndpoint() const {}

void ConnectionFactoryImpl::ConnectImpl(bool ignore_connection_failure) {}

void ConnectionFactoryImpl::StartConnection(bool ignore_connection_failure) {}

void ConnectionFactoryImpl::InitHandler(
    mojo::ScopedDataPipeConsumerHandle receive_stream,
    mojo::ScopedDataPipeProducerHandle send_stream) {}

std::unique_ptr<net::BackoffEntry> ConnectionFactoryImpl::CreateBackoffEntry(
    const net::BackoffEntry::Policy* const policy) {}

std::unique_ptr<ConnectionHandler>
ConnectionFactoryImpl::CreateConnectionHandler(
    base::TimeDelta read_timeout,
    const ConnectionHandler::ProtoReceivedCallback& read_callback,
    const ConnectionHandler::ProtoSentCallback& write_callback,
    const ConnectionHandler::ConnectionChangedCallback& connection_callback) {}

base::TimeTicks ConnectionFactoryImpl::NowTicks() {}

void ConnectionFactoryImpl::OnConnectDone(
    bool ignore_connection_failure,
    int result,
    const std::optional<net::IPEndPoint>& local_addr,
    const std::optional<net::IPEndPoint>& peer_addr,
    mojo::ScopedDataPipeConsumerHandle receive_stream,
    mojo::ScopedDataPipeProducerHandle send_stream) {}

void ConnectionFactoryImpl::ConnectionHandlerCallback(int result) {}

void ConnectionFactoryImpl::CloseSocket() {}

}  // namespace gcm