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

Side by Side Diff: device/serial/serial_connection.cc

Issue 2080513002: Deletes mojo::Callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « device/serial/serial_connection.h ('k') | device/serial/serial_service_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "device/serial/serial_connection.h" 5 #include "device/serial/serial_connection.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "device/serial/buffer.h" 10 #include "device/serial/buffer.h"
(...skipping 21 matching lines...) Expand all
32 base::Bind(base::DoNothing)); 32 base::Bind(base::DoNothing));
33 } 33 }
34 34
35 SerialConnection::~SerialConnection() { 35 SerialConnection::~SerialConnection() {
36 receiver_->ShutDown(); 36 receiver_->ShutDown();
37 sender_->ShutDown(); 37 sender_->ShutDown();
38 io_handler_->CancelRead(serial::ReceiveError::DISCONNECTED); 38 io_handler_->CancelRead(serial::ReceiveError::DISCONNECTED);
39 io_handler_->CancelWrite(serial::SendError::DISCONNECTED); 39 io_handler_->CancelWrite(serial::SendError::DISCONNECTED);
40 } 40 }
41 41
42 void SerialConnection::GetInfo( 42 void SerialConnection::GetInfo(const GetInfoCallback& callback) {
43 const mojo::Callback<void(serial::ConnectionInfoPtr)>& callback) {
44 callback.Run(io_handler_->GetPortInfo()); 43 callback.Run(io_handler_->GetPortInfo());
45 } 44 }
46 45
47 void SerialConnection::SetOptions(serial::ConnectionOptionsPtr options, 46 void SerialConnection::SetOptions(serial::ConnectionOptionsPtr options,
48 const mojo::Callback<void(bool)>& callback) { 47 const SetOptionsCallback& callback) {
49 callback.Run(io_handler_->ConfigurePort(*options)); 48 callback.Run(io_handler_->ConfigurePort(*options));
50 io_handler_->CancelRead(device::serial::ReceiveError::NONE); 49 io_handler_->CancelRead(device::serial::ReceiveError::NONE);
51 } 50 }
52 51
53 void SerialConnection::SetControlSignals( 52 void SerialConnection::SetControlSignals(
54 serial::HostControlSignalsPtr signals, 53 serial::HostControlSignalsPtr signals,
55 const mojo::Callback<void(bool)>& callback) { 54 const SetControlSignalsCallback& callback) {
56 callback.Run(io_handler_->SetControlSignals(*signals)); 55 callback.Run(io_handler_->SetControlSignals(*signals));
57 } 56 }
58 57
59 void SerialConnection::GetControlSignals( 58 void SerialConnection::GetControlSignals(
60 const mojo::Callback<void(serial::DeviceControlSignalsPtr)>& callback) { 59 const GetControlSignalsCallback& callback) {
61 callback.Run(io_handler_->GetControlSignals()); 60 callback.Run(io_handler_->GetControlSignals());
62 } 61 }
63 62
64 void SerialConnection::Flush(const mojo::Callback<void(bool)>& callback) { 63 void SerialConnection::Flush(const FlushCallback& callback) {
65 callback.Run(io_handler_->Flush()); 64 callback.Run(io_handler_->Flush());
66 } 65 }
67 66
68 void SerialConnection::OnSendCancelled(int32_t error) { 67 void SerialConnection::OnSendCancelled(int32_t error) {
69 io_handler_->CancelWrite(static_cast<serial::SendError>(error)); 68 io_handler_->CancelWrite(static_cast<serial::SendError>(error));
70 } 69 }
71 70
72 void SerialConnection::OnSendPipeReady(std::unique_ptr<ReadOnlyBuffer> buffer) { 71 void SerialConnection::OnSendPipeReady(std::unique_ptr<ReadOnlyBuffer> buffer) {
73 io_handler_->Write(std::move(buffer)); 72 io_handler_->Write(std::move(buffer));
74 } 73 }
75 74
76 void SerialConnection::OnReceivePipeReady( 75 void SerialConnection::OnReceivePipeReady(
77 std::unique_ptr<WritableBuffer> buffer) { 76 std::unique_ptr<WritableBuffer> buffer) {
78 io_handler_->Read(std::move(buffer)); 77 io_handler_->Read(std::move(buffer));
79 } 78 }
80 79
81 } // namespace device 80 } // namespace device
OLDNEW
« no previous file with comments | « device/serial/serial_connection.h ('k') | device/serial/serial_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698