Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2943)

Unified Diff: blimp/net/blimp_message_checkpointer.cc

Issue 2632803002: Remove all blimp network code. (Closed)
Patch Set: merge from origin/master for good measure Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/net/blimp_message_checkpointer.h ('k') | blimp/net/blimp_message_checkpointer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/net/blimp_message_checkpointer.cc
diff --git a/blimp/net/blimp_message_checkpointer.cc b/blimp/net/blimp_message_checkpointer.cc
deleted file mode 100644
index e1354da0cddd138c8be492492d4fc9dfda632777..0000000000000000000000000000000000000000
--- a/blimp/net/blimp_message_checkpointer.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "blimp/net/blimp_message_checkpointer.h"
-
-#include "base/logging.h"
-#include "blimp/common/create_blimp_message.h"
-#include "blimp/common/proto/blimp_message.pb.h"
-#include "blimp/common/proto/protocol_control.pb.h"
-#include "blimp/net/blimp_message_checkpoint_observer.h"
-#include "net/base/net_errors.h"
-
-namespace blimp {
-
-namespace {
-const int kDeferCheckpointAckSeconds = 1;
-}
-
-BlimpMessageCheckpointer::BlimpMessageCheckpointer(
- BlimpMessageProcessor* incoming_processor,
- BlimpMessageProcessor* outgoing_processor,
- BlimpMessageCheckpointObserver* checkpoint_observer)
- : incoming_processor_(incoming_processor),
- outgoing_processor_(outgoing_processor),
- checkpoint_observer_(checkpoint_observer),
- weak_factory_(this) {
- DCHECK(incoming_processor_);
- DCHECK(outgoing_processor_);
- DCHECK(checkpoint_observer_);
-}
-
-BlimpMessageCheckpointer::~BlimpMessageCheckpointer() {}
-
-void BlimpMessageCheckpointer::ProcessMessage(
- std::unique_ptr<BlimpMessage> message,
- const net::CompletionCallback& callback) {
- if (message->has_protocol_control()) {
- if (message->protocol_control().has_checkpoint_ack() &&
- message->protocol_control().checkpoint_ack().has_checkpoint_id()) {
- checkpoint_observer_->OnMessageCheckpoint(
- message->protocol_control().checkpoint_ack().checkpoint_id());
- callback.Run(net::OK);
- } else {
- DLOG(WARNING) << "Invalid checkpoint ACK. Dropping connection.";
- callback.Run(net::ERR_FAILED);
- }
-
- return;
- }
-
- // TODO(wez): Provide independent checkpoints for each message->type()?
- DCHECK(message->has_message_id());
-
- // Store the message-Id to include in the checkpoint ACK.
- checkpoint_id_ = message->message_id();
-
- // Kick the timer, if not running, to ACK after a short delay.
- if (!defer_timer_.IsRunning()) {
- defer_timer_.Start(FROM_HERE,
- base::TimeDelta::FromSeconds(kDeferCheckpointAckSeconds),
- this, &BlimpMessageCheckpointer::SendCheckpointAck);
- }
-
- // Pass the message along for actual processing.
- incoming_processor_->ProcessMessage(
- std::move(message),
- base::Bind(&BlimpMessageCheckpointer::InvokeCompletionCallback,
- weak_factory_.GetWeakPtr(), callback));
-}
-
-void BlimpMessageCheckpointer::InvokeCompletionCallback(
- const net::CompletionCallback& callback,
- int result) {
- callback.Run(result);
-}
-
-void BlimpMessageCheckpointer::SendCheckpointAck() {
- outgoing_processor_->ProcessMessage(
- CreateCheckpointAckMessage(checkpoint_id_), net::CompletionCallback());
-}
-
-} // namespace blimp
« no previous file with comments | « blimp/net/blimp_message_checkpointer.h ('k') | blimp/net/blimp_message_checkpointer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698