| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "blimp/net/browser_connection_handler.h" | 5 #include "blimp/net/browser_connection_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
| 12 #include "base/location.h" |
| 12 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 13 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 14 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/single_thread_task_runner.h" |
| 17 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "blimp/common/proto/blimp_message.pb.h" | 18 #include "blimp/common/proto/blimp_message.pb.h" |
| 16 #include "blimp/net/blimp_message_processor.h" | 19 #include "blimp/net/blimp_message_processor.h" |
| 17 #include "blimp/net/common.h" | 20 #include "blimp/net/common.h" |
| 18 #include "blimp/net/connection_error_observer.h" | 21 #include "blimp/net/connection_error_observer.h" |
| 19 #include "blimp/net/test_common.h" | 22 #include "blimp/net/test_common.h" |
| 20 #include "net/base/completion_callback.h" | 23 #include "net/base/completion_callback.h" |
| 21 #include "net/base/io_buffer.h" | 24 #include "net/base/io_buffer.h" |
| 22 #include "net/base/net_errors.h" | 25 #include "net/base/net_errors.h" |
| 23 #include "net/base/test_completion_callback.h" | 26 #include "net/base/test_completion_callback.h" |
| 24 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 95 |
| 93 private: | 96 private: |
| 94 void ForwardMessage(std::unique_ptr<BlimpMessage> message) { | 97 void ForwardMessage(std::unique_ptr<BlimpMessage> message) { |
| 95 other_end_->incoming_message_processor_->ProcessMessage( | 98 other_end_->incoming_message_processor_->ProcessMessage( |
| 96 std::move(message), net::CompletionCallback()); | 99 std::move(message), net::CompletionCallback()); |
| 97 } | 100 } |
| 98 | 101 |
| 99 // BlimpMessageProcessor implementation. | 102 // BlimpMessageProcessor implementation. |
| 100 void ProcessMessage(std::unique_ptr<BlimpMessage> message, | 103 void ProcessMessage(std::unique_ptr<BlimpMessage> message, |
| 101 const net::CompletionCallback& callback) override { | 104 const net::CompletionCallback& callback) override { |
| 102 base::MessageLoop::current()->PostTask( | 105 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 103 FROM_HERE, base::Bind(&FakeBlimpConnection::ForwardMessage, | 106 FROM_HERE, base::Bind(&FakeBlimpConnection::ForwardMessage, |
| 104 base::Unretained(this), base::Passed(&message))); | 107 base::Unretained(this), base::Passed(&message))); |
| 105 | 108 |
| 106 callback.Run(net::OK); | 109 callback.Run(net::OK); |
| 107 } | 110 } |
| 108 | 111 |
| 109 FakeBlimpConnection* other_end_ = nullptr; | 112 FakeBlimpConnection* other_end_ = nullptr; |
| 110 ConnectionErrorObserver* error_observer_ = nullptr; | 113 ConnectionErrorObserver* error_observer_ = nullptr; |
| 111 BlimpMessageProcessor* incoming_message_processor_ = nullptr; | 114 BlimpMessageProcessor* incoming_message_processor_ = nullptr; |
| 112 }; | 115 }; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // re-established. | 225 // re-established. |
| 223 client_input_feature_->outgoing_message_processor()->ProcessMessage( | 226 client_input_feature_->outgoing_message_processor()->ProcessMessage( |
| 224 std::move(client_input_message), net::CompletionCallback()); | 227 std::move(client_input_message), net::CompletionCallback()); |
| 225 | 228 |
| 226 // Simulates reconnection. | 229 // Simulates reconnection. |
| 227 SetupConnections(); | 230 SetupConnections(); |
| 228 } | 231 } |
| 229 | 232 |
| 230 } // namespace | 233 } // namespace |
| 231 } // namespace blimp | 234 } // namespace blimp |
| OLD | NEW |