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

Side by Side Diff: chromeos/binder/command_stream.cc

Issue 1575313002: Add CommandBroker::OnTransaction to handle incoming transactions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment Created 4 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 unified diff | Download patch
« no previous file with comments | « chromeos/binder/command_stream.h ('k') | chromeos/binder/command_stream_unittest.cc » ('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 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 "chromeos/binder/command_stream.h" 5 #include "chromeos/binder/command_stream.h"
6 6
7 #include <linux/android/binder.h> 7 #include <linux/android/binder.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 case BR_ERROR: { 104 case BR_ERROR: {
105 int32_t error = 0; 105 int32_t error = 0;
106 if (!reader->Read(&error, sizeof(error))) { 106 if (!reader->Read(&error, sizeof(error))) {
107 LOG(ERROR) << "Failed to read error code."; 107 LOG(ERROR) << "Failed to read error code.";
108 return false; 108 return false;
109 } 109 }
110 break; 110 break;
111 } 111 }
112 case BR_OK: 112 case BR_OK:
113 break; 113 break;
114 case BR_TRANSACTION: 114 case BR_TRANSACTION: {
115 NOTIMPLEMENTED(); 115 TransactionDataFromDriver data(
116 base::Bind(&CommandStream::FreeTransactionBuffer,
117 weak_ptr_factory_.GetWeakPtr()));
118 if (!reader->Read(data.mutable_data(), sizeof(*data.mutable_data()))) {
119 LOG(ERROR) << "Failed to read transaction data.";
120 return false;
121 }
122 if (!incoming_command_handler_->OnTransaction(data)) {
123 LOG(ERROR) << "Failed to handle transaction.";
124 return false;
125 }
116 break; 126 break;
127 }
117 case BR_REPLY: { 128 case BR_REPLY: {
118 scoped_ptr<TransactionDataFromDriver> data(new TransactionDataFromDriver( 129 scoped_ptr<TransactionDataFromDriver> data(new TransactionDataFromDriver(
119 base::Bind(&CommandStream::FreeTransactionBuffer, 130 base::Bind(&CommandStream::FreeTransactionBuffer,
120 weak_ptr_factory_.GetWeakPtr()))); 131 weak_ptr_factory_.GetWeakPtr())));
121 binder_transaction_data* data_struct = data->mutable_data(); 132 binder_transaction_data* data_struct = data->mutable_data();
122 if (!reader->Read(data_struct, sizeof(*data_struct))) { 133 if (!reader->Read(data_struct, sizeof(*data_struct))) {
123 LOG(ERROR) << "Failed to read transaction data."; 134 LOG(ERROR) << "Failed to read transaction data.";
124 return false; 135 return false;
125 } 136 }
126 incoming_command_handler_->OnReply(std::move(data)); 137 incoming_command_handler_->OnReply(std::move(data));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 205 }
195 return true; 206 return true;
196 } 207 }
197 208
198 void CommandStream::FreeTransactionBuffer(const void* ptr) { 209 void CommandStream::FreeTransactionBuffer(const void* ptr) {
199 DCHECK(thread_checker_.CalledOnValidThread()); 210 DCHECK(thread_checker_.CalledOnValidThread());
200 AppendOutgoingCommand(BC_FREE_BUFFER, &ptr, sizeof(ptr)); 211 AppendOutgoingCommand(BC_FREE_BUFFER, &ptr, sizeof(ptr));
201 } 212 }
202 213
203 } // namespace binder 214 } // namespace binder
OLDNEW
« no previous file with comments | « chromeos/binder/command_stream.h ('k') | chromeos/binder/command_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698