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

Unified Diff: blimp/net/blimp_message_dispatcher.cc

Issue 1429193002: Add interfaces for most major Blimp net components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address wez's feedback. Created 5 years, 1 month 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
Index: blimp/net/blimp_message_dispatcher.cc
diff --git a/blimp/net/blimp_message_dispatcher.cc b/blimp/net/blimp_message_dispatcher.cc
deleted file mode 100644
index 8c07c9f3bd566feecc9bf98fb637c6af2bea085d..0000000000000000000000000000000000000000
--- a/blimp/net/blimp_message_dispatcher.cc
+++ /dev/null
@@ -1,45 +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_dispatcher.h"
-
-#include <string>
-
-#include "base/strings/stringprintf.h"
-
-namespace blimp {
-namespace {
-
-std::string BlimpMessageToDebugString(const BlimpMessage& message) {
- return base::StringPrintf("<message type=%d>", message.type());
-}
-
-} // namespace
-
-BlimpMessageDispatcher::BlimpMessageDispatcher() {}
-
-BlimpMessageDispatcher::~BlimpMessageDispatcher() {}
-
-void BlimpMessageDispatcher::AddReceiver(BlimpMessage::Type type,
- BlimpMessageReceiver* receiver) {
- DCHECK(receiver);
- if (feature_receiver_map_.find(type) == feature_receiver_map_.end()) {
- feature_receiver_map_.insert(std::make_pair(type, receiver));
- } else {
- DLOG(FATAL) << "Handler already registered for type=" << type << ".";
- }
-}
-
-net::Error BlimpMessageDispatcher::OnBlimpMessage(const BlimpMessage& message) {
- auto receiver_iter = feature_receiver_map_.find(message.type());
- if (receiver_iter == feature_receiver_map_.end()) {
- DLOG(FATAL) << "No registered receiver for "
- << BlimpMessageToDebugString(message) << ".";
- return net::ERR_NOT_IMPLEMENTED;
- }
-
- return receiver_iter->second->OnBlimpMessage(message);
-}
-
-} // namespace blimp

Powered by Google App Engine
This is Rietveld 408576698