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

Unified Diff: extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc

Issue 1841483002: [Extensions] Convert APIs to use movable types [11] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | extensions/browser/api/declarative/declarative_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc
diff --git a/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc b/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc
index 94c403858ba7c89a367232f93c7327ad004f3afe..0357ed9b951da3a4174f1570f5944e6d0bb15880 100644
--- a/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc
+++ b/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc
@@ -36,26 +36,25 @@ const char kInvalidUuidError[] = "Invalid UUID";
const char kPermissionDeniedError[] = "Permission denied";
const char kSocketNotFoundError[] = "Socket not found";
-linked_ptr<SocketInfo> CreateSocketInfo(int socket_id,
- BluetoothApiSocket* socket) {
+SocketInfo CreateSocketInfo(int socket_id, BluetoothApiSocket* socket) {
DCHECK_CURRENTLY_ON(BluetoothApiSocket::kThreadId);
- linked_ptr<SocketInfo> socket_info(new SocketInfo());
+ SocketInfo socket_info;
// This represents what we know about the socket, and does not call through
// to the system.
- socket_info->socket_id = socket_id;
+ socket_info.socket_id = socket_id;
if (socket->name()) {
- socket_info->name.reset(new std::string(*socket->name()));
+ socket_info.name.reset(new std::string(*socket->name()));
}
- socket_info->persistent = socket->persistent();
+ socket_info.persistent = socket->persistent();
if (socket->buffer_size() > 0) {
- socket_info->buffer_size.reset(new int(socket->buffer_size()));
+ socket_info.buffer_size.reset(new int(socket->buffer_size()));
}
- socket_info->paused = socket->paused();
- socket_info->connected = socket->IsConnected();
+ socket_info.paused = socket->paused();
+ socket_info.connected = socket->IsConnected();
if (socket->IsConnected())
- socket_info->address.reset(new std::string(socket->device_address()));
- socket_info->uuid.reset(new std::string(socket->uuid().canonical_value()));
+ socket_info.address.reset(new std::string(socket->device_address()));
+ socket_info.uuid.reset(new std::string(socket->uuid().canonical_value()));
return socket_info;
}
@@ -645,9 +644,8 @@ void BluetoothSocketGetInfoFunction::Work() {
return;
}
- linked_ptr<bluetooth_socket::SocketInfo> socket_info =
- CreateSocketInfo(params_->socket_id, socket);
- results_ = bluetooth_socket::GetInfo::Results::Create(*socket_info);
+ results_ = bluetooth_socket::GetInfo::Results::Create(
+ CreateSocketInfo(params_->socket_id, socket));
}
BluetoothSocketGetSocketsFunction::BluetoothSocketGetSocketsFunction() {}
@@ -657,13 +655,10 @@ BluetoothSocketGetSocketsFunction::~BluetoothSocketGetSocketsFunction() {}
bool BluetoothSocketGetSocketsFunction::Prepare() { return true; }
void BluetoothSocketGetSocketsFunction::Work() {
- std::vector<linked_ptr<bluetooth_socket::SocketInfo> > socket_infos;
+ std::vector<bluetooth_socket::SocketInfo> socket_infos;
base::hash_set<int>* resource_ids = GetSocketIds();
- if (resource_ids != NULL) {
- for (base::hash_set<int>::iterator it = resource_ids->begin();
- it != resource_ids->end();
- ++it) {
- int socket_id = *it;
+ if (resource_ids) {
+ for (int socket_id : *resource_ids) {
BluetoothApiSocket* socket = GetSocket(socket_id);
if (socket) {
socket_infos.push_back(CreateSocketInfo(socket_id, socket));
« no previous file with comments | « no previous file | extensions/browser/api/declarative/declarative_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698