chromium/google_apis/gcm/engine/mcs_client.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/mcs_client.h"

#include <stddef.h>
#include <set>
#include <utility>

#include "base/containers/circular_deque.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/clock.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "google_apis/gcm/base/mcs_util.h"
#include "google_apis/gcm/base/socket_stream.h"
#include "google_apis/gcm/engine/connection_factory.h"
#include "google_apis/gcm/monitoring/gcm_stats_recorder.h"

namespace gcm {

namespace {

MCSProto;

// The category of messages intended for the GCM client itself from MCS.
const char kMCSCategory[] =;

// The from field for messages originating in the GCM client.
const char kGCMFromField[] =;

// MCS status message types.
// TODO(zea): handle these at the GCMClient layer.
const char kIdleNotification[] =;
// const char kAlwaysShowOnIdle[] = "ShowAwayOnIdle";
// const char kPowerNotification[] = "PowerNotification";
// const char kDataActiveNotification[] = "DataActiveNotification";

// Settings for MCS Login packet.
const char kHeartbeatIntervalSettingName[] =;
const int kNoCustomHeartbeat =;

// The number of unacked messages to allow before sending a stream ack.
// Applies to both incoming and outgoing messages.
// TODO(zea): make this server configurable.
const int kUnackedMessageBeforeStreamAck =;

// The global maximum number of pending messages to have in the send queue.
const size_t kMaxSendQueueSize =;

// The maximum message size that can be sent to the server.
const int kMaxMessageBytes =;  // 4KB, like the server.

// Helper for converting a proto persistent id list to a vector of strings.
bool BuildPersistentIdListFromProto(const std::string& bytes,
                                    std::vector<std::string>* id_list) {}

}  // namespace

class CollapseKey {};

CollapseKey::CollapseKey(const mcs_proto::DataMessageStanza& message)
    :{}

CollapseKey::~CollapseKey() {}

bool CollapseKey::IsValid() const {}

bool CollapseKey::operator<(const CollapseKey& right) const {}

struct ReliablePacketInfo {};

ReliablePacketInfo::ReliablePacketInfo() :{}
ReliablePacketInfo::~ReliablePacketInfo() = default;

int MCSClient::GetSendQueueSize() const {}

int MCSClient::GetResendQueueSize() const {}

std::string MCSClient::GetStateString() const {}

MCSClient::MCSClient(const std::string& version_string,
                     base::Clock* clock,
                     ConnectionFactory* connection_factory,
                     GCMStore* gcm_store,
                     scoped_refptr<base::SequencedTaskRunner> io_task_runner,
                     GCMStatsRecorder* recorder)
    :{}

MCSClient::~MCSClient() = default;

void MCSClient::Initialize(
    const ErrorCallback& error_callback,
    const OnMessageReceivedCallback& message_received_callback,
    const OnMessageSentCallback& message_sent_callback,
    std::unique_ptr<GCMStore::LoadResult> load_result) {}

void MCSClient::Login(uint64_t android_id, uint64_t security_token) {}

void MCSClient::SendMessage(const MCSMessage& message) {}

void MCSClient::UpdateHeartbeatTimer(
    std::unique_ptr<base::RetainingOneShotTimer> timer) {}

void MCSClient::AddHeartbeatInterval(const std::string& scope,
                                     int interval_ms) {}

void MCSClient::RemoveHeartbeatInterval(const std::string& scope) {}

int MCSClient::GetMinHeartbeatIntervalMs() {}

void MCSClient::ResetStateAndBuildLoginRequest(
    mcs_proto::LoginRequest* request) {}

void MCSClient::SendHeartbeat() {}

void MCSClient::OnGCMUpdateFinished(bool success) {}

void MCSClient::MaybeSendMessage() {}

void MCSClient::SendPacketToWire(ReliablePacketInfo* packet_info) {}

void MCSClient::HandleMCSDataMesssage(
    std::unique_ptr<google::protobuf::MessageLite> protobuf) {}

void MCSClient::HandlePacketFromWire(
    std::unique_ptr<google::protobuf::MessageLite> protobuf) {}

void MCSClient::HandleStreamAck(StreamId last_stream_id_received) {}

void MCSClient::HandleSelectiveAck(const PersistentIdList& id_list) {}

void MCSClient::HandleServerConfirmedReceipt(StreamId device_stream_id) {}

MCSClient::PersistentId MCSClient::GetNextPersistentId() {}

void MCSClient::OnConnectionResetByHeartbeat(
    ConnectionFactory::ConnectionResetReason reason) {}

void MCSClient::NotifyMessageSendStatus(
    const google::protobuf::MessageLite& protobuf,
    MessageSendStatus status) {}

MCSClient::MCSPacketInternal MCSClient::PopMessageForSend() {}

}  // namespace gcm